diff --git a/.gitignore b/.gitignore
index 466ce72d3057d909370a946037bed09c2263045b..7a2f12aac25417e9176e1c68b7255f6d4cc6922e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,23 +1,16 @@
 /.buildpath
 /.cache
-/.htaccess
 /.metadata
 /.project
 /.settings
 atlassian*
-/index.php
 /nbproject
 /sitemap
-/.htaccess.orig
 /.idea
 /.gitattributes
 /app/config_sandbox
 /app/etc/local.xml
-/app/etc/local.xml.*
 /app/etc/*/module.xml
-/downloader/.cache
-/downloader/cache.cfg
-/downloader/connect.cfg
 /lib/internal/flex/uploader/.actionScriptProperties
 /lib/internal/flex/uploader/.flexProperties
 /lib/internal/flex/uploader/.project
@@ -26,10 +19,18 @@ atlassian*
 /lib/internal/flex/varien/.flexLibProperties
 /lib/internal/flex/varien/.project
 /lib/internal/flex/varien/.settings
-/pub/media/*
+
+/pub/media/*.*
+!/pub/media/.htaccess
 /pub/media/customer/*
+!/pub/media/customer/.htaccess
 /pub/media/downloadable/*
+!/pub/media/downloadable/.htaccess
+/pub/media/theme/*
+/pub/media/theme_customization/*
+!/pub/media/theme_customization/.htaccess
 /pub/static/*
 !/pub/static/.htaccess
+
 /var/*
-/app/code/Magento/TestModule*
+!/var/.htaccess
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 174bd68b91babe9b25850685c8840fa2dc1294fb..4a4d7ccf5c67ce18a3e7839d240dcfcf524a2ee5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,27 @@
+0.1.0-alpha89
+=============
+* Fixed bugs:
+  * Fixed an issue where the Price indexer did not pass successfully from console after the first run
+  * Fixed an issue where deleted items were displayed in the Mini shopping cart
+  * Fixed an issue with the Mage_Sales_Model_OrderTest  unit test violating the Cyclomatic and NPath complexity requirements
+  * Fixed an issue where taxes were not applied for logged in users
+  * Fixed a JavaScript issue where the Checkout with PayPal button did not redirect to the PayPal site
+* Framework improvements:
+  * Removed the head.js library and its calls
+  * Implemented the usage of RequireJS for runtime resources loading on the storefront
+* Added the following functional tests:
+  * Create Backend Product Review
+  * Delete Used in Configurable Product Attribute
+  * Delete Search Term
+  * Mass Actions for Product Review
+  * Mass Delete Search Term
+  * Reset Currency Symbol
+  * Update Currency Symbol
+  * Update Grouped Product
+* Added composer.json for all the Magento components: modules, language packs, themes and the whole Magento framework
+* Removed the downloader, the Magento_Connect module and the Magento_Connect framework component
+* Implemented the “alpha-version” of the Independent Deployment Tool
+
 2.0.0.0-dev88
 =============
 * Fixed bugs:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e37828f3ac2111ca94b53f83128db91d51f66295..5672159c3d815a2ccafae84f976832b4f9ad6f60 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,7 @@ The Magento 2 development team will review all issues and contributions submitte
 
 ## Contribution Process
 
-If you are a new github user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, “fork” the Magento 2 project and be able to easily send “pull requests”.
+If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, “fork” the Magento 2 project and be able to easily send “pull requests”.
 
 1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
 2. Review the [Contributor License Agreement](https://github.com/magento/magento2/wiki/Contributor-License-Agreement) if this is your first time contributing.
@@ -26,11 +26,3 @@ Yes. We strongly encourage that you follow the requirements as stated, before su
 **Do you accept all contributions?**
 
 Not all contributions will be used or incorporated into the code for the project. The decision to incorporate the code or not is at the discretion of the Magento 2 development team.
-
-# X.Commerce (Magento) Contributor License Agreement
-
-All Submissions you make to Magento, a division of X.commerce, Inc. (“Magento”) through GitHub are subject to the following terms and conditions:
-
-1. You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission”) you submit through GitHub.
-2. Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above.
-3. You agree to the X.commerce Agreement found here: [https://www.x.com/developers/x.commerce/x.commerce-user-agreement](https://www.x.com/developers/x.commerce/x.commerce-user-agreement)
diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..d6f84501f5473fcf7887b249bd7ecb6561428065
--- /dev/null
+++ b/app/code/Magento/AdminNotification/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-admin-notification",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/AdminNotification"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml
index f54c5cc9f724c0aae45f4c9d62ac8a010b741e1e..859fe367e732fbdc1fba4ce208b8a67701c9a9d7 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml
+++ b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml
@@ -33,16 +33,6 @@
         <block class="Magento\AdminNotification\Block\ToolbarEntry" before="user" template="toolbar_entry.phtml" />
     </referenceContainer>
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-toolbar-entry-js" after="jquery-jquery-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_AdminNotification::toolbar_entry.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-system-notification-js" after="jquery-jquery-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_AdminNotification::system/notification.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-core-prototype-magento-css">
             <arguments>
                 <argument name="file" xsi:type="string">Magento_Core::prototype/magento.css</argument>
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml
index 905f88ad356c2c3c7353b73235beb8996f31e82e..624340dd72e756d1f32ede58cc91602e81e35ec3 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml
+++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml
@@ -33,20 +33,27 @@
     </ul>
 </div>
 <script type="text/javascript">
-    jQuery(function() {
-        jQuery("#system_messages_list").dialog({
+require([
+    "jquery",
+    "jquery/ui"
+], function($){
+
+    $(function() {
+        $("#system_messages_list").dialog({
             autoOpen: true,
             resizable: false,
             width: 650,
             position: {
                 using: function(pos) {
-                    jQuery(this).css({
+                    $(this).css({
                         "position": "absolute",
-                        "top": Math.ceil(jQuery(window).height()/2 - jQuery(this).height()/2),
+                        "top": Math.ceil($(window).height()/2 - $(this).height()/2),
                         "left": pos.left
                     });
                 }
             }
         });
     });
+
+});
 </script>
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js
index d03b59581ec80565abdd435a5e0dd1d95e9758fb..710f9b6561af6de531bb914be8829c6d8b110335 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js
+++ b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-jQuery(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+
     $.template(
         'systemMessageDialog',
         '<li class="{{if severity == 1}}error{{else}}warning{{/if}}">{{html text}}</li>'
@@ -69,5 +74,5 @@ jQuery(function ($) {
             $('#message-system-all').systemMessageDialog('open', 2);
         });
     });
-});
 
+});
\ No newline at end of file
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js b/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
index d2e3a4a454999e439360439dcf4379a9c2f9a0d4..cb3cbe631b23c67842a5ac98af6f149c1d8f23e3 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
+++ b/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
@@ -20,9 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     'use strict';
+
     $(document).ready(function() {
         // Mark notification as read via AJAX call
         var markNotificationAsRead = function(notificationId) {
@@ -120,4 +123,5 @@
             $('.notifications-action .counter').show();
         }
     });
-})(window.jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..83732fee6399df273ec3b54771839bd00540d8c3
--- /dev/null
+++ b/app/code/Magento/Authorizenet/composer.json
@@ -0,0 +1,27 @@
+{
+    "name": "magento/module-authorizenet",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-centinel": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Authorizenet"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml
index 4b5c4d3a0a340d9cbba6904d586a8545d0a699cd..8febaa01797d8408c3fae45b03da5457c93834c6 100644
--- a/app/code/Magento/Authorizenet/etc/module.xml
+++ b/app/code/Magento/Authorizenet/etc/module.xml
@@ -36,7 +36,6 @@
             <module name="Magento_Backend"/>
             <module name="Magento_Core"/>
             <module name="Magento_Payment"/>
-            <module name="Magento_Theme"/>
             <module name="Magento_Centinel"/>
             <module name="Magento_Catalog"/>
         </depends>
diff --git a/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/iframe.phtml b/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/iframe.phtml
index 29e98edd5976594ec4c9c452a035a7eb424b8b3f..daf1b0471ebaf82c0c5c7223a440034cef88ef57 100644
--- a/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/iframe.phtml
+++ b/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/iframe.phtml
@@ -34,7 +34,6 @@ $_helper = $this->helper('Magento\Authorizenet\Helper\HelperInterface');
 <html>
 <head>
 <script type="text/javascript">
-//<![CDATA[
 <?php if (isset($_params['redirect'])): ?>
 window.location="<?php echo $this->escapeUrl($_params['redirect']) ?>";
 <?php endif; ?>
@@ -47,7 +46,6 @@ window.top.directPostModel.showError(<?php echo $this->helper('Magento\Core\Help
 window.top.directPostModel.successUrl="<?php echo $_helper->getSuccessOrderUrl($_params) ?>";
 <?php endif; ?>
 <?php endif; ?>
-//]]>
 </script>
 </head>
 <body></body>
diff --git a/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml b/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml
index 9f2f68778e4b6156e8c7a64874ea68123de2af16..ee8ae162479da22ae7c912bb223b0b2e0562368c 100644
--- a/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml
+++ b/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml
@@ -83,7 +83,12 @@ $_orderUrl = $this->helper('Magento\Authorizenet\Helper\Backend')->getPlaceOrder
     <?php endif; ?>
 </ul>
 <script type="text/javascript">
-//<![CDATA[
+require([
+    'prototype',
+    'Magento_Sales/order/create/scripts',
+    'Magento_Authorizenet/js/direct-post'
+], function(){
+
 /**
  * Disable cart server validation in admin
  */
@@ -151,5 +156,4 @@ directPostModel = new directPost(
 <?php if (!$this->isAjaxRequest()): ?>
 });
 <?php endif; ?>
-//]]>
 </script>
diff --git a/app/code/Magento/Authorizenet/view/adminhtml/templates/form/cc.phtml b/app/code/Magento/Authorizenet/view/adminhtml/templates/form/cc.phtml
index dab35e20c6ff16bc21add33d650d0517f88901aa..fd69354d3180f14e680ce590dcf36d6467bf1c74 100644
--- a/app/code/Magento/Authorizenet/view/adminhtml/templates/form/cc.phtml
+++ b/app/code/Magento/Authorizenet/view/adminhtml/templates/form/cc.phtml
@@ -40,33 +40,38 @@
                 </div>
                 <?php echo $this->showNoticeMessage(__('Please enter a different credit card number to complete your purchase.')) ?>
                     <script type="text/javascript">
-                    //<![CDATA[
-                    function cancelPaymentAuthorizations(){
-                        new Ajax.Request('<?php echo $this->getAdminCancelUrl() ?>', {
-                            onSuccess : function(transport) {
-                                try{
-                                    response = eval('(' + transport.responseText + ')');
-                                } catch (e) {
-                                    response = {};
-                                }
+                    require([
+                        "prototype",
+                        "Magento_Sales/order/create/form"
+                    ], function(){
+
+                        window.cancelPaymentAuthorizations = function(){
+                            new Ajax.Request('<?php echo $this->getAdminCancelUrl() ?>', {
+                                onSuccess : function(transport) {
+                                    try{
+                                        response = eval('(' + transport.responseText + ')');
+                                    } catch (e) {
+                                        response = {};
+                                    }
 
-                                if (response.success) {
-                                    order.loadArea(['billing_method','totals'], true, []);
-                                } else {
-                                    var msg = response.error_message;
-                                    if (msg) {
-                                        alert(msg);
+                                    if (response.success) {
+                                        order.loadArea(['billing_method','totals'], true, []);
+                                    } else {
+                                        var msg = response.error_message;
+                                        if (msg) {
+                                            alert(msg);
+                                        }
                                     }
                                 }
-                            }
-                        });
-                    }
-                    <?php if ($_message = $this->getPartialAuthorizationConfirmationMessage()): ?>
-                    if (!confirm('<?php echo $this->escapeMessage($_message) ?>')) {
-                        cancelPaymentAuthorizations();
-                    }
-                    <?php endif;?>
-                    //]]>
+                            });
+                        }
+                        <?php if ($_message = $this->getPartialAuthorizationConfirmationMessage()): ?>
+                        if (!confirm('<?php echo $this->escapeMessage($_message) ?>')) {
+                            cancelPaymentAuthorizations();
+                        }
+                        <?php endif;?>
+
+                    });
                     </script>
         <?php endif;?>
     </div>
diff --git a/app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js b/app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js
index 6dd6f9570e0bf38646352d39a04a0ca77b397a41..80851eb1193aba011231f9509d9070db832dd2ad 100644
--- a/app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js
+++ b/app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js
@@ -20,7 +20,19 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var directPost = Class.create();
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "mage/backend/validation",
+            "prototype"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function (jQuery) {
+
+window.directPost = Class.create();
 directPost.prototype = {
     initialize : function(methodCode, iframeId, controller, orderSaveUrl,
             cgiUrl, nativeAction) {
@@ -414,3 +426,4 @@ directPost.prototype = {
         }
     }
 };
+}));
\ No newline at end of file
diff --git a/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml
index 738038f686f061d8e5e816e854bebaf0c4ba3ba4..e47395aa82be7eb40ddfb1fb0b0da811ad2b83f8 100644
--- a/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml
+++ b/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-authorizenet-js-direct-post-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Authorizenet::js/direct-post.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceBlock name="head.components">
         <block class="Magento\Framework\View\Element\Js\Components" name="authorizenet_page_head_components" template="Magento_Authorizenet::js/components.phtml"/>
     </referenceBlock>
diff --git a/app/code/Magento/Authorizenet/view/frontend/templates/js/components.phtml b/app/code/Magento/Authorizenet/view/frontend/templates/js/components.phtml
index 2121fd79926c54f820cd9658f98650eadf52e1ff..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Authorizenet/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Authorizenet/view/frontend/templates/js/components.phtml
@@ -22,17 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            authorizenetAuthenticate: [
-                '<?php echo $this->getViewFileUrl('Magento_Authorizenet::authorizenet-authenticate.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js b/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js
index 9305eb6c16c88b805e8e0bd7ff10725df6df4822..2a1df028436f09c6144b0ec22b1a7939dfed3c74 100644
--- a/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js
+++ b/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     "use strict";
+        
     $.widget('mage.authorizenetAuthenticate', {
         options : {
             cancelButtonSelector: 'button[name="cancel"]',
@@ -77,4 +82,5 @@
             });
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js b/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js
index 4a13cc23fdb95dc205db9cabe959968513a78ed3..dfc73e6c538e6fe05bd48ede2eee30dfa78e3853 100644
--- a/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js
+++ b/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js
@@ -22,8 +22,13 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
     "use strict";
+    
     $.widget('mage.directpost', {
         options: {
             placeOrderSelector: '[data-role="review-save"]',
@@ -141,5 +146,6 @@
             return data;
         }
     });
-})(jQuery);
 
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Authz/composer.json b/app/code/Magento/Authz/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..97348d965fc6947aef8c4f509f44a149ebce4d9f
--- /dev/null
+++ b/app/code/Magento/Authz/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-authz",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-user": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Authz"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php
index 02c984fea827554b78187532eb06971b614ac1b7..0c4d460a40e6540430f22c0e2092f71bd9172670 100644
--- a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php
+++ b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php
@@ -138,12 +138,14 @@ class Dependence extends \Magento\Backend\Block\AbstractBlock
         if (!$this->_depends) {
             return '';
         }
-        return '<script type="text/javascript"> new FormElementDependenceController(' .
+        return '<script type="text/javascript">
+            require(["mage/adminhtml/form"], function(){
+        new FormElementDependenceController(' .
             $this->_getDependsJson() .
             ($this->_configOptions ? ', ' .
             $this->_jsonEncoder->encode(
                 $this->_configOptions
-            ) : '') . '); </script>';
+            ) : '') . '); });</script>';
     }
 
     /**
diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php
index ef7f9488acd256ed6f5b7be3869722b9ca281120..2347f0886753a3fd949b3500bb6fb5a324236366 100644
--- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php
+++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php
@@ -116,7 +116,7 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilt
             $this->_localeResolver->getLocaleCode() .
             '"/>';
         $html .= '<script type="text/javascript">
-            (function( $ ) {
+            require(["jquery", "mage/calendar"], function($){
                 $("#' .
             $htmlId .
             '_range").dateRange({
@@ -140,7 +140,7 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilt
             '_to"
                     }
                 })
-            })(jQuery)
+            });
         </script>';
         return $html;
     }
diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php
index 049106511d9d78e34e5fb82696a8ebb0d7c117c4..0bae739e33376ddc2c655b99d6e11e3b37607aa4 100644
--- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php
+++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php
@@ -149,7 +149,7 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date
         $html .= '<input type="hidden" name="' . $this->_getHtmlName() . '[locale]"' . ' value="'
             . $this->_localeResolver->getLocaleCode() . '"/>';
         $html .= '<script type="text/javascript">
-            (function( $ ) {
+            require(["jquery", "mage/calendar"],function($){
                     $("#' . $htmlId . '_range").dateRange({
                         dateFormat: "' . $format . '",
                         timeFormat: "' . $timeFormat . '",
@@ -163,7 +163,7 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date
                             id: "' . $htmlId . '_to"
                         }
                     })
-            })(jQuery)
+            });
         </script>';
         return $html;
     }
diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php
index 9e2ddaf8401fda3f0e29f56e0604970758b4881e..0715f878d56ceff815b134b5824b892048e0d526 100644
--- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php
+++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php
@@ -258,14 +258,16 @@ abstract class AbstractMassaction extends \Magento\Backend\Block\Widget
      */
     public function getJavaScript()
     {
-        return " var {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', " .
+        return " {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', " .
             "{$this->getGridJsObjectName()}, '{$this->getSelectedJson()}'" .
             ", '{$this->getFormFieldNameInternal()}', '{$this->getFormFieldName()}');" .
             "{$this->getJsObjectName()}.setItems({$this->getItemsJson()}); " .
             "{$this->getJsObjectName()}.setGridIds('{$this->getGridIdsJson()}');" .
             ($this->getUseAjax() ? "{$this->getJsObjectName()}.setUseAjax(true);" : '') .
             ($this->getUseSelectAll() ? "{$this->getJsObjectName()}.setUseSelectAll(true);" : '') .
-            "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';";
+            "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';" . "\n" .
+            "window.{$this->getJsObjectName()} = {$this->getJsObjectName()};"
+            ;
     }
 
     /**
diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php
index 23312c8255a3c14479a0425b97a01b7da593d815..d2e8876a714af6bd60ab55e6c3797de92e2628a5 100644
--- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php
+++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php
@@ -268,14 +268,16 @@ class Extended extends \Magento\Backend\Block\Widget
      */
     public function getJavaScript()
     {
-        return " var {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', " .
+        return " {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', " .
             "{$this->getGridJsObjectName()}, '{$this->getSelectedJson()}'" .
             ", '{$this->getFormFieldNameInternal()}', '{$this->getFormFieldName()}');" .
             "{$this->getJsObjectName()}.setItems({$this->getItemsJson()}); " .
             "{$this->getJsObjectName()}.setGridIds('{$this->getGridIdsJson()}');" .
             ($this->getUseAjax() ? "{$this->getJsObjectName()}.setUseAjax(true);" : '') .
             ($this->getUseSelectAll() ? "{$this->getJsObjectName()}.setUseSelectAll(true);" : '') .
-            "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';";
+            "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';" . "\n" .
+            "window.{$this->getJsObjectName()} = {$this->getJsObjectName()};"
+            ;
     }
 
     /**
diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..22d9a7215c106c2d5fb3c88d2fd519fce1b25190
--- /dev/null
+++ b/app/code/Magento/Backend/composer.json
@@ -0,0 +1,41 @@
+{
+    "name": "magento/module-backend",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-admin-notification": "0.1.0-alpha89",
+        "magento/module-cron": "0.1.0-alpha89",
+        "magento/module-sendfriend": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-reports": "0.1.0-alpha89",
+        "magento/module-catalog-search": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-user": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-backup": "0.1.0-alpha89",
+        "magento/module-email": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-url-rewrite": "0.1.0-alpha89",
+        "magento/module-translation": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Backend"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml
index 6996cf87c8ffe3bf9bc85c64747d0f9f502be377..f7ba57915ed5e47e6ea6d04cdbfb4f116e1dbe2e 100644
--- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml
+++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml
@@ -24,13 +24,7 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ba-hashchange-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.ba-hashchange.min.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
+    <referenceBlock name="head"/>
     <referenceContainer name="js">
         <block class="Magento\Backend\Block\Template" template="Magento_Backend::system/config/js.phtml"/>
         <block class="Magento\Backend\Block\Template" template="Magento_Backend::system/shipping/applicable_country.phtml"/>
diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml
index 28158275162163648d5212ac86fe7e6ad7adf007..b569628baa3612ca69b174baefba438499f260ae 100644
--- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml
+++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml
@@ -29,66 +29,6 @@
             <action method="setTitle">
                 <argument translate="true" name="title" xsi:type="string">Magento Admin</argument>
             </action>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">jquery/jquery-1.8.2.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-jquery-no-conflict-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/jquery-no-conflict.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ui-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">jquery/jquery-ui-1.9.2.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="js-head-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">headjs/head.min.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="underscore-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">underscore.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-magento-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/mage.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-tmpl-min-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">jquery/jquery.tmpl.min.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-validate-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">jquery/jquery.validate.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-hoverintent-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">jquery/jquery.hoverIntent.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-translate-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/translate.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-backend-bootstrap-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/backend/bootstrap.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-backend-floating-header-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/backend/floating-header.js</argument>
-                </arguments>
-            </block>
             <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-prototype-js">
                 <arguments>
                     <argument name="file" xsi:type="string">prototype/prototype.js</argument>
@@ -109,21 +49,6 @@
                     <argument name="file" xsi:type="string">scriptaculous/effects.js</argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="scriptaculous-dragdrop-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">scriptaculous/dragdrop.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="scriptaculous-controls-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">scriptaculous/controls.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="scriptaculous-slider-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">scriptaculous/slider.js</argument>
-                </arguments>
-            </block>
             <block class="Magento\Theme\Block\Html\Head\Script" name="lib-ccard-js">
                 <arguments>
                     <argument name="file" xsi:type="string">lib/ccard.js</argument>
@@ -139,51 +64,16 @@
                     <argument name="file" xsi:type="string">varien/js.js</argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-hash-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/adminhtml/hash.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-events-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/adminhtml/events.js</argument>
-                </arguments>
-            </block>
             <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-varienloader-js">
                 <arguments>
                     <argument name="file" xsi:type="string">mage/adminhtml/varienLoader.js</argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-grid-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/adminhtml/grid.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-backend-tabs-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/backend/tabs.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-form-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/adminhtml/form.js</argument>
-                </arguments>
-            </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-accordion-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/adminhtml/accordion.js</argument>
-                </arguments>
-            </block>
             <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-tools-js">
                 <arguments>
                     <argument name="file" xsi:type="string">mage/adminhtml/tools.js</argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-catalog-product-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">Magento_Catalog::catalog/product.js</argument>
-                </arguments>
-            </block>
             <block class="Magento\Theme\Block\Html\Head\Script" name="lib-ds-sleight-js">
                 <arguments>
                     <argument name="file" xsi:type="string">lib/ds-sleight.js</argument>
@@ -201,16 +91,32 @@
                     </argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ui-timepicker-addon-js">
+
+            <block class="Magento\Theme\Block\Html\Head\Script" name="requirejs">
+                <arguments>
+                    <argument name="file" xsi:type="string">requirejs/require.js</argument>
+                </arguments>
+            </block>
+            <block class="Magento\Theme\Block\Html\Head\Script" name="app-config" after="jquery">
+                <arguments>
+                    <argument name="file" xsi:type="string">app-config.js</argument>
+                </arguments>
+            </block>
+            <!-- /**
+            TODO: remove jQuery. jQuery could be loaded through RequireJS. But only in case ALL MODULES ARE AMD MODULES.
+            Detail: http://requirejs.org/docs/jquery.html#noconflictmap
+            */ -->
+            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery" after="requirejs">
                 <arguments>
-                    <argument name="file" xsi:type="string">jquery/jquery-ui-timepicker-addon.js</argument>
+                    <argument name="file" xsi:type="string">jquery/jquery-1.8.2.js</argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-calendar-js">
+            <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-no-conflict" after="jquery">
                 <arguments>
-                    <argument name="file" xsi:type="string">mage/calendar.js</argument>
+                    <argument name="file" xsi:type="string">mage/jquery-no-conflict.js</argument>
                 </arguments>
             </block>
+
             <block class="Magento\Theme\Block\Html\Head\Script" name="extjs-ext-tree-js">
                 <arguments>
                     <argument name="file" xsi:type="string">extjs/ext-tree.js</argument>
@@ -261,16 +167,6 @@
                     </argument>
                 </arguments>
             </block>
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-wysiwyg-tiny-mce-setup-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">mage/adminhtml/wysiwyg/tiny_mce/setup.js</argument>
-                    <argument name="properties" xsi:type="array">
-                        <item name="attributes" xsi:type="string"/>
-                        <item name="ie_condition" xsi:type="string"/>
-                        <item name="flag_name" xsi:type="string">can_load_tiny_mce</item>
-                    </argument>
-                </arguments>
-            </block>
             <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Backend::page/js/components.phtml"/>
             <block class="Magento\Framework\View\Element\Html\Calendar" name="head.calendar" as="calendar" template="Magento_Backend::page/js/calendar.phtml"/>
         </block>
diff --git a/app/code/Magento/Backend/view/adminhtml/layout/editor.xml b/app/code/Magento/Backend/view/adminhtml/layout/editor.xml
index 2ead3b86fffbbe60e720be5cd0f8b9751364bd08..6789e6d13b04637dbf78e55d0ddfb214f5df7d6d 100644
--- a/app/code/Magento/Backend/view/adminhtml/layout/editor.xml
+++ b/app/code/Magento/Backend/view/adminhtml/layout/editor.xml
@@ -28,39 +28,9 @@
         <action method="setCanLoadExtJs">
             <argument name="flag" xsi:type="string">1</argument>
         </action>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-variables-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-backend-js-bootstrap-editor-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_Backend::variables.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-wysiwyg-widget-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/adminhtml/wysiwyg/widget.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="lib-flex-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/flex.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="lib-fabridge-js">
-            <arguments>
-                <argument name="file" xsi:type="string">lib/FABridge.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-flexuploader-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/adminhtml/flexuploader.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-browser-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/adminhtml/browser.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-window-js">
-            <arguments>
-                <argument name="file" xsi:type="string">prototype/window.js</argument>
+                <argument name="file" xsi:type="string">Magento_Backend::js/bootstrap/editor.js</argument>
             </arguments>
         </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="prototype-windows-themes-default-css">
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml
index feac84328172689a6b2c6bebf234d9e822775edd..bdde118326bc4a3d3b288233eee54a16db057cfc 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml
@@ -31,6 +31,16 @@
     <link rel="icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico') ?>" type="image/x-icon" />
     <link rel="shortcut icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico') ?>" type="image/x-icon" />
 
+    <script type="text/javascript">
+        var require = {
+            "baseUrl": "<?php echo $this->getViewFileUrl('/') ?>",
+            "paths": {
+                "jquery/ui": "jquery/jquery-ui-1.9.2",
+                "mage/components": "mage/backend/components"
+            }
+        };
+    </script>
+
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/reset.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/base.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/elements.css') ?>" media="all" />
@@ -39,21 +49,15 @@
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/pages.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/utils.css') ?>" media="all" />
 
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui-1.9.2.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/validation.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/backend/validation.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/backend/form.js') ?>"></script>
-
     <script src="<?php echo $this->getViewFileUrl('prototype/prototype.js') ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('scriptaculous/effects.js') ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('mage/captcha.js') ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('modernizr/modernizr.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('headjs/head.min.js') ?>"></script>
+
+    <script src="<?php echo $this->getViewFileUrl('requirejs/require.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('app-config.js') ?>"></script>
 </head>
 <body id="page-login" class="page-login" onload="document.forms['login-form'].username.focus();">
     <div class="wrapper">
@@ -90,7 +94,13 @@
                     </fieldset>
                 </form>
                 <script type="text/javascript">
-                    jQuery('#login-form').form().validation();
+                    require([
+                        "jquery",
+                        "mage/backend/form",
+                        "mage/backend/validation"
+                    ], function(jQuery){
+                        jQuery('#login-form').form().validation();
+                    });
                 </script>
             </div>
         </div>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml
index 87ffdbb2df77e02606b5fddf2f9f0bec41c8f1cb..c0edc02fad233304d94388fb53847f8b3c7894b2 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml
@@ -64,7 +64,17 @@ $numColumns = sizeof($this->getColumns());
 </div>
 <?php if($this->canDisplayContainer()): ?>
 <script type="text/javascript">
-//<![CDATA[
+var <?php echo $this->getJsObjectName() ?>;
+
+var deps = ['mage/adminhtml/grid'];
+
+<?php if (strpos($this->getRowClickCallback(), 'order.')!==false): ?>
+deps.push('Magento_Sales/order/create/form')
+<?php endif; ?>
+
+require(deps, function(){
+    <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>
+
     <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
     <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
     <?php if($this->getRowClickCallback()): ?>
@@ -80,7 +90,8 @@ $numColumns = sizeof($this->getColumns());
     <?php if($this->getMassactionBlock()->isAvailable()): ?>
     <?php echo $this->getMassactionBlock()->getJavaScript() ?>
     <?php endif ?>
-//]]>
+
+});
 </script>
 <?php endif; ?>
 <?php endif ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml
index 73ce59a12fc8b20b149a1ccd6b5e7ea16fd523c2..2a402b1877d334438924f47300ae30d9e6e65f43 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml
@@ -25,7 +25,6 @@
 
 <?php if (is_array($this->getChildBlock('diagrams')->getTabsIds())) : ?>
 <script type="text/javascript">
-//<![CDATA[
 function changeDiagramsPeriod(periodObj) {
     periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
 <?php foreach ($this->getChildBlock('diagrams')->getTabsIds() as $tabId): ?>
@@ -83,7 +82,6 @@ function toggleCal(id) {
     $('dashboard_'+id+'_cal_div').toggle();
     $('dashboard_'+id+'_range_div').toggle();
 }
-//]]>
 </script>
 <?php endif; ?>
  <div class="dashboard-container">
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml
index 7d31b5ea998bb87775064bd95cf586b96ed57fdc..57c02ea09b1d9e62c86a73662dd8adbc8736255c 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml
@@ -50,7 +50,6 @@
 </select>
 </p>
 <script type="text/javascript">
-//<![CDATA[
     function switchStore(obj){
         if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
             var selectionType = 'website';
@@ -71,5 +70,4 @@
         var periodParam = select.value ? 'period/'+select.value + '/' : '';
         setLocation('<?php echo $this->getSwitchUrl() ?>'+storeParam+periodParam);
     }
-//]]>
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml
index f2873b0f321489e5300a7121f92fe92e33acad6d..2c52ed5f6d1effb8913b6c3dfd1a3b00fc9013bb 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml
@@ -44,8 +44,12 @@
 </div>
 
 <script type="text/javascript">
-//<![CDATA[
-(function($) {
+require([
+    "jquery",
+    "mage/translate",
+    "jquery/file-uploader"
+], function($){
+
     $(function () {
         $('#fileupload').fileupload({
             dataType: 'json',
@@ -110,6 +114,6 @@
             ]
         });
     });
-})(jQuery);
-//]]>
+
+});
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml
index ab17d60e85fbfde4e9ddbf8b1cf4a9fb90e6f181..96007f399a583253c3d8e32e940728c58fe11e0a 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/page/head.phtml
@@ -35,6 +35,13 @@
     var BLANK_IMG = '<?php echo $this->getViewFileUrl('spacer.gif') ?>';
     var BASE_URL = '<?php echo $this->getUrl('*') ?>';
     var FORM_KEY = '<?php echo $this->getFormKey() ?>';
+    var require = {
+        "baseUrl": "<?php echo $this->getViewFileUrl('/') ?>",
+    	"paths": {
+            "jquery/ui": "jquery/jquery-ui-1.9.2",
+            "mage/components": "mage/backend/components"
+        }
+    };
 </script>
 
 <?php echo $this->getCssJsHtml() ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml
index 0b0c8c0b660f2be6a36c6805b4def7182a8f35f6..1524ee5331a659c9a92fac8f0d3e58efc1ca9068 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml
@@ -33,8 +33,11 @@
 ?>
 
 <script type="text/javascript">
-//<![CDATA[
-(function($) {
+require([
+    "jquery",
+    "jquery/ui"
+], function($){
+    
     $.extend(true, $, {
         calendarConfig: {
             dayNames: <?php echo $days['wide']?>,
@@ -68,9 +71,8 @@
             yearRange: '<?php echo $this->getYearRange() ?>'
         }
     });
-})(jQuery);
 
 enUS = <?php echo $enUS?>; // en_US locale reference
 
-//]]>
+});
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml
index f53f3ca75148c184b4b3cec2e39ae6ee2ea163e2..f5229c49574273d6b5bc49f047499da0581edd71 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml
@@ -32,90 +32,17 @@
 <?php /** @var $this \Magento\Framework\View\Element\Js\Components */ ?>
 
 <script type="text/javascript">
-(function($) {
-    'use strict';
-    $.mage.isDevMode(<?php echo $this->isDeveloperMode() ?>);
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
+        'use strict';
+        $.mage.isDevMode(<?php echo $this->isDeveloperMode() ?>);
 
-    /**
-     * Declaration of resources needed for defined components
-     */
-    $.mage.component({
-        form: [
-            '<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/backend/form.js') ?>'
-        ],
-        button: [
-            '<?php echo $this->getViewFileUrl('mage/backend/button.js') ?>'
-        ],
-        accordion: [
-            '<?php echo $this->getViewFileUrl('mage/accordion.js') ?>'
-        ],
-        actionLink: [
-            '<?php echo $this->getViewFileUrl('mage/backend/action-link.js') ?>'
-        ],
-        validation: [
-            /* validation widget also requires jQuery validate plug-in, but this plug-in
-                    need to be included directly in head because in some cases need to add validation rules
-                    before validation widget is instantiated
-            */
-            '<?php echo $this->getViewFileUrl('mage/translate.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/validation.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/backend/validation.js') ?>'
-        ],
-        notification: [
-            '<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/backend/notification.js') ?>'
-        ],
-        loader: [
-            '<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/translate.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/loader_old.js') ?>'
-        ],
-        loaderAjax: [
-            '<?php echo $this->getViewFileUrl('mage/loader_old.js') ?>'
-        ],
-        floatingHeader: [
-            '<?php echo $this->getViewFileUrl('mage/backend/floating-header.js') ?>'
-        ],
-        suggest: [
-            '<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/backend/menu.js') ?>',
-            '<?php echo $this->getViewFileUrl('mage/backend/suggest.js') ?>'
-        ],
-        mediabrowser: [
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js') ?>'
-        ],
-        rolesTree: [
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js')?>',
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js')?>',
-            '<?php echo $this->getViewFileUrl('Magento_User::js/roles-tree.js')?>'
-        ],
-        folderTree: [
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js')?>',
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js') ?>',
-            '<?php echo $this->getViewFileUrl('Magento_Cms::js/folder-tree.js') ?>'
-        ],
-        categoryTree: [
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js') ?>',
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js') ?>',
-            '<?php echo $this->getViewFileUrl('Magento_Catalog::js/category-tree.js') ?>'
-        ],
-        collapsible: [
-            '<?php echo $this->getViewFileUrl('mage/collapsible.js') ?>'
-        ]
-    })
-    /**
-     * Declaration of resources for components (based on previously defined components)
-     */
-    .extend('treeSuggest', 'suggest', [
-        '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js') ?>',
-        '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js') ?>',
-        '<?php echo $this->getViewFileUrl('mage/backend/tree-suggest.js') ?>'
-    ])
-    /**
-     * Load resources in advance for components which needed to be instantiated without delay.
-     */
-    .load('loader');
-})(jQuery);
+        /**
+         * Declaration of resources needed for defined components
+         */
+        $.mage.load('loader');
+    });
 </script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/translate.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/translate.phtml
index 78e6130c7270ef91a8b9bb29932f11ccc99ed27c..4a51eb03bac91a90a7a8245ac07c3edd4fc1d229 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/translate.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/translate.phtml
@@ -61,7 +61,7 @@ $_data = array(
 );
 ?>
 <script type="text/javascript">
-    (function($) {
-        $.mage.translate.add(<?php echo Zend_Json::encode($_data) ?>)
-    })(jQuery);
+require(["jquery","mage/translate"], function($){
+    $.mage.translate.add(<?php echo Zend_Json::encode($_data) ?>)
+});
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml
index 4a490c601c9c3b71d8c5e60988a83f4cfebc25fe..45c2c8ab5806a886c76b6b7a4816aee49872be2d 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml
@@ -107,6 +107,8 @@
 </div>
 
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     (function($) {
         var $storesList = $('[data-role=stores-list]');
         $storesList.on('click', '[data-value]', function(event) {
@@ -120,7 +122,7 @@
                 switcher.val(val).trigger('change'); // Set the value & trigger event
             }
         });
-    })(jQuery)
+    })(jQuery);
 
     var scopeSwitcherHandler;
 
@@ -156,5 +158,10 @@
             <?php endif; ?>
         }
     }
+    
+    window.scopeSwitcherHandler = scopeSwitcherHandler;    
+    window.switchScope = switchScope;
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml
index 872e321085cbc2222d00598e6767e3f82110e6df..d8cc5f3a4155bac8487a8f6a6da3920352400829 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/system/cache/edit.phtml
@@ -96,5 +96,7 @@
     </div>
 </form>
 <script type="text/javascript">
-    jQuery('#config-edit-form').mage('form').mage('validation');
+    require(["jquery","mage/mage"],function($){
+       $('#config-edit-form').mage('form').mage('validation');
+    });
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/config/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/config/edit.phtml
index 1fb05a5994623ada31e816c76781091a74019cd8..af41c55da34c171e75fda1d775ba1125c44c4dda 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/system/config/edit.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/system/config/edit.phtml
@@ -38,8 +38,14 @@
     </div>
 </form>
 <script type="text/javascript">
-(function($, window) {
-    $(function() {
+require([
+    "jquery",
+    "jquery/jquery.hashchange",
+    "mage/mage",
+    "prototype"
+], function(jQuery){
+
+    jQuery(function() {
         window.configForm = jQuery('#config-edit-form').mage('form').mage('validation', {
             submitHandler: function(form)
             {
@@ -339,8 +345,8 @@
             try {
                 var hashString = window.location.hash.replace('#', ''),
                     containerId = hashString.replace('-link', ''),
-                    state = $('#' + containerId + '-state'),
-                    head = $('#' + containerId + '-head');
+                    state = jQuery('#' + containerId + '-state'),
+                    head = jQuery('#' + containerId + '-head');
                 if (state.length) {
                     state.val(1);
                 }
@@ -351,10 +357,11 @@
             } catch(err) {
             }
             return false;
-        }
+        };
 
-        $(window).hashchange(handleHash);
+        jQuery(window).hashchange(handleHash);
         handleHash();
     });
-})(jQuery, window);
+
+});
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/config/form/field/array.phtml
index 4a0fe0129c68f4353238a7e38c5b6536600f5649..915db8987ea767413535776ba32e2ae489dd9c3e 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/system/config/form/field/array.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/system/config/form/field/array.phtml
@@ -52,7 +52,6 @@ $_colspan = $this->isAddAfter() ? 2 : 1;
     <input type="hidden" name="<?php echo $this->getElement()->getName(); ?>[__empty]" value="" />
 
     <script type="text/javascript">
-        //<![CDATA[
 
         // create row creator
         var arrayRow<?php echo $_htmlId ?> = {
@@ -134,6 +133,5 @@ $_colspan = $this->isAddAfter() ? 2 : 1;
         toggleValueElements({checked: true}, $('grid<?php echo $_htmlId; ?>').parentNode);
             <?php endif;?>
 
-        //]]>
     </script>
 </div>
\ No newline at end of file
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml
index 93f14ae691ff424081108d74af2cf2376ef3c2ad..ebb087cf42f41d63013b47f22a59f1bd9c960ece 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/system/config/system/storage/media/synchronize.phtml
@@ -26,9 +26,13 @@
 <?php /* @var $this \Magento\Backend\Block\System\Config\System\Storage\Media\Synchronize */ ?>
 
 <script type="text/javascript">
-//<![CDATA[
-    jQuery.mage.extend('validation', 'validation',
-        '<?php echo $this->getViewFileUrl('Magento_Backend::system/validation-rules.js'); ?>');
+require([
+    'jquery',
+    'prototype',
+    'mage/backend/validation'
+], function(jQuery){
+
+    jQuery.mage.extend('validation', 'validation', 'Magento_Backend/system/validation-rules');
 
     allowedStorages = [];
     addAllowedStorage(
@@ -165,7 +169,7 @@
         params = {
             storage:    $('system_media_storage_configuration_media_storage').value,
             connection: $('system_media_storage_configuration_media_database').value
-        }
+        };
 
         new Ajax.Request('<?php echo $this->getAjaxSyncUrl() ?>', {
             parameters:     params,
@@ -179,6 +183,8 @@
         disableSyncButton();
     }
 //]]>
+
+});
 </script>
 
 <?php echo $this->getButtonHtml() ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml
index a1a10d454775759abb749124dfe09fa536271b20..6b37a9b384861cd48ef131421787057ce0c39c7b 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/system/design/edit.phtml
@@ -26,5 +26,12 @@
     <?php echo $this->getBlockHtml('formkey')?>
 </form>
 <script type="text/javascript">
-    jQuery('#design-edit-form').mage('form').mage('validation');
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    $('#design-edit-form').mage('form').mage('validation');
+
+});
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/edit.phtml b/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/edit.phtml
index a60d45b127d4c5f45e87f567a899e1326900e044..4ae6d3fe83b7a81ffdaf38c38d2ccb0ab43d3367 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/edit.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/urlrewrite/edit.phtml
@@ -32,7 +32,15 @@
 
 <?php if ($this->getChildBlock('form')): ?>
 <script type="text/javascript">
-    jQuery('#edit_form').mage('form')
-        .mage('validation', {validationUrl: '<?php echo $this->getValidationUrl() ?>'});
+require([
+    'jquery',
+    'mage/backend/form',
+    'mage/backend/validation'
+], function($){
+
+    $('#edit_form').form()
+        .validation({validationUrl: '<?php echo $this->getValidationUrl() ?>'});
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml
index c80916d6b6e7c3bcf3a64bdbd611e2c8cbcc475b..cac8d6fd7bff7e78680801697beeec4758d71059 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/accordion.phtml
@@ -35,6 +35,10 @@ $items = $this->getItems();
     <?php endforeach ?>
     </dl>
     <script type="text/javascript">
-        tab_content_<?php echo $this->getHtmlId() ?>AccordionJs = new varienAccordion('tab_content_<?php echo $this->getHtmlId() ?>', '<?php echo $this->getShowOnlyOne() ?>');
+        require([
+            'mage/adminhtml/accordion'
+        ], function(){
+        	tab_content_<?php echo $this->getHtmlId() ?>AccordionJs = new varienAccordion('tab_content_<?php echo $this->getHtmlId() ?>', '<?php echo $this->getShowOnlyOne() ?>');
+    	});
     </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml
index 79e2c082fdfa22c9dae9f625ce597c71815948e8..2059c58b1d22e810246fb11750562af0c85706d5 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/button/split.phtml
@@ -59,12 +59,10 @@ $_helper = $this->helper('Magento\Core\Helper\Data');
 </div>
 
 <script type="text/javascript">
-    (function($) {
-        'use strict';
-
+require(['jquery'], function($){
         $('.actions-split')
             .on('click.splitDefault', '.action-default', function() {
                 $(this).siblings('.dropdown-menu').find('.item-default').trigger('click');
             });
-    })(window.jQuery);
+});
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml
index 991b8c149741de0f3aeddcd83583e715e7265d19..48234f6ef84b35a3cf4d474c6d705a8208f2aab0 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml
@@ -34,11 +34,17 @@
     </div>
 <?php endif; ?>
 <script type="text/javascript">
-    jQuery('#edit_form').mage('form')
-        .mage('validation', {
+require([
+    'jquery',
+    'mage/backend/form',
+    'mage/backend/validation'
+], function($){
+
+    $('#edit_form').form()
+        .validation({
             validationUrl: '<?php echo $this->getValidationUrl() ?>',
             highlight: function(element) {
-                var detailsElement = jQuery(element).closest('details');
+                var detailsElement = $(element).closest('details');
                 if (detailsElement.length && detailsElement.is('.details')) {
                     var summaryElement = detailsElement.find('summary');
                     if (summaryElement.length && summaryElement.attr('aria-expanded') === "false") {
@@ -47,5 +53,7 @@
                 }
             }
         });
+
+});
 </script>
 <?php echo $this->getFormScripts() ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml
index 8552937e98e7af88d8066704f6e9145be1f6805c..1647f0e67cb6bdd223bad498ac137deb9920659e 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml
@@ -77,6 +77,7 @@
       <label for="<?php echo $element->getHtmlId() ?>"><?php echo $element->getLabel() ?>:</label>
         <script type="text/javascript" src="<?php echo $this->getViewFileUrl('tiny_mce/tiny_mce.js') ?>"></script>
         <script type="text/javascript">
+
         //<![CDATA[
         tinyMCE.init({
             mode : "exact",
@@ -100,7 +101,8 @@
 
         });
         //]]>
-        </script>
+        
+</script>
       <textarea name="<?php echo $element->getName() ?>" title="<?php echo $element->getTitle() ?>" id="<?php echo $element->getHtmlId() ?>" class="textarea <?php echo $element->getClass() ?>" cols="80" rows="20"><?php echo $element->getValue(); ?></textarea>
     </span>
       <?php break;
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml
index 6312432def093151df6ad4b6ae04434519309bb2..acc486be3c00c02f1da9c65a930e61451f132e39 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml
@@ -59,7 +59,9 @@
 <?php endif; ?>
 
 <?php if ($i==0): ?>
-    <script type="text/javascript">document.getElementById("gallery_thead").style.visibility="hidden";</script>
+    <script type="text/javascript">
+document.getElementById("gallery_thead").style.visibility="hidden";
+</script>
 <?php endif; ?>
 
 </tbody></table>
@@ -132,6 +134,7 @@ function deleteImage(image)
     }
 }
 //]]>
+
 </script>
     </td>
 </tr>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml
index 2a0da74a661ab296c772469dd87ec03a17a382dd..341baadcf8306682746b21d33b7bdb4b63f2a45e 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml
@@ -155,27 +155,38 @@ $numColumns = sizeof($this->getColumns());
         <?php if ($this->canDisplayContainer()): ?>
     </div>
     <script type="text/javascript">
-        <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
-        <?php echo $this->getJsObjectName() ?>.useAjax = <?php echo $this->getUseAjax() ? 'true' : 'false' ?>;
-        <?php if ($this->getRowClickCallback()): ?>
-        <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
-        <?php endif; ?>
-        <?php if ($this->getCheckboxCheckCallback()): ?>
-        <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
-        <?php endif; ?>
-        <?php if ($this->getSortableUpdateCallback()): ?>
-        <?php echo $this->getJsObjectName() ?>.sortableUpdateCallback = <?php echo $this->getSortableUpdateCallback()?>;
-        <?php endif; ?>
-        <?php echo $this->getJsObjectName() ?>.bindSortable();
-        <?php if ($this->getRowInitCallback()): ?>
-        <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
-        <?php echo $this->getJsObjectName() ?>.initGridRows();
-        <?php endif; ?>
-        <?php if ($this->getChildBlock('grid.massaction') && $this->getChildBlock('grid.massaction')->isAvailable()): ?>
-        <?php echo $this->getChildBlock('grid.massaction')->getJavaScript() ?>
-        <?php endif ?>
-        <?php echo $this->getAdditionalJavaScript(); ?>
-    </script>
+        var deps = ['mage/adminhtml/grid'];
+
+    <?php if (strpos($this->getRowClickCallback(), 'order.')!==false): ?>
+    deps.push('Magento_Sales/order/create/form')
+    <?php endif; ?>
+
+        require(deps, function(){
+            <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>
+
+            <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
+            <?php echo $this->getJsObjectName() ?>.useAjax = <?php echo $this->getUseAjax() ? 'true' : 'false' ?>;
+            <?php if ($this->getRowClickCallback()): ?>
+            <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
+            <?php endif; ?>
+            <?php if ($this->getCheckboxCheckCallback()): ?>
+            <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
+            <?php endif; ?>
+            <?php if ($this->getSortableUpdateCallback()): ?>
+            <?php echo $this->getJsObjectName() ?>.sortableUpdateCallback = <?php echo $this->getSortableUpdateCallback()?>;
+            <?php endif; ?>
+            <?php echo $this->getJsObjectName() ?>.bindSortable();
+            <?php if ($this->getRowInitCallback()): ?>
+            <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
+            <?php echo $this->getJsObjectName() ?>.initGridRows();
+            <?php endif; ?>
+            <?php if ($this->getChildBlock('grid.massaction') && $this->getChildBlock('grid.massaction')->isAvailable()): ?>
+            <?php echo $this->getChildBlock('grid.massaction')->getJavaScript() ?>
+            <?php endif ?>
+            <?php echo $this->getAdditionalJavaScript(); ?>
+    
+        });
+</script>
 <?php endif; ?>
     <?php if ($this->getChildBlock('grid.js')): ?>
         <?php echo $this->getChildHtml('grid.js'); ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml
index 64b39eca4fe189665e49cc9ac3bb7f3b1551911a..7292c65216f4ba4384731fb20ab1f602ed18ef96 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml
@@ -245,7 +245,18 @@ $numColumns = sizeof($this->getColumns());
     <?php if ($this->canDisplayContainer()): ?>
 </div>
 <script type="text/javascript">
-    //<![CDATA[
+    var <?php echo $this->getJsObjectName() ?>;
+
+    var deps = ['mage/adminhtml/grid'];
+
+    <?php if (strpos($this->getRowClickCallback(), 'order.')!==false): ?>
+    deps.push('Magento_Sales/order/create/form')
+    <?php endif; ?>
+
+    require(deps, function(){
+        <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>
+
+        //<![CDATA[
     <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
     <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
     <?php if ($this->getRowClickCallback()): ?>
@@ -263,6 +274,8 @@ $numColumns = sizeof($this->getColumns());
     <?php endif ?>
     <?php echo $this->getAdditionalJavaScript(); ?>
     //]]>
+
+});
 </script>
 <?php endif; ?>
 <?php endif ?>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml
index 29944ddbc3d51e18773d7d3d043642ae91df3f48..6292bf70472617a5e4015c51c8b53a387e03778e 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction.phtml
@@ -82,32 +82,31 @@
     </div>
 </div>
 <script type="text/javascript">
-    (function($) {
+
+    require(['jquery'], function($){
         'use strict';
         $('#massaction-select').change(function () {
             var massAction = $('option:selected', this).val();
             switch (massAction) {
                 <?php if ($this->getUseSelectAll()):?>
                 case 'selectAll':
-                    return <?php echo $this->getJsObjectName() ?>.selectAll()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.selectAll();
+                    break;
                 case 'unselectAll':
-                    return <?php echo $this->getJsObjectName() ?>.unselectAll()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.unselectAll();
+                    break;
                 <?php endif; ?>
                 case 'selectVisible':
-                    return <?php echo $this->getJsObjectName() ?>.selectVisible()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.selectVisible();
+                    break;
                 case 'unselectVisible':
-                    return <?php echo $this->getJsObjectName() ?>.unselectVisible()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.unselectVisible();
+                    break;
             }
         });
-    })(window.jQuery);
+    });
+    <?php if (!$this->getParentBlock()->canDisplayContainer()): ?>
+        <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
+    <?php endif; ?>
 </script>
-<?php if (!$this->getParentBlock()->canDisplayContainer()): ?>
-<script type="text/javascript">
-    <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
-</script>
-<?php endif; ?>
 </div>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml
index 70c87c51cb714c9be3e7d4820ddf1e3701d20266..8809f846a791dcba79078742a76ee8194f968eb0 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/massaction_extended.phtml
@@ -83,32 +83,31 @@
     </div>
 </div>
 <script type="text/javascript">
-    (function($) {
+    require(['jquery'], function($){
         'use strict';
         $('#massaction-select').change(function () {
             var massAction = $('option:selected', this).val();
             switch (massAction) {
                 <?php if ($this->getUseSelectAll()):?>
                 case 'selectAll':
-                    return <?php echo $this->getJsObjectName() ?>.selectAll()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.selectAll();
+                    break;
                 case 'unselectAll':
-                    return <?php echo $this->getJsObjectName() ?>.unselectAll()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.unselectAll();
+                    break;
                 <?php endif; ?>
                 case 'selectVisible':
-                    return <?php echo $this->getJsObjectName() ?>.selectVisible()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.selectVisible();
+                    break;
                 case 'unselectVisible':
-                    return <?php echo $this->getJsObjectName() ?>.unselectVisible()
-                    break
+                    return <?php echo $this->getJsObjectName() ?>.unselectVisible();
+                    break;
             }
         });
-    })(window.jQuery);
+    });
+
+    <?php if (!$this->getParentBlock()->canDisplayContainer()): ?>
+        <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
+    <?php endif; ?>
 </script>
-<?php if (!$this->getParentBlock()->canDisplayContainer()): ?>
-<script type="text/javascript">
-    <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
-</script>
-<?php endif; ?>
 </div>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml
index 7acaea53beddcb782f60cc04db2923561b05075c..6eee42879030a160603257e549a81d56a7f24856 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/serializer.phtml
@@ -47,7 +47,11 @@
 <?php else :?>
 <input type="hidden" name="<?php echo $this->getInputElementName()?>"  value="" id="<?php echo $_id?>" />
 <script type="text/javascript">
-    new serializerController('<?php echo $_id?>', <?php echo $this->getDataAsJSON() ?>, <?php echo $this->getColumnInputNames(true) ?>, <?php echo $this->getGridBlock()->getJsObjectName() ?>, '<?php echo $this->getReloadParamName()?>');
+    require([
+        'mage/adminhtml/grid'
+    ], function(){
+        new serializerController('<?php echo $_id?>', <?php echo $this->getDataAsJSON() ?>, <?php echo $this->getColumnInputNames(true) ?>, <?php echo $this->getGridBlock()->getJsObjectName() ?>, '<?php echo $this->getReloadParamName()?>');
+    });
 </script>
 <?php endif;?>
 
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml
index 472820950a4cb7bd1771205931c7c0577a34be08..a46b9c8385ac7f9d6ef6f091b0648993b8b7dcc7 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabs.phtml
@@ -50,13 +50,15 @@
     </ul>
 </div>
 <script type="text/javascript">
-jQuery(function($) {
-    $('#<?php echo $this->getId() ?>').tabs({
-        active: '<?php echo $this->getActiveTabId() ?>',
-        destination: '#<?php echo $this->getDestElementId() ?>',
-        shadowTabs: <?php echo $this->getAllShadowTabs()?>,
-        tabsBlockPrefix: '<?php echo $this->getId() ?>_',
-        tabIdArgument: 'active_tab'
+require(['jquery',"mage/backend/tabs"], function($){
+    $(function() {
+        $('#<?php echo $this->getId() ?>').tabs({
+            active: '<?php echo $this->getActiveTabId() ?>',
+            destination: '#<?php echo $this->getDestElementId() ?>',
+            shadowTabs: <?php echo $this->getAllShadowTabs()?>,
+            tabsBlockPrefix: '<?php echo $this->getId() ?>_',
+            tabIdArgument: 'active_tab'
+        });
     });
 });
 </script>
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml
index a7f0c7a1dd770c3f5fff659e47dbedc453a46a62..3f97b3aab4592cfad5487815233be79803b943fe 100644
--- a/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml
@@ -47,12 +47,14 @@
 </ul>
 </div>
 <script type="text/javascript">
-    jQuery(function() {
-        jQuery('#<?php echo $this->getId() ?>').tabs({
+require(["jquery","mage/backend/tabs"], function($){
+    $(function() {
+        $('#<?php echo $this->getId() ?>').tabs({
             active: '<?php echo $this->getActiveTabId() ?>',
             destination: '#<?php echo $this->getDestElementId() ?>',
             shadowTabs: <?php echo $this->getAllShadowTabs()?>
         });
     });
+});
 </script>
 <?php endif; ?>
diff --git a/downloader/template/copyright.phtml b/app/code/Magento/Backend/view/adminhtml/web/js/bootstrap/editor.js
similarity index 87%
rename from downloader/template/copyright.phtml
rename to app/code/Magento/Backend/view/adminhtml/web/js/bootstrap/editor.js
index 0ee85590dacd513d39cc46f99151dc167d1cf192..5663e26f4b8dc5b2a5accb18024149623bed9ba3 100644
--- a/downloader/template/copyright.phtml
+++ b/app/code/Magento/Backend/view/adminhtml/web/js/bootstrap/editor.js
@@ -1,5 +1,5 @@
-<?php
 /**
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -21,5 +21,8 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-?>
-<?php echo __('Magento is an eBay Inc. company. Copyright&copy; %1 Magento, Inc. All rights reserved.', date('Y')) ?>
+require([
+    "Magento_Backend/variables",
+    "mage/adminhtml/browser",
+    "mage/adminhtml/wysiwyg/widget"
+]);
\ No newline at end of file
diff --git a/app/code/Magento/Backend/view/adminhtml/web/system/validation-rules.js b/app/code/Magento/Backend/view/adminhtml/web/system/validation-rules.js
index 31f864499de38fab8e7a111cfb152c7cdb7b52e9..fe25333ce6800dc77ef306da06aaa9211401ea91 100644
--- a/app/code/Magento/Backend/view/adminhtml/web/system/validation-rules.js
+++ b/app/code/Magento/Backend/view/adminhtml/web/system/validation-rules.js
@@ -22,7 +22,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function ($) {
+define([
+	"jquery",
+	"jquery/validate"
+], function(jQuery){
+
     jQuery.validator.addMethod('required-synchronize', function(){
         storage = getConnectionName(
             jQuery('#system_media_storage_configuration_media_storage').val(),
@@ -30,4 +34,5 @@
         );
         return allowedStorages.include(storage);
     }, 'Synchronization is required.');
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Backend/view/adminhtml/web/variables.js b/app/code/Magento/Backend/view/adminhtml/web/variables.js
index 32d86fbd763179015e8657d0fd865822b6f7dd26..e3326194016d2dda90554b9a6b63942e10dc933e 100644
--- a/app/code/Magento/Backend/view/adminhtml/web/variables.js
+++ b/app/code/Magento/Backend/view/adminhtml/web/variables.js
@@ -20,8 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "jquery/ui",
+    "prototype"
+], function(jQuery){
 
-var Variables = {
+window.Variables = {
     textareaElementId: null,
     variablesContent: null,
     dialogWindow: null,
@@ -108,7 +113,7 @@ var Variables = {
     }
 };
 
-MagentovariablePlugin = {
+window.MagentovariablePlugin = {
     editor: null,
     variables: null,
     textareaId: null,
@@ -147,3 +152,5 @@ MagentovariablePlugin = {
         return;
     }
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Backup/Block/Adminhtml/Dialogs.php b/app/code/Magento/Backup/Block/Adminhtml/Dialogs.php
index 9e22f365648d311d16938867f5be4cdc0348ee09..8fc1c0a828bf7dd5ec96e60958a2db229325f228 100644
--- a/app/code/Magento/Backup/Block/Adminhtml/Dialogs.php
+++ b/app/code/Magento/Backup/Block/Adminhtml/Dialogs.php
@@ -23,14 +23,12 @@
  */
 namespace Magento\Backup\Block\Adminhtml;
 
-use Magento\Framework\View\Element\AbstractBlock;
+use \Magento\Backend\Block\Template;
 
 /**
- * Adminhtml rollback dialogs block
- *
- * @author     Magento Core Team <core@magentocommerce.com>
+ * Backend rollback dialogs block
  */
-class Dialogs extends \Magento\Backend\Block\Template
+class Dialogs extends Template
 {
     /**
      * Block's template
@@ -38,22 +36,4 @@ class Dialogs extends \Magento\Backend\Block\Template
      * @var string
      */
     protected $_template = 'Magento_Backup::backup/dialogs.phtml';
-
-    /**
-     * Include backup.js file in page before rendering
-     *
-     * @return void
-     * @see AbstractBlock::_prepareLayout()
-     */
-    protected function _prepareLayout()
-    {
-        $this->getLayout()->getBlock(
-            'head'
-        )->addChild(
-            'magento-adminhtml-backup-js',
-            'Magento\Theme\Block\Html\Head\Script',
-            array('file' => 'mage/adminhtml/backup.js')
-        );
-        parent::_prepareLayout();
-    }
 }
diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..8af68b4da0463afaa33a6460dc946d616df0712e
--- /dev/null
+++ b/app/code/Magento/Backup/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-backup",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-cron": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Backup"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Backup/etc/module.xml b/app/code/Magento/Backup/etc/module.xml
index 20db9e5b28c9d8ff57374c9d400109548a215a27..66ccd9178cb7c796e14799a289bea8515abd974a 100644
--- a/app/code/Magento/Backup/etc/module.xml
+++ b/app/code/Magento/Backup/etc/module.xml
@@ -35,7 +35,6 @@
             <module name="Magento_Backend"/>
             <module name="Magento_Cron"/>
             <module name="Magento_Index"/>
-            <module name="Magento_Theme"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml
index 200a88e3ec25762676fc7dd7f8918c2a54ac2476..b5351c5f1719ef53a5e6046d8005798f0019959c 100644
--- a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml
+++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml
@@ -152,11 +152,16 @@
 ?>
 
 <script type="text/javascript">
+require([
+    "prototype",
+    "mage/adminhtml/backup"
+], function(){
+
 //<![CDATA[
-    document.observe('dom:loaded', function () {
-        backup = new AdminBackup();
-        backup.rollbackUrl = '<?php echo $this->escapeJsQuote($rollbackUrl);?>';
-        backup.backupUrl = '<?php echo $this->escapeJsQuote($backupUrl);?>';
-    });
+    backup = new AdminBackup();
+    backup.rollbackUrl = '<?php echo $this->escapeJsQuote($rollbackUrl);?>';
+    backup.backupUrl = '<?php echo $this->escapeJsQuote($backupUrl);?>';
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php
index f2eff0a06388f7a8fc750e02f61971195146d36a..f29da42f57918797e8a7582b9d679059a15eebc0 100644
--- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php
+++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php
@@ -161,7 +161,7 @@ class Extend extends \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Ele
                             $('dynamic-price-warning').hide();
                         }
                     }
-                }";
+                }"."\n";
 
             if (!($this->getAttribute()->getAttributeCode() == 'price' &&
                 !$this->getCanEditPrice() &&
diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..8bc03c3398594931486d39a0a971f6ea53481430
--- /dev/null
+++ b/app/code/Magento/Bundle/composer.json
@@ -0,0 +1,34 @@
+{
+    "name": "magento/module-bundle",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-catalog-rule": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-gift-message": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/module-webapi": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Bundle"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Bundle/data/bundle_setup/data-install-1.6.0.0.php b/app/code/Magento/Bundle/data/bundle_setup/data-install-1.6.0.0.php
index ca64d7f74b36fa638d242666ffeea97d6439c70c..7b8ff93e3a2f1438531a4505fa836cad29c363b4 100644
--- a/app/code/Magento/Bundle/data/bundle_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Bundle/data/bundle_setup/data-install-1.6.0.0.php
@@ -51,3 +51,136 @@ foreach ($fieldList as $field) {
 $applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to'));
 unset($applyTo[array_search('bundle', $applyTo)]);
 $installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to', implode(',', $applyTo));
+
+/**
+ * Add attributes to the eav/attribute
+ */
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'price_type',
+    array(
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => '',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'used_in_product_listing' => true,
+        'unique' => false,
+        'apply_to' => 'bundle'
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'sku_type',
+    array(
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => '',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'unique' => false,
+        'apply_to' => 'bundle'
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'weight_type',
+    array(
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => '',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'used_in_product_listing' => true,
+        'unique' => false,
+        'apply_to' => 'bundle'
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'price_view',
+    array(
+        'group' => 'Advanced Pricing',
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => 'Price View',
+        'input' => 'select',
+        'class' => '',
+        'source' => 'Magento\Bundle\Model\Product\Attribute\Source\Price\View',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'visible' => true,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'used_in_product_listing' => true,
+        'unique' => false,
+        'apply_to' => 'bundle'
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'shipment_type',
+    array(
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => 'Shipment',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'used_in_product_listing' => true,
+        'unique' => false,
+        'apply_to' => 'bundle'
+    )
+);
diff --git a/app/code/Magento/GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php b/app/code/Magento/Bundle/data/bundle_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
similarity index 79%
rename from app/code/Magento/GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php
rename to app/code/Magento/Bundle/data/bundle_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
index 2973162b448e19fed5e99372ea1dc232ee30b8dc..d33767f0a890630ac7d148a6b7efd0336ccde1bc 100644
--- a/app/code/Magento/GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php
+++ b/app/code/Magento/Bundle/data/bundle_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
@@ -25,9 +25,13 @@
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
 $installer = $this;
 
-$field = 'country_of_manufacture';
-$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to'));
-if (!in_array('grouped', $applyTo)) {
-    $applyTo[] = 'grouped';
-    $installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
+$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price', 'apply_to'));
+if (!in_array('bundle', $applyTo)) {
+    $applyTo[] = 'bundle';
+    $installer->updateAttribute(
+        \Magento\Catalog\Model\Product::ENTITY,
+        'group_price',
+        'apply_to',
+        implode(',', $applyTo)
+    );
 }
diff --git a/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php b/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php
index 8d23c980b5c54008c943714e006b7c06ed14a76a..117b1ba18a8c5278732730cb5f8cc4985f175a07 100644
--- a/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php
@@ -826,137 +826,4 @@ $table = $installer->getConnection()->newTable(
 );
 $installer->getConnection()->createTable($table);
 
-/**
- * Add attributes to the eav/attribute 
- */
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'price_type',
-    array(
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => '',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'used_in_product_listing' => true,
-        'unique' => false,
-        'apply_to' => 'bundle'
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'sku_type',
-    array(
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => '',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'unique' => false,
-        'apply_to' => 'bundle'
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'weight_type',
-    array(
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => '',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'used_in_product_listing' => true,
-        'unique' => false,
-        'apply_to' => 'bundle'
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'price_view',
-    array(
-        'group' => 'Prices',
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => 'Price View',
-        'input' => 'select',
-        'class' => '',
-        'source' => 'Magento\Bundle\Model\Product\Attribute\Source\Price\View',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'visible' => true,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'used_in_product_listing' => true,
-        'unique' => false,
-        'apply_to' => 'bundle'
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'shipment_type',
-    array(
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => 'Shipment',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'used_in_product_listing' => true,
-        'unique' => false,
-        'apply_to' => 'bundle'
-    )
-);
-
 $installer->endSetup();
diff --git a/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php
deleted file mode 100644
index 3575c3220b77a455805a11d760b0a537596ff564..0000000000000000000000000000000000000000
--- a/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/** @var $installer \Magento\Catalog\Model\Resource\Setup */
-$installer = $this;
-
-/** @var $this \Magento\Catalog\Model\Resource\Setup */
-$installFile = __DIR__ . '/upgrade-1.6.0.0-1.6.0.0.1.php';
-
-/** @var \Magento\Framework\Filesystem\Directory\Read $modulesDirectory */
-$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Framework\App\Filesystem::MODULES_DIR);
-
-if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) {
-    include $installFile;
-}
-
-/** @var $connection \Magento\Framework\DB\Adapter\Pdo\Mysql */
-$connection = $installer->getConnection();
-$memoryTables = array(
-    'catalog_product_index_price_bundle_opt_tmp',
-    'catalog_product_index_price_bundle_sel_tmp',
-    'catalog_product_index_price_bundle_tmp'
-);
-
-foreach ($memoryTables as $table) {
-    $connection->changeTableEngine($this->getTable($table), \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY);
-}
diff --git a/app/code/Magento/Bundle/sql/bundle_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Bundle/sql/bundle_setup/upgrade-1.6.0.0-1.6.0.0.1.php
index 8744d651a9b77852ec933766b7c132c10246bb7b..73b513ffa677b11775817198d47afefb3340deb3 100644
--- a/app/code/Magento/Bundle/sql/bundle_setup/upgrade-1.6.0.0-1.6.0.0.1.php
+++ b/app/code/Magento/Bundle/sql/bundle_setup/upgrade-1.6.0.0-1.6.0.0.1.php
@@ -24,6 +24,7 @@
 
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
 $installer = $this;
+/** @var $connection \Magento\Framework\DB\Adapter\Pdo\Mysql */
 $connection = $installer->getConnection();
 
 $priceIndexerTables = array('catalog_product_index_price_bundle_idx', 'catalog_product_index_price_bundle_tmp');
@@ -72,13 +73,12 @@ foreach ($optionsPriceIndexerTables as $table) {
     );
 }
 
-$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price', 'apply_to'));
-if (!in_array('bundle', $applyTo)) {
-    $applyTo[] = 'bundle';
-    $installer->updateAttribute(
-        \Magento\Catalog\Model\Product::ENTITY,
-        'group_price',
-        'apply_to',
-        implode(',', $applyTo)
-    );
+$memoryTables = array(
+    'catalog_product_index_price_bundle_opt_tmp',
+    'catalog_product_index_price_bundle_sel_tmp',
+    'catalog_product_index_price_bundle_tmp'
+);
+
+foreach ($memoryTables as $table) {
+    $connection->changeTableEngine($this->getTable($table), \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY);
 }
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml
index bcea63391ee2d5c2edfcaffaa6181ea66e0c9bd8..d7d8432c1fdb23edd58c305ecb6b478ae3908846 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml
@@ -37,53 +37,58 @@
     </div>
 </fieldset>
 
-<script>
-var BundleControl = Class.create();
-BundleControl.prototype = {
-    initialize: function (config) {
-        this.config = config;
-    },
+<script type="text/javascript">
+require([
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+    BundleControl = Class.create();
+    
+    BundleControl.prototype = {
+        initialize: function (config) {
+            this.config = config;
+        },
 
-    changeSelection: function (selection) {
-        if (selection.multiple) {
-            return;
-        }
-        var parts = selection.id.split('-'), optionId = parts[2],
-            showQtyInput = selection.value && selection.value != 'none',
-            options = this.config.options[optionId],
-            selectionOptions = options && options.selections && options.selections[selection.value] || {};
+        changeSelection: function (selection) {
+            if (selection.multiple) {
+                return;
+            }
+            var parts = selection.id.split('-'), optionId = parts[2],
+                showQtyInput = selection.value && selection.value != 'none',
+                options = this.config.options[optionId],
+                selectionOptions = options && options.selections && options.selections[selection.value] || {};
 
-        selectionOptions.can_change_qty = Number(selectionOptions.can_change_qty) && showQtyInput;
-        this.updateQtyInput(optionId, selectionOptions);
-    },
+            selectionOptions.can_change_qty = Number(selectionOptions.can_change_qty) && showQtyInput;
+            this.updateQtyInput(optionId, selectionOptions);
+        },
 
-    updateQtyInput: function(optionId, selectionOptions) {
-        var elem = $('bundle-option-' + optionId + '-qty-input'),
-            default_qty = Number(selectionOptions.default_qty);
-        if (!elem) {
-            return;
-        }
-        if (selectionOptions.can_change_qty) {
-            elem.removeClassName('qty-disabled');
-            elem.disabled = false;
-            elem.value = default_qty || 1;
-        } else {
-            elem.addClassName('qty-disabled');
-            elem.disabled = true;
-            elem.value = default_qty || 0;
-        }
-    },
+        updateQtyInput: function(optionId, selectionOptions) {
+            var elem = $('bundle-option-' + optionId + '-qty-input'),
+                default_qty = Number(selectionOptions.default_qty);
+            if (!elem) {
+                return;
+            }
+            if (selectionOptions.can_change_qty) {
+                elem.removeClassName('qty-disabled');
+                elem.disabled = false;
+                elem.value = default_qty || 1;
+            } else {
+                elem.addClassName('qty-disabled');
+                elem.disabled = true;
+                elem.value = default_qty || 0;
+            }
+        },
 
-    updateForDefaults: function () {
-        for (var optionId in this.config.options) {
-            var selection = $('bundle-option-' + optionId);
-            if (selection) {
-                this.changeSelection(selection);
+        updateForDefaults: function () {
+            for (var optionId in this.config.options) {
+                var selection = $('bundle-option-' + optionId);
+                if (selection) {
+                    this.changeSelection(selection);
+                }
             }
         }
-    }
-}
-ProductConfigure.bundleControl = new BundleControl(<?php echo $this->getJsonConfig() ?>);
+    };
+    ProductConfigure.bundleControl = new BundleControl(<?php echo $this->getJsonConfig() ?>);
+});
 </script>
 
 <?php endif; ?>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml
index b1ee690a1fc28412ff4d98239372a8cd97dee565..18d8e61c85e84da943ed9329354711ab85861c0a 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml
@@ -25,9 +25,11 @@
 /** @var $this \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle */
 ?>
 <script type="text/javascript">
-    if(typeof Bundle=='undefined') {
-        Bundle = {};
-    }
+
+if(typeof Bundle=='undefined') {
+    Bundle = {};
+}
+
 </script>
 
 <div class="entry-edit form-inline" id="bundle_product_container">
@@ -62,7 +64,10 @@
     </div>
 </div>
 
+<input type="hidden" name="affect_bundle_product_selections" value="1" />
+
 <script type="text/javascript">
+require(["prototype", "mage/adminhtml/form"], function(){
     // re-bind form elements onchange
     varienWindowOnload(true);
 
@@ -74,16 +79,19 @@
         }
     });
     <?php endif; ?>
+});
+require([
+    "jquery",
+    "jquery/jquery.tabs",
+    "mage/mage",
+    "Magento_Bundle/js/bundle-product",
+    "mage/backend/validation"
+], function($){
 
-    jQuery.mage.extend('validation', 'validation',
-        '<?php echo $this->getViewFileUrl('Magento_Bundle::product/validation-rules.js'); ?>');
+    $.mage.extend('validation', 'validation', 'Magento_Bundle/product/validation-rules');
 
-    jQuery(function($) {
-        head.js("<?php echo $this->getViewFileUrl('Magento_Bundle::js/bundle-product.js') ?>", head.ready(function () {
-            $('#bundle_product_container').mage('bundleProduct');
-            $('#product_bundle_container .collapse').collapse('hide');
-        }));
-    });
-</script>
+    $('#bundle_product_container').bundleProduct();
+    $('#product_bundle_container .collapse').collapse('hide');
 
-<input type="hidden" name="affect_bundle_product_selections" value="1" />
+});
+</script>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml
index bb23569664ff3fab069d36e8cd7faa070db354b9..31ae5a831dd69fb84c942dfe427e481bd21e04a3 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml
@@ -126,13 +126,21 @@
         <div id="<?php echo $this->getFieldId() ?>_search_{{index}}" class="selection-search"></div>
     </div>
 </script>
-<script type="text/javascript">
-    var optionTemplate = jQuery('#bundle-option-template').html();
-</script>
 
 <?php echo $this->getSelectionHtml() ?>
 
 <script type="text/javascript">
+require([
+    "jquery",
+    "js/theme",
+    "Magento_Bundle/js/bundle-product",
+
+    "prototype",
+    "mage/adminhtml/form"
+], function(jQuery){
+
+    var optionTemplate = jQuery('#bundle-option-template').html();
+
 function changeInputType(oldObject, oType) {
     var newObject = document.createElement('input');
     newObject.type = oType;
@@ -300,4 +308,6 @@ document.observe("dom:loaded", function() {
     togglePriceType();
     Event.observe('price_type', 'change', togglePriceType);
 });
+
+});
 </script>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml
index 0fdb5cbe347d1ec06644420008e0ba8237189861..3e635fe0a92c61b814a5568ad59060d2f6a68a25 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml
@@ -112,6 +112,7 @@
     </td>
 </script>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
 var bundleTemplateBox = jQuery('#bundle-option-selection-box-template').html(),
     bundleTemplateRow = jQuery('#bundle-option-selection-row-template').html();
 
@@ -359,4 +360,6 @@ Bundle.Selection.prototype = {
 };
 
 bSelection = new Bundle.Selection();
+
+});
 </script>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/stock/disabler.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/stock/disabler.phtml
index 611221f650a83203409b578e9f1732a509ea9617..9815251d8d09c68ff26e7196d69d503238d476f6 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/product/stock/disabler.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/stock/disabler.phtml
@@ -23,11 +23,11 @@
  */
 ?>
 <script type="text/javascript">
-(function($) {
+require(['jquery'], function($){
     $('[data-tab-panel=product-details]').on('stockbeforedisable', function(e) {
         if (e.productType === 'bundle') {
             return false;
         }
     });
-})(jQuery);
+});
 </script>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml
index 2c8ce9d91ff120b7b31b8e1de2f7648749b88862..dd71a1ff87ce357556bff17cdd91cfad37acf35e 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml
@@ -384,10 +384,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
-                            $('<?php echo $_id ?>').hide();
-                            $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                            $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml
index dcf932a5d980437d603addeb0461d75ce6d6cefb..08bfb2833ec21e793bc4fe5cef0bb1777ad8f662 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml
@@ -315,10 +315,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
-                            $('<?php echo $_id ?>').hide();
-                            $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                            $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml
index eba4f867bd4eb80977225d9a4886f713eae26ced..e2cb0a835e6566d294e1d43da97a1e41cb9c874c 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml
@@ -374,10 +374,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
-                            $('<?php echo $_id ?>').hide();
-                            $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                            $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml
index 7222e0271a1ca739305318eb1077f035cd4d6f14..1e424aa4ca2a4caa238bb31c1ec1d7e6c10e33c1 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml
@@ -319,10 +319,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
-                            $('<?php echo $_id ?>').hide();
-                            $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                            $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+require(['protoype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml
index 5c01f5776199895499cf1b4b3c28d9f0d5b92dc3..0524cf9c580722980ce4ba213cd73872bfc0738b 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/order/view/items/renderer.phtml
@@ -387,10 +387,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
-                            $('<?php echo $_id ?>').hide();
-                            $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                            $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml
index 7d6659e1f2c205661cbe8ef1516aad22bcbb38d9..3b392e135850e98fc34c27d321f2273fddb9d6df 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml
@@ -97,10 +97,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
+require(['prototype'], function(){
+
                             $('<?php echo $_id ?>').hide();
                             $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
                             $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml
index fcb8df374c6d586b197317abed31860211988312..1c0e8a0df9e1e41c64794d734fbc90db9aecbd83 100644
--- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml
+++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml
@@ -96,10 +96,14 @@
                         <?php if ($_remainder):?>
                             ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                             <script type="text/javascript">
+require(['prototype'], function(){
+
                             $('<?php echo $_id ?>').hide();
                             $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
                             $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                            </script>
+                            
+});
+</script>
                         <?php endif;?>
                     <?php endif;?>
                     </dd>
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js
index 586738ab20aa7c97e8e347b6cc10eca2e1d3e278..df30e729f45c14333a527ee277f55f8763363e6a 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js
@@ -24,8 +24,14 @@
 /*global FORM_KEY*/
 /*global bSelection*/
 /*global $H*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "prototype"
+], function($){
     'use strict';
+
     $.widget('mage.bundleProduct', {
         _create: function () {
             this._initOptionBoxes();
@@ -202,4 +208,5 @@
             return this;
         }
     });
-})(jQuery);
+
+});
diff --git a/app/code/Magento/Bundle/view/adminhtml/web/product/validation-rules.js b/app/code/Magento/Bundle/view/adminhtml/web/product/validation-rules.js
index fb0cf02342ebae68821b72b56a85d692302bb8ff..42cac339684593fcd17d8b4935065b6d5f6272a9 100644
--- a/app/code/Magento/Bundle/view/adminhtml/web/product/validation-rules.js
+++ b/app/code/Magento/Bundle/view/adminhtml/web/product/validation-rules.js
@@ -22,7 +22,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function ($) {
+define(["jquery","mage/backend/validation"], function($){
     $.validator.addMethod('validate-greater-zero-based-on-option', function(v, el) {
         var optionType = $(el)
                 .closest('.form-list')
@@ -35,4 +35,4 @@
         }
         return true;
     }, 'Please enter a number greater 0 in this field.');
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml
index 53f256a2faa9f44f19e11bbe4ea78c528bdb9e60..0f96fd61c0de4dcf0cab9dac4dd6b68b8783afcb 100644
--- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml
+++ b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-bundle-js-product-summary-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Bundle::js/product-summary.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceBlock name="root">
         <action method="addBodyClass">
             <argument name="value" xsi:type="string">type-bundle</argument>
diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml
index 90d5ed9da3ed1d5dc777790a6ace4f40082a4a4a..561e6e4258e32c8d904329036d5fe56adfea1664 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml
@@ -68,8 +68,10 @@
     </div>
 </div>
 <script>
-    //<![CDATA[
-    (function ($) {
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
         $('.product-add-form').mage('slide', {
             'slideSpeed': 1500,
             'slideSelector': '#bundle-slide',
@@ -80,7 +82,6 @@
             'autostart': true
             <?php endif;?>
         });
-    })(jQuery);
-    //]]>
+    });
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml
index 29926a7a454c2502a7b9c8796fca41cb9601ba6d..da621823db2c355c24ef1ad5b62fff13f3d273a0 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml
@@ -27,25 +27,29 @@
 <?php $_product = $this->getProduct() ?>
 <?php if($_product->isSaleable()): ?>
     <script type="text/javascript">
-        //<![CDATA[
-        (function ($) {
-            $(document).ready(function() {
-                $('#product_addtocart_form').mage('bundleOption', {
-                    "bundleConfig": <?php echo $this->getJsonConfig() ?>,
-                    "roundingMethod" : "<?php echo $this->getRoundingMethod() ?>",
-                    "bundleOptionQtyPrefix": "#bundle-option-",
-                    "bundleOptionQtySuffix": "-qty-input",
-                    "priceSelectors": {
-                        "product-price": "#product-price-<?php echo $_product->getId()?>",
-                        "bundle-price": "#bundle-price-<?php echo $_product->getId()?>",
-                        "price-including-tax": "#price-including-tax-product-price-<?php echo $_product->getId()?>",
-                        "price-excluding-tax": "#price-excluding-tax-product-price-<?php echo $_product->getId()?>"
-                    }
-                });
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+    //<![CDATA[
+        $(document).ready(function() {
+            $('#product_addtocart_form').mage('bundleOption', {
+                "bundleConfig": <?php echo $this->getJsonConfig() ?>,
+                "roundingMethod" : "<?php echo $this->getRoundingMethod() ?>",
+                "bundleOptionQtyPrefix": "#bundle-option-",
+                "bundleOptionQtySuffix": "-qty-input",
+                "priceSelectors": {
+                    "product-price": "#product-price-<?php echo $_product->getId()?>",
+                    "bundle-price": "#bundle-price-<?php echo $_product->getId()?>",
+                    "price-including-tax": "#price-including-tax-product-price-<?php echo $_product->getId()?>",
+                    "price-excluding-tax": "#price-excluding-tax-product-price-<?php echo $_product->getId()?>"
+                }
             });
-        })(jQuery);
-        //]]>
-    </script>
+        });
+    //]]>
+    
+});
+</script>
 <?php endif; ?>
 <?php if ($this->displayProductStockStatus()): ?>
     <?php if ($_product->isAvailable()): ?>
diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml
index dd8ca14969206a500b2bed27b9ac8491f80d255c..1f02e65f72b0d761aa31b5359e8ddf8c0bd24786 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml
@@ -31,16 +31,21 @@ $helper = $this->helper('Magento\Catalog\Helper\Output');
 <?php if ($product->isSaleable()):?>
     <?php if (count($options)): ?>
         <script type="text/javascript">
-            //<![CDATA[
-            (function ($) {
-                $(document).ready(function() {
-                    $('#product_addtocart_form').mage('bundleOption', {
-                        optionConfig:<?php echo $this->getJsonConfig()?>})
-                        .trigger('changeSelection');
-                });
-            })(jQuery);
-            //]]>
-        </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+//<![CDATA[
+    $(document).ready(function() {
+        $('#product_addtocart_form').mage('bundleOption', {
+            optionConfig:<?php echo $this->getJsonConfig()?>})
+            .trigger('changeSelection');
+    });
+//]]>
+        
+});
+</script>
         <fieldset class="fieldset bundle options">
             <legend id="customizeTitle" class="legend title">
                 <span><?php echo __('Customize %1', $helper->productAttribute($product, $product->getName(), 'name')) ?></span>
diff --git a/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml b/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml
index 231b8c0bc5d6cf82948e982afbef33f2c22aa4b3..6f8e3d98836ce2b176e162e1f61d48274f4da62b 100644
--- a/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Bundle/view/frontend/templates/js/components.phtml
@@ -22,24 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-    <script type="text/javascript">
-        (function($) {
-            "use strict";
-            /**
-             * Declaration of resources needed for defined components
-             */
-            $.mage.component({
-                sticky: [
-                    '<?php echo $this->getViewFileUrl('mage/sticky.js') ?>'
-                ],
-                bundleOption: [
-                    '<?php echo $this->getViewFileUrl('Magento_Catalog::js/price-option.js') ?>',
-                    '<?php echo $this->getViewFileUrl('Magento_Bundle::bundle.js') ?>'
-                ],
-                slide: [
-                    '<?php echo $this->getViewFileUrl('Magento_Bundle::js/slide.js') ?>'
-                ]
-            });
-        })(jQuery);
-    </script>
 <?php echo $this->getChildHtml() ?>
\ No newline at end of file
diff --git a/app/code/Magento/Bundle/view/frontend/web/bundle.js b/app/code/Magento/Bundle/view/frontend/web/bundle.js
index 0310fe5aa0687b5822757ac0a4d5f3430f4e4787..a92fe8100bbcbd7a5406ddee2d6ec3762bb6d0e4 100644
--- a/app/code/Magento/Bundle/view/frontend/web/bundle.js
+++ b/app/code/Magento/Bundle/view/frontend/web/bundle.js
@@ -22,8 +22,14 @@
  */
 /*jshint browser:true jquery:true*/
 /*jshint loopfunc: true */
-(function($, undefined) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "Magento_Catalog/js/price-option"
+], function($){
     "use strict";
+
     $.widget('mage.bundleOption', {
         options: {
             productBundleSelector: '.product.bundle.option',
@@ -324,4 +330,6 @@
             }
         }
     });
-})(jQuery);
+
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Bundle/view/frontend/web/js/float.js b/app/code/Magento/Bundle/view/frontend/web/js/float.js
index 329b66f7f0bdb147a2a6e8bf0901d00269692a7c..550934f40a9fa0ee855da8d9eaecfbb5331b4110 100644
--- a/app/code/Magento/Bundle/view/frontend/web/js/float.js
+++ b/app/code/Magento/Bundle/view/frontend/web/js/float.js
@@ -21,7 +21,8 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function($, window) {
+define(["jquery","jquery/ui"], function($){
+
     $.widget('mage.float', {
         options: {
             productOptionsSelector: '#product-options-wrapper'
@@ -65,5 +66,4 @@
             }
         }
     });
-})(jQuery, window);
-
+});
\ No newline at end of file
diff --git a/app/code/Magento/Bundle/view/frontend/web/js/product-summary.js b/app/code/Magento/Bundle/view/frontend/web/js/product-summary.js
index a6e760d6dad341509d1d27fe2fe3fd971844eb32..82ce1dfd110d050564b924002e2f8c74df818cdf 100644
--- a/app/code/Magento/Bundle/view/frontend/web/js/product-summary.js
+++ b/app/code/Magento/Bundle/view/frontend/web/js/product-summary.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function ($, undefined) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
     "use strict";
 
     /**
@@ -113,4 +117,4 @@
             });
         }
     });
-})(jQuery);
\ No newline at end of file
+});
diff --git a/app/code/Magento/Bundle/view/frontend/web/js/slide.js b/app/code/Magento/Bundle/view/frontend/web/js/slide.js
index be64d5612164a2a9d79bd32efd7a03baa253797e..199c88532af0429d6c264d84d42b3f81c8df2f8e 100644
--- a/app/code/Magento/Bundle/view/frontend/web/js/slide.js
+++ b/app/code/Magento/Bundle/view/frontend/web/js/slide.js
@@ -21,7 +21,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function($) {
+define(["jquery","jquery/ui"], function($){
     $.widget('mage.slide', {
         options: {
             slideSpeed: 1500,
@@ -94,4 +94,4 @@
             $(this.options.bundleOptionsContainer).slideUp(800);
         }
     });
-}(jQuery));
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..958b9216861f45076c955401e3ed9b4bb97edd65
--- /dev/null
+++ b/app/code/Magento/Captcha/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-captcha",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Captcha"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Captcha/etc/module.xml b/app/code/Magento/Captcha/etc/module.xml
index 71cade06549b5f5f09190247bdc979d6281258f7..6acd8eb30c604ffa58057f8652f677bd7f5f2df6 100644
--- a/app/code/Magento/Captcha/etc/module.xml
+++ b/app/code/Magento/Captcha/etc/module.xml
@@ -35,7 +35,6 @@
             <module name="Magento_Checkout"/>
             <module name="Magento_Core"/>
             <module name="Magento_Backend"/>
-            <module name="Magento_Theme"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
index 584ceb28f47b47ed89adbdf7c6d098e951275c13..bd03c12d450f37b32ac99a5904cd3843ce98a80f 100644
--- a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
+++ b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml
@@ -42,6 +42,8 @@
 </div>
 <?php endif; ?>
 <script type="text/javascript">
+require(["prototype", "mage/captcha"], function(){
+
 //<![CDATA[
     document.observe('dom:loaded', function () {
         var captcha = new Captcha('<?php echo $this->getRefreshUrl() ?>', '<?php echo $this->getFormId() ?>');
@@ -52,4 +54,6 @@
 
     });
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml
index 5d61af923cc9233f1bf18273a210c8ac69b6e8e5..ea6a0533cf8ec48df968c54977bd0cddab246a43 100644
--- a/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml
+++ b/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml
@@ -38,13 +38,7 @@
         </block>
     </referenceContainer>
     <referenceContainer name="form.billing.additional.info">
-        <referenceBlock name="head">
-            <block class="Magento\Theme\Block\Html\Head\Script" name="magento-captcha-onepage-js">
-                <arguments>
-                    <argument name="file" xsi:type="string">Magento_Captcha::onepage.js</argument>
-                </arguments>
-            </block>
-        </referenceBlock>
+        <referenceBlock name="head" />
         <block class="Magento\Captcha\Block\Captcha" name="captcha.guest.checkout">
             <action method="setFormId">
                 <argument name="formId" xsi:type="string">guest_checkout</argument>
diff --git a/app/code/Magento/Captcha/view/frontend/templates/js/components.phtml b/app/code/Magento/Captcha/view/frontend/templates/js/components.phtml
index 1cf26b6e849ec7bbdea872d11cf8d4a87362e4d6..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Captcha/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Captcha/view/frontend/templates/js/components.phtml
@@ -22,17 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            captcha: [
-                '<?php echo $this->getViewFileUrl('Magento_Captcha::captcha.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Captcha/view/frontend/web/captcha.js b/app/code/Magento/Captcha/view/frontend/web/captcha.js
index d1677a6b64c679e4f7ae3ff184b4859e328d8e2f..8d59eb7c0b1f590606139e41cec2ac4b5f84d901 100644
--- a/app/code/Magento/Captcha/view/frontend/web/captcha.js
+++ b/app/code/Magento/Captcha/view/frontend/web/captcha.js
@@ -21,7 +21,8 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($, undefined) {
+define(["jquery","jquery/ui"], function($){
+
     "use strict";
     $.widget('mage.captcha', {
         options: {
@@ -65,5 +66,4 @@
             });
         }
     });
-})(jQuery);
-
+});
\ No newline at end of file
diff --git a/app/code/Magento/Captcha/view/frontend/web/onepage.js b/app/code/Magento/Captcha/view/frontend/web/onepage.js
index 856d6b3f90b9d5db59a09e5bcca7526c4ac92d86..7b46f88847c3674a3859d87325118ab16ac9f032 100644
--- a/app/code/Magento/Captcha/view/frontend/web/onepage.js
+++ b/app/code/Magento/Captcha/view/frontend/web/onepage.js
@@ -21,7 +21,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($, window, document) {
+define(["jquery"], function($){
     "use strict";
     $(document).on("login",function() {
         $("[data-captcha='guest_checkout'], [data-captcha='register_during_checkout']").hide();
@@ -31,4 +31,4 @@
     }).on('billingSave', function() {
             $(".captcha-reload:visible").trigger("click");
         });
-})(jQuery, window, document);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php
index 278362736589f7fcd4be34276b75204789618679..84e61bf939b5dbe9c99fa5f818bd1745531b93c4 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php
@@ -75,13 +75,13 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory
      */
     protected function _prepareLayout()
     {
-        if ($head = $this->getLayout()->getBlock('head')) {
-            $head->addChild(
-                'magento-adminhtml-catalog-category-edit-js',
-                'Magento\Theme\Block\Html\Head\Script',
-                array('file' => 'Magento_Catalog::catalog/category/edit.js')
-            );
-        }
+        //if ($head = $this->getLayout()->getBlock('head')) {
+        //    $head->addChild(
+        //        'magento-adminhtml-catalog-category-edit-js',
+        //        'Magento\Theme\Block\Html\Head\Script',
+        //        array('file' => 'Magento_Catalog::catalog/category/edit.js')
+        //    );
+        //}
 
         $category = $this->getCategory();
         $categoryId = (int)$category->getId();
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php
index cea6675fbceb954a89f5b1cd946e2f5badf81d65..4978d20a1cec21cc56e4e28a1bc2fde861faf708 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php
@@ -109,6 +109,11 @@ class Wysiwyg extends \Magento\Framework\Data\Form\Element\Textarea
             )->toHtml();
             $html .= <<<HTML
 <script type="text/javascript">
+require([
+    'jquery',
+    'mage/adminhtml/wysiwyg/tiny_mce/setup'
+], function(jQuery){
+
 jQuery('#{$this->getHtmlId()}')
     .addClass('wysiwyg-editor')
     .data(
@@ -127,6 +132,8 @@ jQuery('#{$this->getHtmlId()}')
             }
         ).turnOn()
     );
+
+});
 </script>
 HTML;
         }
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php
index 14e4dd6f9b9f3980f1b51d08c61d0f644370572e..210bae3a109d96e7bdc228c75b5f50c8a79091b8 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php
@@ -158,7 +158,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form implements
 HTML;
         if ($elementId === 'weight') {
             $html .= <<<HTML
-<script>jQuery(function($) {
+<script type="text/javascript">require(["jquery"],function($) {
     $('#weight_and_type_switcher, label[for=weight_and_type_switcher]').hide();
 });</script>
 HTML;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php
index 3806e39a9173bb9828d8cc1a7f013310aae66baf..85209d9bc7a1fad029a82bd9006f9448008f5c4e 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php
@@ -170,11 +170,14 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic
                 'saveCategoryUrl' => $this->getUrl('catalog/category/save')
             )
         );
+        //TODO: JavaScript logic should be moved to separate file or reviewed
         return <<<HTML
-<script>
-(function($) { // waiting for page to load to have '#category_ids-template' available
-    $('#new-category').mage('newCategoryDialog', $widgetOptions);
-})(jQuery);
+<script type="text/javascript">
+require(["jquery","mage/mage"],function($) {  // waiting for dependencies at first
+    $(function(){ // waiting for page to load to have '#category_ids-template' available
+        $('#new-category').mage('newCategoryDialog', $widgetOptions);
+    });
+});
 </script>
 HTML;
     }
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php
index 89c5e57c17d2383d361456a913b3fa480bddaf82..d2416eaacc089c2e026d4931c77e52782f87b31a 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php
@@ -145,14 +145,17 @@ class BaseImage extends \Magento\Framework\Data\Form\Element\AbstractElement
     <span>{$imageManagementText}</span>
 </span>
 <script>
-    (function($) {
+    require([
+        'jquery'
+    ],function($){
+
         'use strict';
 
         $('[data-activate-tab=image-management]')
             .on('click.toggleImageManagementTab', function() {
                 $('#product_info_tabs_image-management').trigger('click');
             });
-    })(window.jQuery);
+    });
 </script>
 
 HTML;
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php
index d48b04266d2ff78a850d6a627b0c25e77552058f..4a417b28d1887eaec91990ae3a85317611f26bc9 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php
@@ -159,8 +159,10 @@ class Category extends \Magento\Framework\Data\Form\Element\Multiselect
             );
         $return = <<<HTML
     <input id="{$htmlId}-suggest" placeholder="$suggestPlaceholder" />
-    <script>
-        jQuery('#{$htmlId}-suggest').mage('treeSuggest', {$selectorOptions});
+    <script type="text/javascript">
+        require(["jquery", "mage/mage", "mage/backend/tree-suggest"], function($){
+            $('#{$htmlId}-suggest').mage('treeSuggest', {$selectorOptions});
+        });
     </script>
 HTML;
         return $return . $button->toHtml();
diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..ff3ef067362d93006a87b9a450538f5885d8634b
--- /dev/null
+++ b/app/code/Magento/Catalog/composer.json
@@ -0,0 +1,42 @@
+{
+    "name": "magento/module-catalog",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/module-indexer": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-log": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-bundle": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-catalog-rule": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-catalog-search": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-product-alert": "0.1.0-alpha89",
+        "magento/module-url-rewrite": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Catalog"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php
index 1236a914f622e49184c1b83e724de3a6f972d687..451386d11d2d5a6517c065c22abc20131d4d31d4 100644
--- a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php
@@ -24,7 +24,7 @@
 
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
 $installer = $this;
-
+$installer->installEntities();
 // Create Root Catalog Node
 $installer->createCategory()->load(
     1
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
similarity index 100%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
index 675e3b4a6377ef6bca8626a0f98d67729c096834..387cbe674409e1633097872d4d5b2ea537cd1f2c 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
@@ -22,8 +22,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-$installer = $this;
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
+$installer = $this;
 
 $productTypes = array(
     \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
similarity index 100%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.10-1.6.0.0.11.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.10-1.6.0.0.11.php
similarity index 100%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.10-1.6.0.0.11.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.10-1.6.0.0.11.php
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.14-1.6.0.0.15.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php
similarity index 97%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.14-1.6.0.0.15.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php
index 17a4b302c42d069754df22d10b100171b15b6fd2..96c255fff1b81d5876773603e984afb104a33b48 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.14-1.6.0.0.15.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php
@@ -22,10 +22,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-$installer = $this;
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
-
-$installer->installEntities();
+$installer = $this;
 
 foreach (array('news_from_date', 'custom_design_from') as $attributeCode) {
     $installer->updateAttribute(
diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php
index 5cc6b98230fdf8345e1b295cd2787aa394c7fa5c..5c33356bf79decd4c687e8042fcdd48f56bea7ee 100644
--- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php
@@ -39,3 +39,28 @@ if ($attribute) {
         $this->updateAttribute($attribute['entity_type_id'], $attribute['attribute_id'], $key, $value);
     }
 }
+
+$this->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'quantity_and_stock_status',
+    array(
+        'group' => 'General',
+        'type' => 'int',
+        'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Stock',
+        'frontend' => '',
+        'label' => 'Quantity',
+        'input' => 'select',
+        'class' => '',
+        'input_renderer' => 'Magento\CatalogInventory\Block\Adminhtml\Form\Field\Stock',
+        'source' => 'Magento\CatalogInventory\Model\Stock\Status',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'default' => \Magento\CatalogInventory\Model\Stock::STOCK_IN_STOCK,
+        'user_defined' => false,
+        'visible' => true,
+        'required' => false,
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'unique' => false
+    )
+);
diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php
index 5c100dd4d8a0fce6dbaf00e2567b263f37293286..ace9f91db52cff1d344ac1f4b6eddbb92a81fc03 100644
--- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php
@@ -41,4 +41,11 @@ if ($attribute) {
         'frontend_input_renderer',
         'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\BaseImage'
     );
+
+    $this->updateAttribute(
+        $attribute['entity_type_id'],
+        $attribute['attribute_id'],
+        'used_in_product_listing',
+        '1'
+    );
 }
diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php
index 1e7049828791b3f4607e6619bc3f50a35beae517..088a9af243891625e10ea3cbddcb73ba778f737c 100644
--- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php
@@ -82,7 +82,6 @@ $attributesOrder = array(
     'name' => array($newGeneralTabName => 10),
     'sku' => array($newGeneralTabName => 20),
     'price' => array($newGeneralTabName => 30),
-    'tax_class_id' => array($newGeneralTabName => 40, 'is_required' => 0, 'default_value' => 2),
     'image' => array($newGeneralTabName => 50),
     'weight' => array($newGeneralTabName => 70, 'is_required' => 0),
     'category_ids' => array($newGeneralTabName => 80),
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.24-1.6.0.0.25.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.24-1.6.0.0.25.php
similarity index 100%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.24-1.6.0.0.25.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.24-1.6.0.0.25.php
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.3-1.6.0.0.4.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.3-1.6.0.0.4.php
similarity index 100%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.3-1.6.0.0.4.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.3-1.6.0.0.4.php
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.5-1.6.0.0.6.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php
similarity index 100%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.5-1.6.0.0.6.php
rename to app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php
index 9b764c83d42bcaabd2681f971733b873a0b71243..18554e203a02c252e8f43839fa8b8711e7999bff 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.5-1.6.0.0.6.php
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php
@@ -22,8 +22,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-$installer = $this;
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
+$installer = $this;
 
 $installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'url_key', 'frontend_label', 'URL Key');
 
diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php
new file mode 100644
index 0000000000000000000000000000000000000000..7dbbc001ebc583f60f89d8648dbc5a822f05c1f6
--- /dev/null
+++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var $installer \Magento\Catalog\Model\Resource\Setup */
+$installer = $this;
+
+$installer->addAttribute(
+    'catalog_product',
+    'group_price',
+    array(
+        'type' => 'decimal',
+        'label' => 'Group Price',
+        'input' => 'text',
+        'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice',
+        'required' => false,
+        'sort_order' => 6,
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
+        'apply_to' => 'simple,virtual',
+        'group' => 'Prices'
+    )
+);
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php
index 314021364e24484870e08f73df64c5ab1f726552..034a5a1721f6341e41e56e92443f097ef064863c 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php
+++ b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php
@@ -22,8 +22,8 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-$installer = $this;
 /* @var $installer \Magento\Catalog\Model\Resource\Setup */
+$installer = $this;
 
 $installer->startSetup();
 
@@ -54,7 +54,7 @@ $table = $installer->getConnection()->newTable(
     'type_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     32,
-    array('nullable' => false, 'default' => \Magento\Catalog\Model\Product\Type::DEFAULT_TYPE),
+    array('nullable' => false, 'default' => 'simple'),
     'Type ID'
 )->addColumn(
     'sku',
@@ -3925,5 +3925,3 @@ $installer->getConnection()->addForeignKey(
 );
 
 $installer->endSetup();
-
-$installer->installEntities();
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php
similarity index 81%
rename from app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php
rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php
index 5564229c77838ce72ccc226aa9ab6384652fbb1d..15426e897850ba0dbfe1706a48edbf1a7646dcd2 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php
+++ b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php
@@ -25,16 +25,6 @@
 /** @var $installer \Magento\Catalog\Model\Resource\Setup */
 $installer = $this;
 
-/** @var $this \Magento\Catalog\Model\Resource\Setup */
-$installFile = __DIR__ . '/upgrade-1.6.0.0.8-1.6.0.0.9.php';
-
-/** @var \Magento\Framework\Filesystem\Directory\Read $modulesDirectory */
-$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Framework\App\Filesystem::MODULES_DIR);
-
-if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) {
-    include $installFile;
-}
-
 /** @var $connection \Magento\Framework\DB\Adapter\Pdo\Mysql */
 $connection = $installer->getConnection();
 $memoryTables = array(
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php
index b715610f8df2f5347f890f53296d787567bf0acf..fbefe27b35c84a3526af2586f6e3f8094a4f15bd 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php
+++ b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php
@@ -112,22 +112,6 @@ $table = $installer->getConnection()->newTable(
 );
 $installer->getConnection()->createTable($table);
 
-$installer->addAttribute(
-    'catalog_product',
-    'group_price',
-    array(
-        'type' => 'decimal',
-        'label' => 'Group Price',
-        'input' => 'text',
-        'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice',
-        'required' => false,
-        'sort_order' => 6,
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
-        'apply_to' => 'simple,virtual',
-        'group' => 'Prices'
-    )
-);
-
 /**
  * Create table 'catalog_product_index_group_price'
  */
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml
index f2d61a89f3362e3990bb9894e12358d021db8bcc..5680c7b90b28e8401602168f6b430eff2677f7ab 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml
@@ -31,29 +31,9 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-bootstrap-category-edit-js">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-canvas-to-blob-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/canvas-to-blob.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
+                <argument name="file" xsi:type="string">Magento_Catalog::js/bootstrap/category-edit.js</argument>
             </arguments>
         </block>
     </referenceBlock>
@@ -77,4 +57,8 @@
     <referenceContainer name="js">
         <block class="Magento\Framework\View\Element\Template" template="Magento_Catalog::catalog/wysiwyg/js.phtml" name="catalog.wysiwyg.js"/>
     </referenceContainer>
+    <referenceBlock name="head.components">
+        <block class="Magento\Framework\View\Element\Js\Components" name="catalog_category_page_head_components" template="Magento_Catalog::js/components.phtml"/>
+    </referenceBlock>
+
 </layout>
diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml
index 85078f96fb777dd129b774ab5cefd4ae4e85b8ee..60aefbaa14ca21fa3cdd7716b863992269a8b047 100644
--- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml
@@ -31,79 +31,19 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-canvas-to-blob-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/canvas-to-blob.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-proxy-event-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/proxy-event.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-adminhtml-catalog-category-selector-css">
             <arguments>
                 <argument name="file" xsi:type="string">Magento_Catalog::catalog/category-selector.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jstree-jquery-hotkeys-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jstree/jquery.hotkeys.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jstree-jquery-jstree-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jstree/jquery.jstree.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-catalog-type-switcher-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::catalog/type-switcher.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-catalog-base-image-uploader-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::catalog/base-image-uploader.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-product-gallery-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::js/product-gallery.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-catalog-product-product-css">
             <arguments>
                 <argument name="file" xsi:type="string">Magento_Catalog::product/product.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-custom-options-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::js/custom-options.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-new-category-dialog-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-bootstrap-product-new-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::js/new-category-dialog.js</argument>
+                <argument name="file" xsi:type="string">Magento_Catalog::js/bootstrap/product-new.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml
index ba3c87c7151ff49321da3b1cca7d6e0e838d50da..c833921acc4b736d77cf69586fe9bc2da053e9f3 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml
@@ -27,6 +27,11 @@
 <div id="<?php echo $_divId ?>" class="tree"></div>
 
 <script type="text/javascript">
+    require([
+        "prototype",
+        "mage/adminhtml/form"
+    ], function(){
+
 //<![CDATA[
 
 // TODO: cleanup this script. It was copypasted from catalog/category/tree
@@ -194,4 +199,6 @@ Ext.onReady(function()
 
 });
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml
index f9ba133304d6d05b221c453e0dcf9e6e97eeb837..04c32963cab2bf6012bfa4819f713544e71f3921 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml
@@ -32,6 +32,12 @@
     <?php echo $this->getChildHtml('form') ?>
 </div>
 <script type="text/javascript">
+require([
+    "jquery",
+    "js/theme",
+    "mage/backend/floating-header"
+], function(jQuery){
+
 //<![CDATA[
     function categoryReset(url,useAjax){
         if(useAjax){
@@ -109,7 +115,7 @@
                     $('.messages').html(data.messages);
                 }
             });
-        })(win.jQuery);
+        })(jQuery);
     }
 
     /**
@@ -168,5 +174,13 @@
     function displayLoadingMask() {
         jQuery('body').loadingPopup();
     }
+
+    window.refreshTreeArea = refreshTreeArea;
+    window.updateContent = updateContent;
+    window.categoryDelete = categoryDelete;
+    window.categoryReset = categoryReset;
+    window.displayLoadingMask = displayLoadingMask;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml
index 75eaf90b6be1e8b3428433e1e7c422e7a8cb35ff..350f61365cc31eef5fdb99111452808feb34b5be 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml
@@ -53,17 +53,20 @@
     <div id="category_tab_content"></div>
 </form>
 <script type="text/javascript">
-    (function($) {
-        $.mage.extend('categoryForm', 'form',
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::catalog/category/form.js') ?>');
-        $('#category_edit_form')
-                .mage('categoryForm', {refreshUrl: '<?php echo $this->getRefreshPathUrl() ?>'})
-                .mage('validation', {submitHandler: function(form){
-                    form.submit();
-                    displayLoadingMask();
-                }});
-    })(jQuery);
-    <?php if(($block = $this->getLayout()->getBlock('category.product.grid')) && ($_gridJsObject=$block->getJsObjectName())): ?>
+require(['jquery', "mage/mage"], function($){
+    $.mage.extend('categoryForm', 'form', 'Magento_Catalog/catalog/category/form');
+    $('#category_edit_form')
+        .mage('categoryForm', {refreshUrl: '<?php echo $this->getRefreshPathUrl() ?>'})
+        .mage('validation', {submitHandler: function(form){
+            form.submit();
+            displayLoadingMask();
+        }});
+});
+
+<?php if(($block = $this->getLayout()->getBlock('category.product.grid')) && ($_gridJsObject=$block->getJsObjectName())): ?>
+require([
+    "mage/adminhtml/grid"
+], function(){
 
     var categoryProducts = $H(<?php echo $this->getProductsJson() ?>);
     $('in_category_products').value = Object.toJSON(categoryProducts);
@@ -120,16 +123,21 @@
         <?php echo $_gridJsObject ?>.rowClickCallback = categoryProductRowClick;
         <?php echo $_gridJsObject ?>.initRowCallback = categoryProductRowInit;
         <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerCategoryProduct;
-        <?php echo $_gridJsObject ?>.rows.each(function(row){categoryProductRowInit(<?php echo $_gridJsObject ?>, row)});
-
-        <?php endif; ?>
-    <?php if($this->isAjax() && ($block = $this->getLayout()->getBlock('tabs')) && ($_tabsJsObject=$block->getJsObjectName())): ?>
+        if(<?php echo $_gridJsObject ?>.rows) {
+            <?php echo $_gridJsObject ?>.rows.each(function(row){categoryProductRowInit(<?php echo $_gridJsObject ?>, row)});
+        }
+});
+<?php endif; ?>
+<?php if($this->isAjax() && ($block = $this->getLayout()->getBlock('tabs')) && ($_tabsJsObject=$block->getJsObjectName())): ?>
     // Temporary solution, will be replaced after refactoring of manage category functionality
-        <?php $tabsBlock = $this->getLayout()->getBlock('tabs'); ?>
-    var activeAnchor = jQuery('#<?php echo $tabsBlock->getId() ?>').tabs('activeAnchor');
-    if (activeAnchor.length) {
-        $('active_tab_id').value = activeAnchor.prop('id');
-    }
-    $('active_tab_id').tabsJsObject = jQuery('#<?php echo $tabsBlock->getId() ?>');
-        <?php endif; ?>
+    <?php $tabsBlock = $this->getLayout()->getBlock('tabs'); ?>
+    require(["jquery","mage/backend/tabs"],function($){
+        var activeAnchor = $('#<?php echo $tabsBlock->getId() ?>').tabs('activeAnchor');
+        if (activeAnchor.length) {
+            $('active_tab_id').value = activeAnchor.prop('id');
+        }
+        $('active_tab_id').tabsJsObject = $('#<?php echo $tabsBlock->getId() ?>');
+    });
+<?php endif; ?>
+
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml
index e14f3ceb862732a6ed2fddb94fec3911521c95d6..1643882c838b9f6bce332366880a7be411dae1ad 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml
@@ -45,8 +45,8 @@
     </div>
 </div>
 <script type="text/javascript">
-//<![CDATA[
 var tree;
+require(["jquery", "prototype", "mage/adminhtml/form"], function(jQuery){
 
 /**
  * Fix ext compatibility with prototype 1.6
@@ -465,6 +465,9 @@ function categoryMove(obj) {
             }
     );
 }
-//]]>
+
+    window.addNew = addNew;
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml
index 6cda982f75b141220363f68cc9d02e18336f83a7..294768c077adb293e7ee2e7ac261f6223e7a52bf 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml
@@ -27,6 +27,7 @@
 <div id="<?php echo $_divId ?>" class="tree"></div>
 
 <script type="text/javascript">
+require(['prototype'], function(){
 //<![CDATA[
 
 var tree<?php echo $this->getId() ?>;
@@ -198,4 +199,6 @@ Ext.onReady(function()
 
 });
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml
index 65634d7523bd6159a2ca990ac6bb2b9a0deea077..a5384dcb686874b690ac484f9c0a4e9332f3d2ab 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/form.phtml
@@ -36,7 +36,11 @@
     <?php echo $this->getButtonsHtml('header') ?>
 </div>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#edit_form').mage('form').mage('validation', {validationUrl: '<?php echo $this->getValidationUrl() ?>'});
+
+});
 </script>
 <?php echo $this->getFormScripts() ?>
 
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml
index 3a848dc455fb2fb33645996cf24878a5de9c0fa7..0663d491090e390d986b99850b17215e6429ca21 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml
@@ -23,6 +23,8 @@
  */
 ?>
 <script type="text/javascript">
+require(["jquery", "js/theme", "prototype"], function(jQuery){
+
 //<![CDATA[
 function toggleApplyVisibility(select) {
     if ($(select).value == 1) {
@@ -326,5 +328,19 @@ jQuery(function($) {
         .collapsable()
         .collapse('hide');
 });
+
+window.saveAttributeInNewSet = saveAttributeInNewSet;
+window.updateRequriedOptions = updateRequriedOptions;
+window.setRowVisibility = setRowVisibility;
+window.showDefaultRows = showDefaultRows;
+window.switchDefaultValueField = switchDefaultValueField;
+window.switchIsFilterable = switchIsFilterable;
+window.switchIsFilterable = switchIsFilterable;
+window.bindAttributeInputType = bindAttributeInputType;
+window.checkOptionsPanelVisibility = checkOptionsPanelVisibility;
+window.getFrontTab = getFrontTab;
+window.toggleApplyVisibility = toggleApplyVisibility;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml
index de971d56049b31a14ce60505bec5df470dab9213..1fc26d179335de992050528ebc8f72db298f8a44 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml
@@ -83,7 +83,8 @@
         </tr>
     </script>
     <script type="text/javascript">
-    //<![CDATA[
+require(['jquery', "jquery/ui"], function(jQuery){
+
     var optionDefaultInputType = 'radio';
 
     // IE removes quotes from element.innerHTML whenever it thinks they're not needed, which breaks html.
@@ -162,7 +163,7 @@
                 }
             }
         }
-    }
+    };
 
     attributeOption.bindRemoveButtons();
 
@@ -187,6 +188,12 @@
         });
     });
     <?php endif; ?>
+
+    window.attributeOption = attributeOption;
+    window.templateText = templateText;
+    window.optionDefaultInputType = optionDefaultInputType;
     //]]>
-    </script>
+    
+});
+</script>
 </fieldset>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml
index d1c917bae8368f9f87f2f36c2f1a8e0784c421c1..78fc9adc622c4c747bb5c7ee255f80d924722d06 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml
@@ -26,8 +26,15 @@
     <div class="edit-attribute-set attribute-set-col">
         <?php echo $this->getSetFormHtml() ?>
         <script type="text/javascript">
-            jQuery('#set-prop-form').mage('validation', {errorClass: 'mage-error'});
-        </script>
+require([
+    "jquery",
+    "mage/mage"
+], function(jQuery){
+
+    jQuery('#set-prop-form').mage('validation', {errorClass: 'mage-error'});
+        
+});
+</script>
     </div>
     <div class="attribute-set-col fieldset-wrapper">
         <div class="fieldset-wrapper-title">
@@ -47,6 +54,8 @@
         </div>
         <div id="tree-div2" class="attribute-set-tree"></div>
             <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
             //<![CDATA[
             var allowDragAndDrop = <?php echo ($this->getIsReadOnly() ? 'false' : 'true'); ?>;
             var canEditGroups = <?php echo ($this->getIsReadOnly() ? 'false' : 'true'); ?>;
@@ -410,6 +419,8 @@
                 TreePanels.init();
             });
             //]]>
-            </script>
+            
+});
+</script>
     </div>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml
index da6ac48b4c363e47d64ffdf5bf165b19f65a5d8e..9bf5b3b233087b6b20a1cda35947dd44f9da502f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml
@@ -24,5 +24,9 @@
 ?>
 <?php echo $this->getFormHtml() ?>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#<?php echo $this->getFormId();?>').mage('form').mage('validation');
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml
index bf277424e7828dad0f5121fcd566e7df76860c35..2dc10244d9b49e75fb6fa9fb35d96757b71aabe7 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/configure.phtml
@@ -23,7 +23,7 @@
  */
  ?>
 <div id="product_composite_configure" class="product-configure-popup" style="display:none;">
-    <iframe name="product_composite_configure_iframe" id="product_composite_configure_iframe" src="#" style="width:0; height:0; border:0px solid #fff; position:absolute; top:-1000px; left:-1000px" onload="window.productConfigure && productConfigure.onLoadIFrame()"></iframe>
+    <iframe name="product_composite_configure_iframe" id="product_composite_configure_iframe" style="width:0; height:0; border:0px solid #fff; position:absolute; top:-1000px; left:-1000px" onload="window.productConfigure && productConfigure.onLoadIFrame()"></iframe>
     <form action="" method="post" id="product_composite_configure_form" enctype="multipart/form-data" onsubmit="productConfigure.onConfirmBtn(); return false;" target="product_composite_configure_iframe">
         <div class="entry-edit">
             <div id="product_composite_configure_messages" style="display: none;" >
@@ -39,6 +39,13 @@
     <div id="product_composite_configure_confirmed" style="display:none;"></div>
 
     <script type="text/javascript">
-        jQuery('#product_composite_configure_form').mage('form').mage('validation');
+        require([
+            "jquery",
+            "mage/mage"
+        ], function(jQuery){
+
+            jQuery('#product_composite_configure_form').mage('form').mage('validation');
+            
+        });
     </script>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/js.phtml
index 3ae4dafc746ada10e2aa1c5e39328e92595e34f5..7298a124817196f7c8bbd0f0759e92f21fe8af78 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/js.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/js.phtml
@@ -24,8 +24,12 @@
 ?>
 
 <script type="text/javascript">
-//<![CDATA[
-validateOptionsCallback = function (elmId, result){
+require([
+    "prototype",
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+
+window.validateOptionsCallback = function (elmId, result){
     var container = $(elmId).up('ul.options-list');
     if (!container) {
         return;
@@ -37,7 +41,7 @@ validateOptionsCallback = function (elmId, result){
         container.removeClassName('validation-failed');
         container.addClassName('validation-passed');
     }
-}
+};
 
 productConfigure.opConfig = {};
 
@@ -99,6 +103,8 @@ var DateOption = Class.create({
         }
     }
 });
+
 productConfigure.opConfig.dateOption = new DateOption();
-//]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml
index ce8c73d003cd0a5a84d738438aa75c8b3eeec357..d4eb50f8a7eca4f2de0710b8b5d66cbc5de9f3f2 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml
@@ -39,12 +39,16 @@
 
       <?php if (!$this->useCalendar()): ?>
       <script type="text/javascript">
-      //<![CDATA[
-          var dateOption = productConfigure.opConfig.dateOption;
-          Event.observe('options_<?php echo $_optionId ?>_month', 'change', dateOption.reloadMonth.bind(dateOption));
-          Event.observe('options_<?php echo $_optionId ?>_year', 'change', dateOption.reloadMonth.bind(dateOption));
-      //]]>
-      </script>
+require([
+  "prototype",
+  "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+
+      window.dateOption = productConfigure.opConfig.dateOption;
+      Event.observe('options_<?php echo $_optionId ?>_month', 'change', dateOption.reloadMonth.bind(dateOption));
+      Event.observe('options_<?php echo $_optionId ?>_year', 'change', dateOption.reloadMonth.bind(dateOption));      
+});
+</script>
       <?php endif; ?>
 
   <?php endif; ?>
@@ -56,6 +60,11 @@
 
     <input type="hidden" name="validate_datetime_<?php echo $_optionId ?>" class="validate-datetime-<?php echo $_optionId ?>" value="" />
     <script type="text/javascript">
+require([
+  "jquery",
+  "mage/validation"
+], function(jQuery){
+
     //<![CDATA[
 <?php if ($_option->getIsRequire()): ?>
         jQuery.validator.addMethod('validate-datetime-<?php echo $_optionId ?>', function(v) {
@@ -83,6 +92,8 @@
         }, '<?php echo $this->escapeJsQuote( __('Field is not complete') )?>');
 <?php endif; ?>
     //]]>
-    </script>
+    
+});
+</script>
   </div>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
index a2f0c44a1a882fca55b1e22eeb0a99efadec45b4..ce3d902f025b0a60a80570802b6e44bf3289af54 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
@@ -32,6 +32,8 @@
 <?php $_rand = rand(); ?>
 
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
     opFile<?php echo $_rand; ?> = {
         initializeFile: function(inputBox) {
@@ -70,6 +72,8 @@
         }
     };
 //]]>
+
+});
 </script>
 
 <div class="field<?php if ($_option->getIsRequire()) echo ' required' ?>">
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml
index 8460dbbe28b17ac856e966ca8488f213ec5f56a1..9f518c210621028241ff5c6cb0b62e18307c70af 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml
@@ -73,7 +73,13 @@
 </form>
 <?php endif; ?>
 <script type="text/javascript">
-jQuery(function($) {
+require([
+    "jquery",
+    "mage/mage",
+    "Magento_Catalog/catalog/type-switcher",
+    "mage/backend/tabs",
+    "_"
+], function($){
     var $form = $('[data-form=edit-product]');
     $form.data('typeSwitcher', new TypeSwitcher(<?php echo $this->getTypeSwitcherData();?>).bindAll());
 
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml
index 02c8a41856f0685a7d3bd95b4a0bda801f8f0a4f..613071e624460ed174d12b22298a2ef3968e4506 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/attribute.phtml
@@ -31,6 +31,10 @@
     <?php echo $this->getBlockHtml('formkey')?>
 </form>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#attributes-edit-form').mage('form')
         .mage('validation', {validationUrl: '<?php echo $this->getValidationUrl() ?>'});
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
index 6de7bd1e8b4d8999bd76a571528737facd54c229..4a9d9e33cdcf0abcf2272888db9bec8605c3bd24 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
@@ -23,7 +23,6 @@
  */
 ?>
 <script type="text/javascript">
-    //<![CDATA[
     function toggleValueElementsWithCheckbox(checkbox) {
         var td = $(checkbox).up('.field');
         var checkboxes = td.getElementsBySelector('input[type="checkbox"]');
@@ -39,7 +38,6 @@
             });
         }
     }
-    //]]>
 </script>
 
 <div class="fieldset-wrapper form-inline">
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml
index d5af048dde83ab2a8a09df5821e33c4241455992..38f0a80033ece2fa18d754eb2ce4ab2a8ec3d2e4 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/websites.phtml
@@ -93,7 +93,6 @@
 </div>
 
 <script type="text/javascript">
-    //<![CDATA[
     var productWebsiteCheckboxes = $$('.website-checkbox');
 
     for(var i=0;i<productWebsiteCheckboxes.length;i++){
@@ -116,5 +115,4 @@
             }
         }
     }
-    //]]>
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml
index 4323c426036069701a11d932142964c2291639ec..fb88753fff6db4cafe5fa2c19d380b053a7facdb 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml
@@ -38,8 +38,8 @@
 </button>
 {{/if}}
 </script>
-<script>
-    jQuery(function ($) {
+<script type="text/javascript">
+    require(["jquery","mage/mage","mage/backend/suggest"],function ($) {
         var $suggest = $('#product-template-suggest');
         $suggest.closest('.dropdown-menu').siblings('[data-toggle=dropdown]').on('click.toggleDropdown', function () {
             if ($(this).hasClass('active')) {
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml
index 8a34ed1026a06ba58df3aec6ee5cf6a669f98861..4b3ae570ece39850913994e70d63c0a59cb489dd 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml
@@ -52,7 +52,7 @@
 </div>
 
 <script type="text/javascript">
-jQuery(function ($) {
+require(['jquery'], function($){
     var priceType = $('#price_type');
     var priceWarning = $('#dynamic-price-warning');
     if (priceType && priceType.val() == 0 && priceWarning) {
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml
index d209a5a40fdae3e575c8b342abf6ae90fac54b93..96c4185e5a750b117e720398ea7fc90240b78b8f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml
@@ -92,6 +92,11 @@
 <div><input type="hidden" name="affect_product_custom_options" value="1"/></div>
 <?php endif; ?>
 <script type="text/javascript">
+require([
+    "jquery",
+    "Magento_Catalog/js/custom-options"
+], function(jQuery){
+
 jQuery(function ($) {
     var fieldSet = $('#Custom_Options');
     fieldSet.customOptions(<?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode(
@@ -110,4 +115,6 @@ jQuery(function ($) {
         fieldSet.customOptions('addOption', <?php echo $_value->toJson() ?>);
     <?php endforeach; ?>
 });
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml
index 79dd746f0a0caa7d69b308668e8d7acf60a488b5..46935579446e3c4ded48c5de9eb14e96ae1a7cc2 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml
@@ -59,6 +59,8 @@ $_showWebsite= $this->isMultiWebsites();
         </table>
 
 <script type="text/javascript">
+require(["prototype"], function(){
+
 //<![CDATA[
 var groupPriceRowTemplate = '<tr>'
     + '<td<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>'
@@ -162,6 +164,10 @@ $('<?php echo $_htmlId; ?>_container').up('table').select('button')
     .each(groupPriceControl.disableElement);
 <?php endif; ?>
 //]]>
+
+window.groupPriceRowTemplate = groupPriceRowTemplate;
+window.groupPriceControl = groupPriceControl;
+});
 </script>
     </div>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml
index 1a208a5e51d298f5434e731ed6cacfba399bf689..b1976570fd598b217e9864cd64b2934cdab5ba7b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml
@@ -62,6 +62,8 @@ $element = $this->getElement();
         </table>
 
 <script type="text/javascript">
+require(["prototype"], function(){
+
 //<![CDATA[
 var tierPriceRowTemplate = '<tr>'
     + '<td class="col-websites"<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>'
@@ -162,7 +164,12 @@ tierPriceControl.addItem('<?php echo $_item['website_id'] ?>', '<?php echo $_ite
 $('<?php echo $_htmlId ?>_container').up('table').select('button')
     .each(tierPriceControl.disableElement);
 <?php endif; ?>
+
+window.tierPriceRowTemplate = tierPriceRowTemplate;
+window.tierPriceControl = tierPriceControl;
 //]]>
+
+});
 </script>
     </div>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml
index 9061877ac017b60a8e8cffe26f67f6097f4440cc..c48fcdd1ab975811d248c68755e9fb18c5582c5c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/websites.phtml
@@ -64,6 +64,8 @@
 </fieldset>
 
 <script type="text/javascript">
+require(["prototype"], function(){
+
     //<![CDATA[
     var productWebsiteCheckboxes = $$('.website-checkbox');
 
@@ -87,5 +89,8 @@
             }
         }
     }
+    window.toggleStoreFromChoosers = toggleStoreFromChoosers;
     //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml
index 5f3d3069e5fbc71d4ade022f407dea3a40d01232..451df8326762f26fe54d8ab49f9770fc4b423251 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/js.phtml
@@ -25,6 +25,12 @@
 /** @var \Magento\Catalog\Block\Adminhtml\Product\Edit\Js $this */
 ?>
 <script type="text/javascript">
+require([
+    "jquery",
+    "prototype",
+    "mage/backend/tabs"
+], function(jQuery){
+
 //<![CDATA[
 Event.observe(window, 'load', recalculateTax);
 Event.observe(window, 'load', registerTaxRecalcs);
@@ -86,7 +92,7 @@ jQuery(document).on('tabsactivate', bindActiveProductTab);
 
 // bind active tab
 <?php if($tabsBlock = $this->getLayout()->getBlock('product_tabs')): ?>
-jQuery(document).ready(function () {
+jQuery(function () {
     if (jQuery('#<?php echo $tabsBlock->getId() ?>').length && jQuery('#<?php echo $tabsBlock->getId() ?>').is(':mage-tabs')) {
         var activeAnchor = jQuery('#<?php echo $tabsBlock->getId() ?>').tabs('activeAnchor');
         if (activeAnchor && $('store_switcher')) {
@@ -95,5 +101,11 @@ jQuery(document).ready(function () {
     }
 });
 <?php endif; ?>
+
+window.recalculateTax = recalculateTax;
+window.bindActiveProductTab = bindActiveProductTab;
+window.registerTaxRecalcs = registerTaxRecalcs;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml
index 3144968c7b2c63274afe4165f327e5e78726ccdf..93d2133913ee0a3e87f8854eca162fa0fad5a46c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/tab/inventory.phtml
@@ -46,7 +46,11 @@
         <input type="checkbox" id="inventory_use_config_manage_stock" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_manage_stock]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?php echo $_readonly;?>>
         <label for="inventory_use_config_manage_stock"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_config_manage_stock').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_manage_stock'), $('inventory_use_config_manage_stock').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -80,7 +84,11 @@
         <input type="checkbox" id="inventory_use_config_min_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_min_qty]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?php echo $_readonly;?>>
         <label for="inventory_use_config_min_qty"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_min_qty').parentNode);</script>
+        <script type="text/javascript">
+require(["prototype"], function(){
+toggleValueElements($('inventory_use_config_min_qty'), $('inventory_use_config_min_qty').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -100,7 +108,11 @@
         <input type="checkbox" id="inventory_use_config_min_sale_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_min_sale_qty]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?php echo $_readonly;?>>
         <label for="inventory_use_config_min_sale_qty"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_config_min_sale_qty').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_min_sale_qty'), $('inventory_use_config_min_sale_qty').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -118,7 +130,11 @@
         <input type="checkbox" id="inventory_use_config_max_sale_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_max_sale_qty]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" class="checkbox" <?php echo $_readonly;?>>
         <label for="inventory_use_config_max_sale_qty"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_config_max_sale_qty').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_max_sale_qty'), $('inventory_use_config_max_sale_qty').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -175,7 +191,11 @@
         <input type="checkbox" id="inventory_use_config_backorders" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_backorders]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?php echo $_readonly;?>>
         <label for="inventory_use_config_backorders"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_config_backorders').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_backorders'), $('inventory_use_config_backorders').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -193,7 +213,11 @@
         <input type="checkbox" id="inventory_use_config_notify_stock_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_notify_stock_qty]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?php echo $_readonly;?>>
         <label for="inventory_use_config_notify_stock_qty"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use_config_notify_stock_qty').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_notify_stock_qty'), $('inventory_use_config_notify_stock_qty').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -217,7 +241,11 @@
         <input type="checkbox" id="inventory_use_config_enable_qty_increments" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_enable_qty_increments]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?php echo $_readonly;?>>
         <label for="inventory_use_config_enable_qty_increments"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventory_use_config_enable_qty_increments').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_enable_qty_increments'), $('inventory_use_config_enable_qty_increments').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -235,7 +263,11 @@
         <input type="checkbox" id="inventory_use_config_qty_increments" name="<?php echo $this->getFieldSuffix() ?>[stock_data][use_config_qty_increments]" value="1" <?php echo $_checked ?> onclick="toggleValueElements(this, this.parentNode);" <?php echo $_readonly;?>>
         <label for="inventory_use_config_qty_increments"><?php echo __('Use Config Settings') ?></label>
         <?php if (!$this->isReadonly()): ?>
-        <script type="text/javascript">toggleValueElements($('inventory_use_config_qty_increments'), $('inventory_use_config_qty_increments').parentNode);</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+toggleValueElements($('inventory_use_config_qty_increments'), $('inventory_use_config_qty_increments').parentNode);
+});
+</script>
         <?php endif; ?>
     </div>
     <?php if (!$this->isSingleStoreMode()): ?>
@@ -263,6 +295,8 @@
 </fieldset>
 
 <script type="text/javascript">
+require(["jquery","prototype"], function(jQuery){
+
     //<![CDATA[
     function changeManageStockOption()
     {
@@ -337,5 +371,11 @@
             applyEnableDecimalDivided();
         }
     });
+
+    window.applyEnableDecimalDivided = applyEnableDecimalDivided;
+    window.applyEnableQtyIncrements = applyEnableQtyIncrements;
+    window.changeManageStockOption = changeManageStockOption;
     //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml
index 304e095189a99a26d5b98fbd62b9279768a7ab38..6e57686073116c624a35d5d910197c1e120ea3d6 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml
@@ -23,6 +23,12 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    "jquery",
+    "prototype",
+    "mage/adminhtml/events"
+], function(jQuery){
+
 //<![CDATA[
 
 Window.keepMultiModalWindow = true;
@@ -118,5 +124,8 @@ var catalogWysiwygEditor = {
     }
 };
 
+window.catalogWysiwygEditor = catalogWysiwygEditor;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml
index 1a100d80e7e18d5caabbc93280b9df0d4b65425f..f2eee7e1660d3dd2743dea1b0c22ba15d471655f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml
@@ -48,13 +48,13 @@
     <div class="actions"><?php echo $this->getAttributeCreate()?></div>
 </script>
 
-<script>
-    jQuery(function($) {
+<script type="text/javascript">
+    require(["jquery","mage/mage","mage/backend/suggest"], function($) {
         var $suggest = $('[data-role="product-attribute-search"][data-group="<?php echo $this->escapeHtml($this->getGroupCode()); ?>"]');
 
         $suggest.on('suggestclose', function(e) {
             $suggest.closest('.dropdown-menu').siblings('[data-toggle=dropdown]').trigger('close.dropdown');
-        })
+        });
         $suggest.closest('.dropdown-menu').siblings('[data-toggle=dropdown]').on('click.toggleDropdown', function () {
             if ($(this).hasClass('active')) {
                 $suggest.click();
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml
index c91ed80f2aa9766f103915a89fb041b6047c2d8f..0aeb9d3ea503fc6c6d5df49931b9516bdd086a1c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/grid/massaction_extended.phtml
@@ -83,32 +83,32 @@
     </div>
 </div>
 <script type="text/javascript">
-    (function($) {
+    require(['jquery'], function($){
         'use strict';
         $('#massaction-select').change(function () {
             var massAction = $('option:selected', this).val();
             switch (massAction) {
                 <?php if ($this->getUseSelectAll()):?>
                 case 'selectAll':
-                    return <?php echo $this->getJsObjectName() ?>.selectAll()
+                    return <?php echo $this->getJsObjectName() ?>.selectAll();
                     break
                 case 'unselectAll':
-                    return <?php echo $this->getJsObjectName() ?>.unselectAll()
+                    return <?php echo $this->getJsObjectName() ?>.unselectAll();
                     break
                 <?php endif; ?>
                 case 'selectVisible':
-                    return <?php echo $this->getJsObjectName() ?>.selectVisible()
+                    return <?php echo $this->getJsObjectName() ?>.selectVisible();
                     break
                 case 'unselectVisible':
-                    return <?php echo $this->getJsObjectName() ?>.unselectVisible()
+                    return <?php echo $this->getJsObjectName() ?>.unselectVisible();
                     break
             }
         });
-    })(window.jQuery);
+
+    });
+
+    <?php if (!$this->getParentBlock()->canDisplayContainer()): ?>
+        <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
+    <?php endif; ?>
 </script>
-<?php if (!$this->getParentBlock()->canDisplayContainer()): ?>
-<script type="text/javascript">
-    <?php echo $this->getJsObjectName() ?>.setGridIds('<?php echo $this->getGridIdsJson() ?>');
-</script>
-<?php endif; ?>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js
index fd8e591ec505b43802a116ddfa665a631a31f7b5..1e2e497a87d4a8127d7a3760f30f54ab31001f4b 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js
@@ -21,7 +21,15 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*global alert:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "jquery/file-uploader",
+    "Magento_Catalog/js/product-gallery",
+    "mage/translate"
+], function($){
+
     $.widget('mage.baseImage', {
         /**
          * Button creation
@@ -144,4 +152,4 @@
             });
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js
index 044b8e49aabcd29b3efa079ea0fbe4cbbe0af05c..bb18a3762621fe86bdd0e403ecd4deaac17bb71a 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js
@@ -23,7 +23,12 @@
 /**
  * Create/edit some category
  */
-function categorySubmit(url, useAjax) {
+define([
+    "jquery",
+    "prototype"
+], function(jQuery){
+
+var categorySubmit = function (url, useAjax) {
     var activeTab = $('active_tab_id');
     if (activeTab) {
         if (activeTab.tabsJsObject && activeTab.tabsJsObject.tabs('activeAnchor')) {
@@ -80,4 +85,8 @@ function categorySubmit(url, useAjax) {
 
     // Submit form
     jQuery('#category_edit_form').trigger('submit');
-}
+};
+
+window.categorySubmit = categorySubmit;
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js
index 58a0c7270d7ab1220e03363d7c5103d68710bbc7..6c6871535e7589773a78b5d7504ea396c0842a50 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js
@@ -22,8 +22,14 @@
  */
 /*jshint jquery:true browser:true*/
 /*global Ajax:true alert:true*/
-(function($){
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/backend/form",
+    "prototype"
+], function($){
     "use strict";
+
     $.widget("mage.categoryForm", $.mage.form, {
         options: {
             categoryIdSelector : 'input[name="general[id]"]',
@@ -77,4 +83,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
index 08aa7cb76592cbc3ad376194f0825f532b72fa7e..2ff7ac0fd82e34381874b0f88f411e7da0d98d26 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js
@@ -20,8 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "jquery/ui",
+    "prototype"
+], function(jQuery){
 
-var Product = {};
+window.Product = {};
 
 (function ($) {
     $.widget("mage.productAttributes", {
@@ -77,7 +82,7 @@ var Product = {};
     });
 })(jQuery);
 
-var onInitDisableFieldsList = [];
+window.onInitDisableFieldsList = [];
 
 function toogleFieldEditMode(toogleIdentifier, fieldContainer) {
     if ($(toogleIdentifier).checked) {
@@ -136,4 +141,14 @@ function onCustomUseParentChanged(element) {
     });
 }
 
+window.onCustomUseParentChanged = onCustomUseParentChanged;
+window.onUrlkeyChanged = onUrlkeyChanged;
+window.onCompleteDisableInited = onCompleteDisableInited;
+window.initDisableFields = initDisableFields;
+window.enableFieldEditMode = enableFieldEditMode;
+window.disableFieldEditMode = disableFieldEditMode;
+window.toogleFieldEditMode = toogleFieldEditMode;
+
 Event.observe(window, 'load', onCompleteDisableInited);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js
index 3db3b1bbb1f132f5cb3facc1dbdb6474973712e3..2e49ab060d7b71bc1b149567e278733051829830 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js
@@ -20,8 +20,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "prototype"
+], function(jQuery){
+
+window.ProductConfigure = Class.create();
 
-ProductConfigure = Class.create();
 ProductConfigure.prototype = {
 
     listTypes:                  $H({}),
@@ -785,3 +792,5 @@ ProductConfigure.prototype = {
 jQuery(document).ready(function(){
     productConfigure = new ProductConfigure();
 });
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-switcher.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-switcher.js
index d8d99291efbc491e604bf461ffc31a6986d4c7e8..a6eb63bba4d7bb43def0055adc55f99b8513b3a7 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-switcher.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-switcher.js
@@ -20,7 +20,10 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function ($) {
+define([
+    "jquery"
+], function($){
+
     /**
      * Type Switcher
      *
@@ -150,4 +153,5 @@
     });
     // export to global scope
     window.TypeSwitcher = TypeSwitcher;
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/lib/web/js/mui.js b/app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap.js
similarity index 97%
rename from lib/web/js/mui.js
rename to app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap.js
index 52ab5c5c1e3082e0dfe5d1f510e976e8014a1e97..1f68a592017c658e63871d34e30c2ad5b91632c9 100644
--- a/lib/web/js/mui.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap.js
@@ -21,6 +21,3 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-(function() {
-
-})(jQuery);
diff --git a/downloader/skin/ie7boxes.css b/app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap/category-edit.js
similarity index 85%
rename from downloader/skin/ie7boxes.css
rename to app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap/category-edit.js
index f57010080814f06b747b8c8544a6d2987eec8024..2488e912ca3ddf3be7236954d467bbe293a1a76c 100644
--- a/downloader/skin/ie7boxes.css
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap/category-edit.js
@@ -1,4 +1,5 @@
 /**
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -20,6 +21,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-.main { height:auto !important; }
-button, .form-button { filter:chroma(color=#000000); }
-.connect-packages td .select { margin:0 0 2px; width:100%; }
+require([
+    "jquery/file-uploader",
+    "Magento_Catalog/catalog/category/edit"
+]);
\ No newline at end of file
diff --git a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/release.phtml b/app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap/product-new.js
similarity index 91%
rename from app/code/Magento/Connect/view/adminhtml/templates/extension/custom/release.phtml
rename to app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap/product-new.js
index 15dbfdeb687d9106b62d58f82548db9fef1a51b8..3311883921d979e5b1b1d2190dab3f901e0502c5 100644
--- a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/release.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/bootstrap/product-new.js
@@ -1,5 +1,5 @@
-<?php
 /**
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -21,7 +21,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-?>
-<div class="entry-edit">
-    <?php echo $this->getFormHtml() ?>
-</div>
+require([
+    "jquery/jstree/jquery.jstree",
+    "jquery/file-uploader"
+]);
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js b/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js
index f8e709cd6804eca7c3844a7148b971ec698d541f..fdb77d273dee8f8a5b9d384f1ef87884295f347d 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/jstree/jquery.jstree"
+], function($){
     "use strict";
 
     $.widget("mage.categoryTree", {
@@ -106,4 +110,5 @@
             return result;
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
index 16521f2766e6421c5b6255a4cd1e597c69af5533..49b8dd32c1eb7773b79443ed60cbb2622665a10f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
@@ -22,7 +22,15 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "js/theme",
+    "mage/translate",
+    "mage/backend/validation"
+], function($){
+
     $.widget('mage.customOptions', {
         options: {
             selectionItemCount: {}
@@ -372,4 +380,5 @@
             return $('#' + this.options.fieldId + '_' + id).length ? this.getFreeOptionId(parseInt(id, 10) + 1) : id;
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js b/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js
index ac59cc7324beda290ee4cb2720c11860f743c640..9104adc6bddd2c675c08af2be7abe975a5c80429 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js
@@ -22,7 +22,14 @@
  */
 /*jshint browser:true jquery:true*/
 /*global FORM_KEY*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "mage/translate",
+    "mage/backend/tree-suggest",
+    "mage/backend/validation"
+], function($){
     'use strict';
     var clearParentCategory = function () {
         $('#new_category_parent').find('option').each(function(){
@@ -38,7 +45,7 @@
                 placeholder: $.mage.__('start typing to search category')
             }));
 
-            $('#new_category_parent-suggest').mage('treeSuggest', this.options.suggestOptions)
+            $('#new_category_parent-suggest').treeSuggest(this.options.suggestOptions)
                 .on('suggestbeforeselect', function (event) {
                     clearParentCategory();
                     $(event.target).treeSuggest('close');
@@ -143,4 +150,4 @@
             });
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js b/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
index a75a2ca2fcb1752b67643084f0491c4e5f1eaa82..e78a15ba72d8d956259b01b159c9c614ead85c3c 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+
     "use strict";
     /**
      * Product gallery widget
@@ -382,4 +387,5 @@
             });
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml
index 7eed18fc0ec1f22b4f275a8f914cd1bc7f00459b..3ca04fd21bd9532c1794820ca4a7d4939e606142 100644
--- a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml
+++ b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml
@@ -99,12 +99,14 @@ $product = $this->getSaleableItem();
     </ul>
     <?php if ($msrpShowOnGesture):?>
         <script type="text/javascript">
-            (function($) {
-                $('.product-info-main').mage('tierPrice', {
-                    inputQty: '#qty',
-                    productForm: '#product_addtocart_form'
-                });
-            })(jQuery);
-        </script>
+        require(["jquery", "mage/mage"], function($){
+
+            $('.product-info-main').mage('tierPrice', {
+                inputQty: '#qty',
+                productForm: '#product_addtocart_form'
+            });
+                
+        });
+</script>
     <?php endif;?>
 <?php endif; ?>
diff --git a/app/code/Magento/Catalog/view/base/web/js/msrp.js b/app/code/Magento/Catalog/view/base/web/js/msrp.js
index 0173229a1557a3cba407f69d3ce7edf523d17b6d..e3604112a3a013bad96ec097cac05a9e8921b5ec 100644
--- a/app/code/Magento/Catalog/view/base/web/js/msrp.js
+++ b/app/code/Magento/Catalog/view/base/web/js/msrp.js
@@ -20,9 +20,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint browser:true jquery:true*/
-(function($) {
+define(["jquery","jquery/ui","mage/dropdown"], function($){
+
     $.widget('mage.addToCart', {
         options: {
             showAddToCart: true,
@@ -91,5 +91,4 @@
             $(this.options.cartForm).submit();
         }
     });
-})(jQuery);
-
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/base/web/js/tier-price.js b/app/code/Magento/Catalog/view/base/web/js/tier-price.js
index 109889f7f4aaba67807152f8f97d6e9479aa6ab1..e63fd772c3ce8762c6985fb2e28f273500be8578 100644
--- a/app/code/Magento/Catalog/view/base/web/js/tier-price.js
+++ b/app/code/Magento/Catalog/view/base/web/js/tier-price.js
@@ -20,9 +20,8 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint browser:true jquery:true*/
-(function($) {
+define(["jquery","jquery/ui"], function($){
     $.widget('mage.tierPrice', {
         options: {
             popupHeading: '#map-popup-heading',
@@ -69,5 +68,4 @@
             return false;
         }
     });
-})(jQuery);
-
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
index f089a3adc09dbfd8481744c15e9a64f73822a573..e107801766dc16e7e162afc57faf0492bbaa517f 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
@@ -45,11 +45,6 @@
                 <argument name="file" xsi:type="string">mage/gallery.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-terms">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/terms.js</argument>
-            </arguments>
-        </block>
     </referenceBlock>
     <update handle="page_calendar"/>
     <referenceContainer name="content">
diff --git a/app/code/Magento/Catalog/view/frontend/layout/default.xml b/app/code/Magento/Catalog/view/frontend/layout/default.xml
index 939fe64c122af774a89da5cdaa55f1eb2095e5ac..55e002b5b0b9d5731a20d518f433136586d1d668 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/default.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/default.xml
@@ -31,11 +31,6 @@
         <block class="Magento\Catalog\Block\Product\Compare\Sidebar" name="catalog.compare.sidebar" template="product/compare/sidebar.phtml"/>
     </referenceContainer>
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-toolbar-form-js" after="magento-dataPost-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::js/product/list/toolbar.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Catalog::js/components.phtml"/>
     </referenceBlock>
 </layout>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/js/components.phtml b/app/code/Magento/Catalog/view/frontend/templates/js/components.phtml
index f8b30f10b8043461bf7ec1e27102a2f473581af2..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/js/components.phtml
@@ -22,84 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            addToWishlist: [
-                '<?php echo $this->getViewFileUrl('Magento_Wishlist::js/add-to-wishlist.js') ?>'
-            ],
-            tabs: [
-                '<?php echo $this->getViewFileUrl('mage/collapsible.js') ?>',
-                '<?php echo $this->getViewFileUrl('mage/tabs.js') ?>'
-            ],
-            catalogSearch: [
-                '<?php echo $this->getViewFileUrl('jquery/handlebars/handlebars-v1.3.0.js')?>',
-                '<?php echo $this->getViewFileUrl('Magento_CatalogSearch::form-mini.js')?>'
-            ],
-            compareItems: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/compare.js')?>'
-            ],
-            compareList: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/list.js')?>'
-            ],
-            fileOption: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/file-option.js')?>'
-            ],
-            relatedProducts: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/related-products.js')?>'
-            ],
-            upsellProducts: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/upsell-products.js')?>'
-            ],
-            discountCode: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/discount-codes.js')?>'
-            ],
-            catalogGallery: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/gallery.js')?>'
-            ],
-            wishlist: [
-                '<?php echo $this->getViewFileUrl('Magento_Wishlist::wishlist.js')?>'
-            ],
-            orderOverview: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/overview.js') ?>'
-            ],
-            rowBuilder: [
-                '<?php echo $this->getViewFileUrl('Magento_Theme::js/row-builder.js') ?>'
-            ],
-            address: [
-                '<?php echo $this->getViewFileUrl('Magento_Customer::address.js') ?>'
-            ],
-            priceOption: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/price-option.js') ?>'
-            ],
-            requireCookie: [
-                '<?php echo $this->getViewFileUrl('Magento_Core::js/require-cookie.js') ?>'
-            ],
-            addToCart: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/msrp.js') ?>'
-            ],
-            tierPrice: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/tier-price.js') ?>'
-            ],
-            dateOption: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/date-option.js') ?>'
-            ],
-            zoom: [
-                '<?php echo $this->getViewFileUrl('jquery/handlebars/handlebars-v1.3.0.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/zoom.js') ?>'
-            ],
-            gallery: [
-                '<?php echo $this->getViewFileUrl('mage/gallery.js') ?>'
-            ],
-            galleryFullScreen: [
-                '<?php echo $this->getViewFileUrl('mage/gallery.js') ?>',
-                '<?php echo $this->getViewFileUrl('mage/gallery-fullscreen.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml
index 44ed72e128234c4c87e99a3506d5aabe80af7ca6..e281ff390b29e80c8db55ccce9db4e1decb1ce8e 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml
@@ -43,5 +43,12 @@ $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
        class="action tocompare"><span><?php echo __('Add to Compare') ?></span></a>
 </div>
 <script type="text/javascript">
+  require([
+    "jquery",
+    "mage/mage"
+  ], function(jQuery){
+
     jQuery('body').mage('addToWishlist', <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode(array('productType' => $_product->getTypeId()))?>);
+
+  });
 </script>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml
index 54205c6c25e12ed6c74519dd197f0327caeb2e6b..07c7ba753bb98b3d3693376a6eb8667b04f62f23 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml
@@ -61,9 +61,12 @@
 <?php endif; ?>
 
 <script type="text/javascript">
-    (function ($) {
-        $('#product_addtocart_form').mage('validation', {
-            radioCheckboxClosest: '.nested'
-        });
-    })(jQuery);
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+    $('#product_addtocart_form').mage('validation', {
+        radioCheckboxClosest: '.nested'
+    });
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml
index e40b23d3993294d72411905b360a4e081924ef1f..ebd55ac964bacac0108e763082edb676ea5e788a 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml
@@ -144,7 +144,8 @@ $thumbHeight =  $this->getVar("product_page_more_views:height") ? : $thumbWidth;
         <p class="notice" data-role="notice">${text}</p>
     </script>
     <script type="text/javascript">
-        (function($) {
+        require(["jquery", "mage/mage"], function($){
+
             $('[data-role=media-gallery]')
                 .mage('gallery', {
                     sizes: {
@@ -175,6 +176,7 @@ $thumbHeight =  $this->getVar("product_page_more_views:height") ? : $thumbWidth;
                     }
                 })
                 .mage('galleryFullScreen', {});
-        })(jQuery);
-    </script>
+            
+        });
+</script>
 <?php endif; ?>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml
index 184773a2fc6140737c18912a1a2b9ded67a54253..dcbfdfcaffd3b71e69b3ec7935a81ee5e3b99398 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml
@@ -32,11 +32,14 @@
 <?php $_product = $this->getProduct(); ?>
 
 <script type="text/javascript">
-    (function ($) {
-        $(document).ready(function() {
-            $('#product_addtocart_form').mage('priceOption', {"priceConfig":<?php echo $this->getJsonConfig() ?>});
-        });
-    })(jQuery);
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+    $(document).ready(function() {
+        $('#product_addtocart_form').mage('priceOption', {"priceConfig":<?php echo $this->getJsonConfig() ?>});
+    });
+});
 </script>
 <div class="product-add-form">
     <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post"
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml
index f5a517cb1509e75a702d8be7b0c54b0b24de67a4..9c4738d1dde284c26da969e5acb7dd638dbe3c1c 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options.phtml
@@ -27,13 +27,18 @@
 <?php $_options = $this->decorateArray($this->getOptions()) ?>
 <?php if (count($_options)):?>
     <script type="text/javascript">
-        (function ($) {
-            $('#product_addtocart_form').mage('priceOption', {
-                'optionConfig':<?php echo $this->getJsonConfig()?>,
-                'controlContainer': '.field'
-            }).trigger('reloadPrice');
-        })(jQuery);
-    </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    $('#product_addtocart_form').mage('priceOption', {
+        'optionConfig':<?php echo $this->getJsonConfig()?>,
+        'controlContainer': '.field'
+    }).trigger('reloadPrice');
+    
+});
+</script>
     <?php foreach($_options as $_option): ?>
         <?php echo $this->getOptionHtml($_option) ?>
     <?php endforeach; ?>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/js.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/js.phtml
index 8a86d459ae4f1357930f0dbf45770622b9a2e4ea..08a273c10c343d3ea1c40589b59941b905924479 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/js.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/js.phtml
@@ -23,7 +23,10 @@
  */
 ?>
 <script type="text/javascript">
-    //<![CDATA[
+require([
+    "prototype"
+], function(){
+
     var DateOption = Class.create({
 
         getDaysInMonth: function(month, year)
@@ -82,6 +85,8 @@
             }
         }
     });
-    dateOption = new DateOption();
-    //]]>
+
+    window.dateOption = new DateOption();
+
+});
 </script>
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml
index b3093957e2f8b0fdc04460d8aecaa72df359494d..9b204db96b692a2469a97dd55d6874008907c187 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/date.phtml
@@ -38,16 +38,21 @@
 
             <?php if (!$this->useCalendar()): ?>
                 <script type="text/javascript">
-                    //<![CDATA[
-                    (function($) {
-                        $('#product_addtocart_form').mage('dateOption', {
-                            'datepickerFieldSelector': 'select.datetime-picker',
-                            'monthSelector': '#options_<?php echo $_optionId ?>_month',
-                            'yearSelector': '#options_<?php echo $_optionId ?>_year'
-                        });
-                    })(jQuery);
-                    //]]>
-                </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    //<![CDATA[
+        $('#product_addtocart_form').mage('dateOption', {
+            'datepickerFieldSelector': 'select.datetime-picker',
+            'monthSelector': '#options_<?php echo $_optionId ?>_month',
+            'yearSelector': '#options_<?php echo $_optionId ?>_year'
+        });
+    //]]>
+                
+});
+</script>
             <?php endif; ?>
 
         <?php endif; ?>
@@ -71,14 +76,16 @@
                    data-validate="{'validate-optional-datetime':<?php echo $_optionId?>}"/>
         <?php endif; ?>
         <script type="text/javascript">
-            //<![CDATA[
-            (function($) {
-                var addtocartForm = $('#product_addtocart_form');
-                addtocartForm.mage('validation', {
-                    ignore: ':hidden:not(input[name^="validate_datetime_"])'
-                });
-            })(jQuery);
-            //]]>
-        </script>
+require(['jquery', "mage/mage"], function($){
+
+    //<![CDATA[
+        var addtocartForm = $('#product_addtocart_form');
+        addtocartForm.mage('validation', {
+            ignore: ':hidden:not(input[name^="validate_datetime_"])'
+        });
+    //]]>
+        
+});
+</script>
     </div>
 </div>
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/compare.js b/app/code/Magento/Catalog/view/frontend/web/js/compare.js
index 7012252276fd592d9be1b4888e1f3731f8892213..0e8aaa4faf1ae24c72f6f95f02401e601e0abe63 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/compare.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/compare.js
@@ -22,7 +22,12 @@
  */
 /*jshint browser:true jquery:true*/
 /*global confirm:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/decorate"
+], function($){
+    
     $.widget('mage.compareItems', {
         _create: function() {
             this.element.decorate('list', true);
@@ -43,4 +48,4 @@
             });
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/date-option.js b/app/code/Magento/Catalog/view/frontend/web/js/date-option.js
index 7e9bf37f88cb5ce4a0abdab52d6184b131af7922..7aafe9e3fc923685d39e9427737ed9296d9994a8 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/date-option.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/date-option.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+    
     $.widget('mage.dateOption', {
         options: {
         },
@@ -104,5 +108,4 @@
             }
         }
     });
-})(jQuery);
-
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/file-option.js b/app/code/Magento/Catalog/view/frontend/web/js/file-option.js
index 01742d64c2fe8c2b5887fca97a9d13e1bfc42011..9ec6b6c7bc7228ef93c0a1bdc57d3b7f9da0b9e7 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/file-option.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/file-option.js
@@ -22,7 +22,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define(["jquery","jquery/ui"], function($){
     $.widget('mage.fileOption', {
         options: {
         },
@@ -69,5 +69,4 @@
             this.fileNameSpan.css('text-decoration', this.fileDeleteFlag ? 'line-through' : 'none');
         }
     });
-})(jQuery);
-
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/gallery.js b/app/code/Magento/Catalog/view/frontend/web/js/gallery.js
index 6d1335f607d6a792d29a6c406fffa90c4deabea6..609ca2d39c7ee0424ac47a9716513d771e1e2a53 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/gallery.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/gallery.js
@@ -21,8 +21,18 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true, jquery:true*/
-(function($, window) {
+(function (factory) {
+    if (typeof define === "function" && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+
     $.widget('mage.gallery', {
         options: {
             minWidth: 300, // Minimum width of the gallery image.
@@ -50,4 +60,4 @@
             window.resizeTo(width + this.options.widthOffset, img.height() + this.options.heightOffset);
         }
     });
-})(jQuery, window);
+}));
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/list.js b/app/code/Magento/Catalog/view/frontend/web/js/list.js
index e7ae514aca4aa87bd0456bf4129e278dd5669511..9eb36878f9e22e2c560d3655a3c9674cddeaeae4 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/list.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/list.js
@@ -21,7 +21,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($, window) {
+define(["jquery","jquery/ui"], function($){
     $.widget('mage.compareList', {
         _create: function() {
 
@@ -69,4 +69,4 @@
 
         }
     });
-})(jQuery, window);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/price-option.js b/app/code/Magento/Catalog/view/frontend/web/js/price-option.js
index 34692b97e8b7e108b2040ebf1ec356804eb13b34..8c2e1123367294a5c401fe75446e3f1f2771211f 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/price-option.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/price-option.js
@@ -21,9 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-
-(function($, undefined) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
     "use strict";
+
     $.widget('mage.priceOption', {
         options: {
             productCustomSelector: '.product-custom-option',
@@ -236,4 +240,4 @@
             }
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/list/toolbar.js b/app/code/Magento/Catalog/view/frontend/web/js/product/list/toolbar.js
index bc3479e2acfe9bb9efbe5ea85cf2861afdffa450..54963ceb35f544ef8f2ae66250bf18203cb5fad0 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/product/list/toolbar.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/product/list/toolbar.js
@@ -20,8 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/dataPost",
+    "jquery/jquery.cookie"
+], function($){
     /**
      * ProductListToolbarForm Widget - this widget is setting cookie and submitting form according to toolbar controls
      */
@@ -72,4 +76,5 @@
             $.cookie(cookieName, cookieValue, {path: '/'});
         }
     });
-})(jQuery);
\ No newline at end of file
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/related-products.js b/app/code/Magento/Catalog/view/frontend/web/js/related-products.js
index 3adf3ea7c0cfc3a792c37d816e7a48da6dc82c11..c48cbd444bffd1da243a9e3b0e4ee2edded69d2d 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/related-products.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/related-products.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     "use strict";
+    
     $.widget('mage.relatedProducts', {
         options: {
             relatedCheckbox: '.related-checkbox', // Class name for a related product's input checkbox.
@@ -107,4 +112,4 @@
             return o;
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js b/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js
index 6dc670f224cb005408ca6cab862454d36b17bc74..c77a457a4b15a5fc8ab4c14a01ca66b0df17fff1 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/upsell-products.js
@@ -21,7 +21,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define(["jquery","jquery/ui"], function($){
     "use strict";
     $.widget('mage.upsellProducts', {
         options: {
@@ -69,4 +69,4 @@
             return o;
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/zoom.js b/app/code/Magento/Catalog/view/frontend/web/js/zoom.js
index 73e57fc94969934477ac8d6a264eea5fc7578e69..0fd8b2f31a3ec6255fb8da100f378bb81234c5d0 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/zoom.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/zoom.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.zoom', {
         options: {
             sliderSpeed: 10
@@ -206,4 +210,4 @@
             this._draggableImage();
         }
     });
-}(jQuery));
+});
\ No newline at end of file
diff --git a/app/code/Magento/Catalog/view/frontend/web/product/view/validation.js b/app/code/Magento/Catalog/view/frontend/web/product/view/validation.js
index 9886b7c42ca7e1ab7d09517a35728c0be286b9dd..8595996154c2dc439a5320ab50595c8861634fc7 100644
--- a/app/code/Magento/Catalog/view/frontend/web/product/view/validation.js
+++ b/app/code/Magento/Catalog/view/frontend/web/product/view/validation.js
@@ -20,7 +20,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "mage/validation"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     $.widget("mage.validation", $.mage.validation, {
         options: {
             radioCheckboxClosest: 'ul',
@@ -66,4 +76,4 @@
             }
         }
     });
-})(jQuery);
+}));
\ No newline at end of file
diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..086a9a961fc6ab8af3e508f597442116a5e7be6f
--- /dev/null
+++ b/app/code/Magento/CatalogImportExport/composer.json
@@ -0,0 +1,30 @@
+{
+    "name": "magento/module-catalog-import-export",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-import-export": "0.1.0-alpha89",
+        "magento/module-indexer": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-grouped-product": "0.1.0-alpha89",
+        "magento/module-configurable-product": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "ext-ctype": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CatalogImportExport"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php
index 2df9e468fc5f180c7c5d0780f09eba2ab4aa8807..6be96c052ff78888964ff9e72c4905bed4b68349 100644
--- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php
+++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php
@@ -184,66 +184,68 @@ class Stock extends \Magento\Framework\Data\Form\Element\Select
     {
         return "
             <script type='text/javascript'>
-                jQuery(function($) {
-                    var qty = $('#{$quantityFieldId}'),
-                        productType = $('#product_type_id').val(),
-                        stockAvailabilityField = $('#{$inStockFieldId}'),
-                        manageStockField = $('#inventory_manage_stock'),
-                        useConfigManageStockField = $('#inventory_use_config_manage_stock'),
-                        fieldsAssociations = {
-                            '{$quantityFieldId}' : 'inventory_qty',
-                            '{$inStockFieldId}'  : 'inventory_stock_availability'
+                require(['jquery'], function(jQuery){
+                    jQuery(function($) {
+                        var qty = $('#{$quantityFieldId}'),
+                            productType = $('#product_type_id').val(),
+                            stockAvailabilityField = $('#{$inStockFieldId}'),
+                            manageStockField = $('#inventory_manage_stock'),
+                            useConfigManageStockField = $('#inventory_use_config_manage_stock'),
+                            fieldsAssociations = {
+                                '{$quantityFieldId}' : 'inventory_qty',
+                                '{$inStockFieldId}'  : 'inventory_stock_availability'
+                            };
+
+                        var disabler = function(event) {
+                            var stockBeforeDisable = $.Event('stockbeforedisable', {productType: productType});
+                            $('[data-tab-panel=product-details]').trigger(stockBeforeDisable);
+                            if (stockBeforeDisable.result !== false) {
+                                var manageStockValue = (qty.val() === '') ? 0 : 1;
+                                stockAvailabilityField.prop('disabled', !manageStockValue);
+                                $('#' + fieldsAssociations['{$inStockFieldId}']).prop('disabled', !manageStockValue);
+                                if (manageStockField.val() != manageStockValue && !(event && event.type == 'keyup')) {
+                                    if (useConfigManageStockField.val() == 1) {
+                                        useConfigManageStockField.removeAttr('checked').val(0);
+                                    }
+                                    manageStockField.toggleClass('disabled', false).prop('disabled', false);
+                                    manageStockField.val(manageStockValue);
+                                }
+                            }
                         };
 
-                    var disabler = function(event) {
-                        var stockBeforeDisable = $.Event('stockbeforedisable', {productType: productType});
-                        $('[data-tab-panel=product-details]').trigger(stockBeforeDisable);
-                        if (stockBeforeDisable.result !== false) {
-                            var manageStockValue = (qty.val() === '') ? 0 : 1;
-                            stockAvailabilityField.prop('disabled', !manageStockValue);
-                            $('#' + fieldsAssociations['{$inStockFieldId}']).prop('disabled', !manageStockValue);
-                            if (manageStockField.val() != manageStockValue && !(event && event.type == 'keyup')) {
-                                if (useConfigManageStockField.val() == 1) {
-                                    useConfigManageStockField.removeAttr('checked').val(0);
-                                }
-                                manageStockField.toggleClass('disabled', false).prop('disabled', false);
-                                manageStockField.val(manageStockValue);
+                        //Fill corresponding field
+                        var filler = function() {
+                            var id = $(this).attr('id');
+                            if ('undefined' !== typeof fieldsAssociations[id]) {
+                                $('#' + fieldsAssociations[id]).val($(this).val());
+                            } else {
+                                $('#' + getKeyByValue(fieldsAssociations, id)).val($(this).val());
                             }
-                        }
-                    };
-
-                    //Fill corresponding field
-                    var filler = function() {
-                        var id = $(this).attr('id');
-                        if ('undefined' !== typeof fieldsAssociations[id]) {
-                            $('#' + fieldsAssociations[id]).val($(this).val());
-                        } else {
-                            $('#' + getKeyByValue(fieldsAssociations, id)).val($(this).val());
-                        }
-
-                        if (manageStockField.length) {
-                            fireEvent(manageStockField.get(0), 'change');
-                        }
-                    };
-                    //Get key by value from object
-                    var getKeyByValue = function(object, value) {
-                        var returnVal = false;
-                        $.each(object, function(objKey, objValue){
-                            if (value === objValue) {
-                                returnVal = objKey;
+
+                            if (manageStockField.length) {
+                                fireEvent(manageStockField.get(0), 'change');
                             }
+                        };
+                        //Get key by value from object
+                        var getKeyByValue = function(object, value) {
+                            var returnVal = false;
+                            $.each(object, function(objKey, objValue){
+                                if (value === objValue) {
+                                    returnVal = objKey;
+                                }
+                            });
+                            return returnVal;
+                        };
+                        $.each(fieldsAssociations, function(generalTabField, advancedTabField) {
+                            $('#' + generalTabField + ', #' + advancedTabField)
+                                .bind('focus blur change keyup click', filler)
+                                .bind('keyup change blur', disabler);
+                            filler.call($('#' + generalTabField));
+                            filler.call($('#' + advancedTabField));
                         });
-                        return returnVal;
-                    };
-                    $.each(fieldsAssociations, function(generalTabField, advancedTabField) {
-                        $('#' + generalTabField + ', #' + advancedTabField)
-                            .bind('focus blur change keyup click', filler)
-                            .bind('keyup change blur', disabler);
-                        filler.call($('#' + generalTabField));
-                        filler.call($('#' + advancedTabField));
+                        disabler();
                     });
-                    disabler();
-                });
+                })
             </script>
         ";
     }
diff --git a/app/code/Magento/CatalogInventory/Model/Observer.php b/app/code/Magento/CatalogInventory/Model/Observer.php
index b178d8a56278625ac777ea20292e57f27b128a4f..9e37a00ca378c9e206ec1798941b2a2d5ed29240 100644
--- a/app/code/Magento/CatalogInventory/Model/Observer.php
+++ b/app/code/Magento/CatalogInventory/Model/Observer.php
@@ -583,23 +583,6 @@ class Observer
         return $this;
     }
 
-    /**
-     * Add stock status limitation to catalog product price index select object
-     *
-     * @param EventObserver $observer
-     * @return $this
-     */
-    public function prepareCatalogProductIndexSelect(EventObserver $observer)
-    {
-        $select = $observer->getEvent()->getSelect();
-        $entity = $observer->getEvent()->getEntityField();
-        $website = $observer->getEvent()->getWebsiteField();
-
-        $this->_stockStatus->prepareCatalogProductIndexSelect($select, $entity, $website);
-
-        return $this;
-    }
-
     /**
      * Detects whether product status should be shown
      *
diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php
index 0e77c339bfc69937edb58edb6fb06fac99f5c5f6..e6db107f1ef7c015c25b6aeccb18fa933bfc3b57 100644
--- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php
+++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php
@@ -226,26 +226,6 @@ class Status extends \Magento\Framework\Model\Resource\Db\AbstractDb
         return $this;
     }
 
-    /**
-     * Add stock status limitation to catalog product price index select object
-     *
-     * @param \Magento\Framework\DB\Select $select
-     * @param string|\Zend_Db_Expr $entityField
-     * @param string|\Zend_Db_Expr $websiteField
-     * @return $this
-     */
-    public function prepareCatalogProductIndexSelect(\Magento\Framework\DB\Select $select, $entityField, $websiteField)
-    {
-        $select->join(
-            array('ciss' => $this->getMainTable()),
-            "ciss.product_id = {$entityField} AND ciss.website_id = {$websiteField}",
-            array()
-        );
-        $select->where('ciss.stock_status = ?', Stock\Status::STATUS_IN_STOCK);
-
-        return $this;
-    }
-
     /**
      * Add only is in stock products filter to product collection
      *
diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php
index 273029ea2283d1ce2c72fe01406cf9a989f20a4f..69b4fd7e0bc4eae32e080fa25714c55e46b770c7 100644
--- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php
+++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php
@@ -519,26 +519,6 @@ class Status extends \Magento\Framework\Model\AbstractModel
         return $this;
     }
 
-    /**
-     * Add stock status limitation to catalog product price index select object
-     *
-     * @param \Magento\Framework\DB\Select $select
-     * @param string|Zend_Db_Expr $entityField
-     * @param string|Zend_Db_Expr $websiteField
-     * @return $this
-     */
-    public function prepareCatalogProductIndexSelect(\Magento\Framework\DB\Select $select, $entityField, $websiteField)
-    {
-        if ($this->_catalogInventoryData->isShowOutOfStock()) {
-            return $this;
-        }
-
-        $resource = $this->_getResource();
-        $resource->prepareCatalogProductIndexSelect($select, $entityField, $websiteField);
-
-        return $this;
-    }
-
     /**
      * Add only is in stock products filter to product collection
      *
diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..5fef7ba97da4a39cf4f2c75fc1972ed43b3da15b
--- /dev/null
+++ b/app/code/Magento/CatalogInventory/composer.json
@@ -0,0 +1,27 @@
+{
+    "name": "magento/module-catalog-inventory",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-indexer": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CatalogInventory"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php b/app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
similarity index 82%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php
rename to app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
index bbf3c692ab8135efaff7b4b04602eb063f5834b8..fa15b4d351f6da3719d25e95324d809c5c84bc16 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php
+++ b/app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
@@ -22,7 +22,10 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+/* @var $installer \Magento\Eav\Model\Entity\Setup */
 $installer = $this;
-/** @var $installer \Magento\Catalog\Model\Resource\Setup */
 
-$installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'image', 'used_in_product_listing', '1');
+$installer->getConnection()->insertForce(
+    $installer->getTable('cataloginventory_stock'),
+    array('stock_id' => 1, 'stock_name' => 'Default')
+);
diff --git a/app/code/Magento/CatalogInventory/etc/events.xml b/app/code/Magento/CatalogInventory/etc/events.xml
index d8bccc48d35815479cdeee7124c07d1c0fcbb601..67add8fb7eecac9a5639f6d55753a822e790ca25 100644
--- a/app/code/Magento/CatalogInventory/etc/events.xml
+++ b/app/code/Magento/CatalogInventory/etc/events.xml
@@ -33,9 +33,6 @@
     <event name="catalog_product_collection_load_after">
         <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="addStockStatusToCollection" />
     </event>
-    <event name="catalog_product_prepare_index_select">
-        <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="prepareCatalogProductIndexSelect" />
-    </event>
     <event name="sales_quote_item_collection_products_after_load">
         <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="addInventoryDataToCollection" />
     </event>
@@ -69,7 +66,4 @@
     <event name="admin_system_config_changed_section_cataloginventory">
         <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="updateItemsStockUponConfigChange" />
     </event>
-    <event name="prepare_catalog_product_index_select">
-        <observer name="cataloginventory" instance="Magento\CatalogInventory\Model\Observer" method="prepareCatalogProductIndexSelect" />
-    </event>
 </config>
diff --git a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php
index a82670d8f83df29cace71fc6c0b7b786ed692ff5..963c66b7213212e000a6227c974e3d6b1a9835d5 100644
--- a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php
+++ b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php
@@ -388,8 +388,3 @@ $table = $installer->getConnection()->newTable(
 $installer->getConnection()->createTable($table);
 
 $installer->endSetup();
-
-$installer->getConnection()->insertForce(
-    $installer->getTable('cataloginventory_stock'),
-    array('stock_id' => 1, 'stock_name' => 'Default')
-);
diff --git a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0-1.6.0.0.1.php
similarity index 100%
rename from app/code/Magento/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php
rename to app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0-1.6.0.0.1.php
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1078ad11fc5f61f6dbc4c7d3dbeb4b44e9d79e8e
--- /dev/null
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -0,0 +1,26 @@
+{
+    "name": "magento/module-catalog-rule",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-rule": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CatalogRule"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php
index 224093635dbce1f3027f043ef9b109de9a6db092..87808ba427f79cf6daa1d8d55153fbfe0acf2cfb 100644
--- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php
+++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php
@@ -64,12 +64,6 @@ $table = $installer->getConnection()->newTable(
     null,
     array(),
     'To Date'
-)->addColumn(
-    'customer_group_ids',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    '64k',
-    array(),
-    'Customer Group Ids'
 )->addColumn(
     'is_active',
     \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
@@ -112,12 +106,6 @@ $table = $installer->getConnection()->newTable(
     array(12, 4),
     array('nullable' => false, 'default' => 0.0000),
     'Discount Amount'
-)->addColumn(
-    'website_ids',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    4000,
-    array(),
-    'Website Ids'
 )->addIndex(
     $installer->getIdxName('catalogrule', array('is_active', 'sort_order', 'to_date', 'from_date')),
     array('is_active', 'sort_order', 'to_date', 'from_date')
diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php
index 6ad7b638b9fb2caf60be8bcb0a17223208e4817e..ef440864e16c809163bbb04dfebd6fd2b6d47b01 100644
--- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php
@@ -124,45 +124,4 @@ if (!$connection->isTableExists($rulesCustomerGroupsTable)) {
     $connection->createTable($table);
 }
 
-/**
- * Fill out relation table 'catalogrule_website' with website Ids
- */
-if ($connection->tableColumnExists($rulesTable, 'website_ids')) {
-    $select = $connection->select()->from(
-        array('sr' => $rulesTable),
-        array('sr.rule_id', 'cw.website_id')
-    )->join(
-        array('cw' => $websitesTable),
-        $connection->prepareSqlCondition('sr.website_ids', array('finset' => new \Zend_Db_Expr('cw.website_id'))),
-        array()
-    );
-    $query = $select->insertFromSelect($rulesWebsitesTable, array('rule_id', 'website_id'));
-    $connection->query($query);
-}
-
-/**
- * Fill out relation table 'catalogrule_customer_group' with customer group Ids
- */
-if ($connection->tableColumnExists($rulesTable, 'customer_group_ids')) {
-    $select = $connection->select()->from(
-        array('sr' => $rulesTable),
-        array('sr.rule_id', 'cg.customer_group_id')
-    )->join(
-        array('cg' => $customerGroupsTable),
-        $connection->prepareSqlCondition(
-            'sr.customer_group_ids',
-            array('finset' => new \Zend_Db_Expr('cg.customer_group_id'))
-        ),
-        array()
-    );
-    $query = $select->insertFromSelect($rulesCustomerGroupsTable, array('rule_id', 'customer_group_id'));
-    $connection->query($query);
-}
-
-/**
- * Eliminate obsolete columns
- */
-$connection->dropColumn($rulesTable, 'website_ids');
-$connection->dropColumn($rulesTable, 'customer_group_ids');
-
 $installer->endSetup();
diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml
index c234b6d1fb9ffe35082f093de73cd48b48e1a8d5..ea5cea28b4db3c910c7a4229c16dbfeeee7ae782 100644
--- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml
+++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml
@@ -36,8 +36,12 @@
     </fieldset>
 </div>
 <script type="text/javascript">
+require(["prototype","Magento_Rule/rules"], function(jQuery){
+
 var <?php echo $_element->getHtmlId() ?> = new VarienRulesForm('<?php echo $_element->getHtmlId() ?>', '<?php echo $this->getNewChildUrl() ?>');
 <?php if ($_element->getReadonly()): ?>
     <?php echo $_element->getHtmlId() ?>.setReadonly(true);
 <?php endif; ?>
+
+});
 </script>
diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/form.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/form.phtml
index 05b7ed4a6e2e33e30778ea91d746e3b2e912fb53..5eb8a56ba20a8e31ba94fdb9716541dce6517df9 100644
--- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/form.phtml
+++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/form.phtml
@@ -25,11 +25,13 @@
 <div class="entry-edit rule-tree">
 <?php echo $this->getFormHtml() ?>
 </div>
-<script type="text/javascript">/*
+<script type="text/javascript">
+/*
     if ($('rule_conditions_fieldset')) {
         var conditionsForm = new VarienRulesForm('rule_conditions_fieldset', '<?php echo $this->getNewConditionChildUrl() ?>');
     }
     if ($('rule_actions_fieldset')) {
         var actionsForm = new VarienRulesForm('rule_actions_fieldset', '<?php echo $this->getNewActionChildUrl() ?>');
     }
-*/</script>
+*/
+</script>
diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml
index d60bc2bdba21c16f61befa0e907acd78fba19ab7..6a7bf107341bacf374068d28a57eb2480e125435 100644
--- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml
+++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/js.phtml
@@ -23,7 +23,8 @@
  */
 ?>
 <script type="text/javascript">
-//<![CDATA[
+require(["prototype"], function(){
+
 function hideShowSubproductOptions()
 {
     if ($('rule_sub_is_enable').value == 1) {
@@ -40,5 +41,6 @@ function hideShowSubproductOptions()
 }
 
 document.observe("dom:loaded", hideShowSubproductOptions);
-//]]>
+window.hideShowSubproductOptions = hideShowSubproductOptions;
+});
 </script>
diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..4a8594d5454eb3b46ba4a93058195d02fde023e1
--- /dev/null
+++ b/app/code/Magento/CatalogSearch/composer.json
@@ -0,0 +1,28 @@
+{
+    "name": "magento/module-catalog-search",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CatalogSearch"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml
index 0b74e49da9dfd119886a21b8ea22e430bab9a4f8..b535c1d2ffbc33c69bb6e7dfac083563a8918831 100644
--- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml
+++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml
@@ -147,9 +147,12 @@
 </div>
 </form>
 <script type="text/javascript">
-    //<![CDATA[
-    (function($) {
-        $('#form-validate').mage('validation', {
+require([
+    "jquery",
+    "mage/mage",
+    "mage/validation"
+], function($){
+    $('#form-validate').mage('validation', {
             errorPlacement: function (error, element) {
                 var parent = element.parent();
                 if (parent.hasClass('range')) {
@@ -163,6 +166,5 @@
                 'price[from]': {'less-than-equals-to': 'Please enter a valid price range.'}
             }
         });
-    })(jQuery);
-    //]]>
+});
 </script>
diff --git a/app/code/Magento/CatalogSearch/view/frontend/web/form-mini.js b/app/code/Magento/CatalogSearch/view/frontend/web/form-mini.js
index 3fd3f474ed09bed0e09448ad88496c9cd75617c2..21baed5f2d5f8e9915ad83c68dc64bccb16d5074 100644
--- a/app/code/Magento/CatalogSearch/view/frontend/web/form-mini.js
+++ b/app/code/Magento/CatalogSearch/view/frontend/web/form-mini.js
@@ -22,8 +22,15 @@
  */
 /*jshint browser:true jquery:true*/
 /*global Handlebars*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "handlebars",
+    "mage/translate"
+], function($){
     "use strict";
+
     $.widget('mage.catalogSearch', {
         options: {
             autocomplete: 'off',
@@ -99,7 +106,7 @@
          */
         _onSubmit: function(e) {
             if (this.element.val() === this.options.placeholder || this.element.val() === '') {
-                this.options.placeholder = jQuery.mage.__('Please specify at least one search term.');
+                this.options.placeholder = $.mage.__('Please specify at least one search term.');
                 this.element.val(this.options.placeholder);
                 e.preventDefault();
             }
@@ -214,4 +221,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..54b974665bfdecc0f286b03298323d0d03bd66d3
--- /dev/null
+++ b/app/code/Magento/CatalogUrlRewrite/composer.json
@@ -0,0 +1,22 @@
+{
+    "name": "magento/module-catalog-url-rewrite",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-url-redirect": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CatalogUrlRewrite"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1f4cbfb18b7e553dce0c5436d7735f001812066f
--- /dev/null
+++ b/app/code/Magento/Centinel/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-centinel",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Centinel"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml
index 68c17c369578c2d9414db4c417087d2541004198..6a55692bb702396642e41fce6d244409db799f89 100644
--- a/app/code/Magento/Centinel/etc/module.xml
+++ b/app/code/Magento/Centinel/etc/module.xml
@@ -34,7 +34,6 @@
             <module name="Magento_Checkout"/>
             <module name="Magento_Core"/>
             <module name="Magento_Backend"/>
-            <module name="Magento_Theme"/>
             <module name="Magento_Sales"/>
         </depends>
     </module>
diff --git a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml
index d792afc8a4641b7c5e858a39a4ee03fffe5d8d1d..7d01e16b916139584686acce652a6855f17d9196 100644
--- a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml
+++ b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-centinel-order-create-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Centinel::order_create.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceBlock name="data">
         <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="order/create/abstract.phtml">
             <block class="Magento\Centinel\Block\Adminhtml\Validation\Form" template="validation/form.phtml" name="centinel.validation.form" as="form"/>
diff --git a/app/code/Magento/Centinel/view/adminhtml/templates/validation/form.phtml b/app/code/Magento/Centinel/view/adminhtml/templates/validation/form.phtml
index b892b903defc537e6bd7c972c5fa9a3ac9c4f51a..b0ecffeb27703dce1dc6e827f4a62f3fa8ddf49b 100644
--- a/app/code/Magento/Centinel/view/adminhtml/templates/validation/form.phtml
+++ b/app/code/Magento/Centinel/view/adminhtml/templates/validation/form.phtml
@@ -36,7 +36,13 @@
 </div>
 
 <script type="text/javascript">
-//<![CDATA[
-cardValidator = new centinelValidator('<?php echo $this->getMethodCode() ?>', '<?php echo $this->getFrameUrl() ?>', '<?php echo $this->getContainerId() ?>');
-//]]>
+require([
+	"Magento_Centinel/order_create"
+], function(){
+
+	//<![CDATA[
+	cardValidator = new centinelValidator('<?php echo $this->getMethodCode() ?>', '<?php echo $this->getFrameUrl() ?>', '<?php echo $this->getContainerId() ?>');
+	//]]>
+
+});
 </script>
diff --git a/app/code/Magento/Centinel/view/adminhtml/web/order_create.js b/app/code/Magento/Centinel/view/adminhtml/web/order_create.js
index 942ccd8d2da67f9cc60844e5b5c9f9a33ee2bfbd..c41d3b7f97cb82bde28302916fb9441e802d5e26 100644
--- a/app/code/Magento/Centinel/view/adminhtml/web/order_create.js
+++ b/app/code/Magento/Centinel/view/adminhtml/web/order_create.js
@@ -20,7 +20,10 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var centinelValidator = new Class.create();
+define(["prototype"], function(){
+
+window.centinelValidator = new Class.create();
+
 centinelValidator.prototype = {
 
     initialize : function(method, validationUrl, containerId){
@@ -67,3 +70,5 @@ centinelValidator.prototype = {
     }
 
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Centinel/view/frontend/layout/multishipping_checkout_overview.xml b/app/code/Magento/Centinel/view/frontend/layout/multishipping_checkout_overview.xml
index 239d238b231f5c7fd4488d4e236dddf8e918a4da..b4bcbc67fbc25dab6acfc34d874e49e609c700e1 100644
--- a/app/code/Magento/Centinel/view/frontend/layout/multishipping_checkout_overview.xml
+++ b/app/code/Magento/Centinel/view/frontend/layout/multishipping_checkout_overview.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-centinel-centinel-authenticate-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Centinel::centinel-authenticate.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceContainer name="checkout.multishipping.overview.items.after">
         <block class="Magento\Centinel\Block\Authentication" name="centinel.frame" template="authentication.phtml">
             <action method="setAuthenticationStartMode">
diff --git a/app/code/Magento/Centinel/view/frontend/templates/authentication.phtml b/app/code/Magento/Centinel/view/frontend/templates/authentication.phtml
index f6387647b28b6046218128f1b340e71365fbf00d..c54d44b8041d070fd6224582e96d3287fe1295c9 100644
--- a/app/code/Magento/Centinel/view/frontend/templates/authentication.phtml
+++ b/app/code/Magento/Centinel/view/frontend/templates/authentication.phtml
@@ -32,6 +32,10 @@
     </div>
 <?php else:?>
     <script type="text/javascript">
-        jQuery('[data-container="body"]').trigger("paymentAuthentication", {state: "cancel"});
-    </script>
+require(['jquery'], function(jQuery){
+
+    jQuery('[data-container="body"]').trigger("paymentAuthentication", {state: "cancel"});
+    
+});
+</script>
 <?php endif;?>
diff --git a/app/code/Magento/Centinel/view/frontend/templates/authentication/complete.phtml b/app/code/Magento/Centinel/view/frontend/templates/authentication/complete.phtml
index 9dfd00ab166c4cbc65a885d91addab35d05f1a45..8d9835501c5819ee6224072a485e66f60ec33e7e 100644
--- a/app/code/Magento/Centinel/view/frontend/templates/authentication/complete.phtml
+++ b/app/code/Magento/Centinel/view/frontend/templates/authentication/complete.phtml
@@ -25,8 +25,12 @@
 <?php if ($this->getIsProcessed()):?>
     <?php if ($this->getIsSuccess()):?>
         <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
             parent.jQuery('[data-container="body"]').trigger("paymentAuthentication", {state: "success"});
-        </script>
+        
+});
+</script>
     <?php else:?>
         <h4><?php echo __('Verification Failed');?></h4>
         <p><?php echo __('The card has failed verification with the issuer bank.')?> <strong><?php echo __('Order cannot be placed.')?></strong></p>
diff --git a/app/code/Magento/Centinel/view/frontend/templates/authentication/start.phtml b/app/code/Magento/Centinel/view/frontend/templates/authentication/start.phtml
index 2b627ad4752b992f32a953d065c8334ae00d7335..8a32507a9f0d6edee511cd33f705038bd4800ce3 100644
--- a/app/code/Magento/Centinel/view/frontend/templates/authentication/start.phtml
+++ b/app/code/Magento/Centinel/view/frontend/templates/authentication/start.phtml
@@ -30,8 +30,12 @@
     </fieldset>
 </form>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     window.onload = function () {
         parent.jQuery('[data-container="body"]').trigger("paymentAuthentication", {state: "start"});
         document.getElementById('validation-form').submit();
     }
+
+});
 </script>
diff --git a/app/code/Magento/Centinel/view/frontend/web/centinel-authenticate.js b/app/code/Magento/Centinel/view/frontend/web/centinel-authenticate.js
index f0d8ecfc8e2f86c72c03ec4462bdbb890db38e73..bcd49059e88005fd5e7e1349fcf02d1cea8597c7 100644
--- a/app/code/Magento/Centinel/view/frontend/web/centinel-authenticate.js
+++ b/app/code/Magento/Centinel/view/frontend/web/centinel-authenticate.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.centinelAuthenticate', {
         options : {
             frameUrl: '',
@@ -83,4 +87,5 @@
             this._isAuthenticationStarted = true;
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
index b0c2e2588decb7f4cf76bece3119fb5ad35802fe..9d731deb3b14da2e58f72b5da854aab74dd3505b 100644
--- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
+++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
@@ -323,24 +323,6 @@ class Renderer extends \Magento\Framework\View\Element\Template implements \Mage
         return $this->getUrl('checkout/cart/configure', array('id' => $this->getItem()->getId()));
     }
 
-    /**
-     * Get item delete url
-     *
-     * @return string
-     */
-    public function getDeleteUrl()
-    {
-        if ($this->hasDeleteUrl()) {
-            return $this->getData('delete_url');
-        }
-        $params = ['id' => $this->getItem()->getId()];
-        if (!$this->_request->isAjax()) {
-            $encodedUrl = $this->_urlHelper->getEncodedUrl();
-            $params[\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED] = $encodedUrl;
-        }
-        return $this->getUrl('checkout/cart/delete', $params);
-    }
-
     /**
      * Get quote item qty
      *
diff --git a/app/code/Magento/Checkout/Helper/Cart.php b/app/code/Magento/Checkout/Helper/Cart.php
index 8e2b1aca280e3349f1c3974a23b4980ffe7e0c5c..e1137ecb82690100e34d141f10608450be9cb73c 100644
--- a/app/code/Magento/Checkout/Helper/Cart.php
+++ b/app/code/Magento/Checkout/Helper/Cart.php
@@ -30,6 +30,14 @@ namespace Magento\Checkout\Helper;
  */
 class Cart extends \Magento\Core\Helper\Url
 {
+    /**
+     * Path to controller to delete item from cart
+     */
+    const DELETE_URL = 'checkout/cart/delete';
+
+    /**
+     * Path for redirect to cart
+     */
     const XML_PATH_REDIRECT_TO_CART = 'checkout/cart/redirect_to_cart';
 
     /**
@@ -137,7 +145,24 @@ class Cart extends \Magento\Core\Helper\Url
             'id' => $item->getId(),
             \Magento\Framework\App\Action\Action::PARAM_NAME_BASE64_URL => $this->getCurrentBase64Url()
         );
-        return $this->_getUrl('checkout/cart/delete', $params);
+        return $this->_getUrl(self::DELETE_URL, $params);
+    }
+
+    /**
+     * Get post parameters for delete from cart
+     *
+     * @param \Magento\Sales\Model\Quote\Item $item
+     * @return string
+     */
+    public function getDeletePostJson($item)
+    {
+        $url = $this->_getUrl(self::DELETE_URL);
+
+        $data = ['id' => $item->getId()];
+        if (!$this->_request->isAjax()) {
+            $data[\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED] = $this->getCurrentBase64Url();
+        }
+        return json_encode(array('action' => $url, 'data' => $data));
     }
 
     /**
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..024648037a01e6e064f3bc159be8b0cb9caae7eb
--- /dev/null
+++ b/app/code/Magento/Checkout/composer.json
@@ -0,0 +1,34 @@
+{
+    "name": "magento/module-checkout",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-gift-message": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-page-cache": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Checkout"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php b/app/code/Magento/Checkout/data/checkout_setup/data-install-1.6.0.0.php
similarity index 100%
rename from app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php
rename to app/code/Magento/Checkout/data/checkout_setup/data-install-1.6.0.0.php
diff --git a/app/code/Magento/Checkout/view/frontend/layout/default.xml b/app/code/Magento/Checkout/view/frontend/layout/default.xml
index dbb29a3360efea2f365672ad06fdf0f745162e3c..9c37284180336acb44e2e0189608e1e669185d87 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/default.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/default.xml
@@ -29,7 +29,7 @@
         <block class="Magento\Framework\View\Element\Js\Components" name="checkout_page_head_components" template="Magento_Checkout::js/components.phtml"/>
     </referenceBlock>
     <referenceContainer name="header-wrapper">
-        <block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="logo" template="cart/minicart.phtml" cacheable="false">
+        <block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="logo" template="cart/minicart.phtml">
             <block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.sidebar.item.renderers" as="renderer.list" />
             <container name="minicart.extra.info" as="minicart_info" label="My Cart Extra info"/>
             <container name="topCart.extra_actions" as="extra_actions" label="My Cart Extra Actions">
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml
index 8f2ea4fd355d080ec51e05f63483bed13e7a451d..4ea01a93eae5953d6a1478b9cf55a3ddbf497bf2 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml
@@ -50,13 +50,18 @@
     </div>
 
     <script type="text/javascript">
-        (function ($) {
-            var addtocartForm = $('#product_addtocart_form');
-            addtocartForm.mage('validation');
-            addtocartForm.mage('addToCart', {
-                cartButtonId: "#product-updatecart-button",
-                cartForm: "#product_addtocart_form"
-            });
-        })(jQuery);
-    </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    var addtocartForm = $('#product_addtocart_form');
+    addtocartForm.mage('validation');
+    addtocartForm.mage('addToCart', {
+        cartButtonId: "#product-updatecart-button",
+        cartForm: "#product_addtocart_form"
+    });
+    
+});
+</script>
 <?php endif; ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml
index b6c4a68dd0aa340207fd25d07f9adb0bf19ff06b..63e830d57cec0f192fb16c771fa76c308ac3d435 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml
@@ -304,7 +304,11 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite
             <a class="action edit" href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo __('Edit item parameters') ?>"><span><?php echo __('Edit') ?></span></a>
             <?php endif ?>
 
-            <a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo __('Remove item')?>" class="action delete"><span><?php echo __('Remove item')?></span></a>
+            <button title="<?php echo __('Remove item') ?>"
+                    class="action delete"
+                    data-post='<?php echo $this->helper('Magento\Checkout\Helper\Cart')->getDeletePostJson($_item); ?>'>
+                <span><?php echo __('Remove item')?></span>
+            </button>
         </div>
     </td>
 </tr>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml
index a44c91ff72ff9416412c508173ac86655608ef4e..ebd7e0e0920864ae8272ea1f6959a76d1525bd57 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml
@@ -115,14 +115,17 @@
     <?php endif ?>
 <?php endif; ?>
 <script type="text/javascript">
-    (function($) {
-        $('[data-block="minicart"]').mage('sidebar', {
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+        $('[data-block="minicart"]').mage('sidebar',{
             checkoutUrl: '<?php echo $this->getCheckoutUrl();?>',
             checkoutButton: '#top-cart-btn-checkout',
             removeButton: '#mini-cart a.action.delete',
             confirmMessage: '<?php echo __('Are you sure you would like to remove this item from the shopping cart?') ?>'
         });
-    })(jQuery);
+});
 </script>
 <?php if ($this->getInList()): ?>
     </li>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
index 90e954f4e40e033c3279bfc0abb810423b5d3229..f8ebc3e7357fddb4d203113ebce56b84f822165f 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
@@ -68,21 +68,28 @@
         </fieldset>
     </form>
     <script type="text/javascript">
-        (function($) {
-            var $form = $('#shipping-zip-form');
-            $form.mage('validation');
-            $('#country').mage('regionUpdater', {
-                optionalRegionAllowed: <?php echo ($this->getConfig('general/region/display_all')? 'true' : 'false'); ?>,
-                regionListId: '#region_id',
-                regionInputId: '#region',
-                postcodeId: '#postcode',
-                form: $form,
-                regionJson: <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
-                defaultRegion: "<?php echo $this->getEstimateRegionId() ?>",
-                countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
-            });
-        })(jQuery);
-    </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    var $form = $('#shipping-zip-form');
+    
+    $form.mage('validation');
+    
+    $('#country').mage('regionUpdater', {
+        optionalRegionAllowed: <?php echo ($this->getConfig('general/region/display_all')? 'true' : 'false'); ?>,
+        regionListId: '#region_id',
+        regionInputId: '#region',
+        postcodeId: '#postcode',
+        form: $form,
+        regionJson: <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
+        defaultRegion: "<?php echo $this->getEstimateRegionId() ?>",
+        countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
+    });
+    
+});
+</script>
     <?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
     <form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
         <fieldset class="fieldset rates">
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml
index 13f9c393be0a0a320dd5231253f560321784587e..ad98c68f8aa26c8b13b2b978957f1a9d0764db5e 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/sidebar/default.phtml
@@ -200,7 +200,7 @@
             </div>
             <?php endif ?>
             <div class="secondary">
-                <a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo __('Remove item') ?>" class="action delete">
+                <a href="#" data-post='<?php echo $this->helper('Magento\Checkout\Helper\Cart')->getDeletePostJson($_item); ?>' title="<?php echo __('Remove item') ?>" class="action delete">
                     <span><?php echo __('Remove')?></span>
                 </a>
             </div>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml b/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml
index 566ce4c6a4736f1e59cca349029ca73cad17f6f8..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/js/components.phtml
@@ -22,69 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            paymentAuthentication: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/payment-authentication.js') ?>'
-            ],
-            collapsible: [
-				'<?php echo $this->getViewFileUrl('mage/collapsible.js') ?>'
-			],
-            dropdownDialog: [
-                '<?php echo $this->getViewFileUrl('mage/dropdown.js') ?>'
-            ],
-            accordion: [
-                '<?php echo $this->getViewFileUrl('mage/collapsible.js') ?>',
-                '<?php echo $this->getViewFileUrl('mage/tabs.js') ?>',
-				'<?php echo $this->getViewFileUrl('mage/accordion.js') ?>'
-			],
-            addToCart: [
-                '<?php echo $this->getViewFileUrl('Magento_Catalog::js/msrp.js') ?>'
-            ],
-            checkoutBalance: [
-                '<?php echo $this->getViewFileUrl('Magento_Customer::js/checkout-balance.js')?>'
-            ],
-            shoppingCart: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/shopping-cart.js') ?>'
-            ],
-            regionUpdater: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/region-updater.js') ?>'
-            ],
-            creditCardType: [
-                '<?php echo $this->getViewFileUrl('Magento_Payment::cc-type.js') ?>'
-            ],
-            loader: [
-                '<?php echo $this->getViewFileUrl('jquery/handlebars/handlebars-v1.3.0.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/loader.js') ?>'
-            ],
-            tooltip: [
-                '<?php echo $this->getViewFileUrl('mage/tooltip.js') ?>'
-            ],
-            opcOrderReview: [
-                '<?php echo $this->getViewFileUrl('jquery/jquery.validate.js')?>',
-                '<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/validation.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/validation/validation.js')?>',
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/opc-checkout-method.js') ?>',
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/opc-billing-info.js') ?>',
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/opc-shipping-info.js') ?>',
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/opc-shipping-method.js') ?>',
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/opc-payment-info.js') ?>',
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/opc-order-review.js') ?>'
-
-            ],
-            sidebar: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/sidebar.js') ?>'
-            ],
-            payment: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/payment.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml
index 7ed49535eb35ff57484821e4e433285949469350..6a50b5be694a74665f30d365f741d1c2fcff1bd0 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml
@@ -65,20 +65,25 @@ $mageConfig = json_encode($config);
     <?php endforeach ?>
     </ol>
     <script type="text/javascript">
-        (function($) {
-            'use strict';
-            $(document).ready(function() {
-                $('#checkoutSteps').mage('accordion',{
-                    'collapsibleElement' : ' > li',
-                    'openedState' : 'active'
-                }).mage('opcOrderReview', $.extend({
-                    'checkoutAgreements': '#checkout-agreements',
-                    'checkoutProgressContainer': '#checkout-progress-wrapper',
-                    'methodDescription': '.items'
-                    },
-                    <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($_paymentBlock->getOptions()); ?>
-                ));
-            });
-        })(jQuery);
-    </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+    'use strict';
+    
+    $(document).ready(function() {
+        $('#checkoutSteps').mage('accordion',{
+            'collapsibleElement' : ' > li',
+            'openedState' : 'active'
+        }).mage('opcOrderReview', $.extend({
+            'checkoutAgreements': '#checkout-agreements',
+            'checkoutProgressContainer': '#checkout-progress-wrapper',
+            'methodDescription': '.items'
+            },
+            <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($_paymentBlock->getOptions()); ?>
+        ));
+    });
+    
+});
+</script>
 </div>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml
index ad04faa679b3ed8536adfb7a49b8d36c2d6074a2..bdd25a6c7aa2893d87275f168cb65304f1e57d5f 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml
@@ -202,7 +202,11 @@
 </div>
 </form>
 <script type="text/javascript">
-    (function($) {
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
+
         $('#billing\\:country_id').mage('regionUpdater', {
             optionalRegionAllowed: <?php echo ($this->getConfig('general/region/display_all')? 'true' : 'false'); ?>,
             regionListId: '#billing\\\:region_id',
@@ -212,5 +216,6 @@
             defaultRegion: "<?php echo $this->getAddress()->getRegionId() ?>",
             countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
         });
-    })(jQuery);
+
+    });
 </script>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml
index e345dd730646b449eb2d7eea9bdc205d9352eb50..3369eb8313a70a62a921cf79ed07cbeb47e3eeb4 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml
@@ -124,15 +124,20 @@
     </div>
 </form>
 <script type="text/javascript">
-    (function($) {
-        $('#shipping\\:country_id').mage('regionUpdater', {
-            optionalRegionAllowed: <?php echo ($this->getConfig('general/region/display_all')? 'true' : 'false'); ?>,
-            regionListId: '#shipping\\\:region_id',
-            regionInputId: '#shipping\\\:region',
-            postcodeId: '#shipping\\\:postcode',
-            regionJson: <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
-            defaultRegion: "<?php echo $this->getAddress()->getRegionId() ?>",
-            countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
-        });
-    })(jQuery);
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    $('#shipping\\:country_id').mage('regionUpdater', {
+        optionalRegionAllowed: <?php echo ($this->getConfig('general/region/display_all')? 'true' : 'false'); ?>,
+        regionListId: '#shipping\\\:region_id',
+        regionInputId: '#shipping\\\:region',
+        postcodeId: '#shipping\\\:postcode',
+        regionJson: <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
+        defaultRegion: "<?php echo $this->getAddress()->getRegionId() ?>",
+        countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
+    });
+
+});
 </script>
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/accordion.js b/app/code/Magento/Checkout/view/frontend/web/js/accordion.js
index c5a51235fced6173112cf4e64c32590f2604ecad..4c1a5af7b8e4bfda1efb452c3d925dcd5c4f6676 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/accordion.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/accordion.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true browser:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     'use strict';
+
     // mage.accordion base functionality
     $.widget('mage.accordion', $.ui.accordion, {
         options: {
@@ -53,4 +57,5 @@
             $(this.options.activeSelector).addClass('allow active').find('h2').trigger('click');
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/discount-codes.js b/app/code/Magento/Checkout/view/frontend/web/js/discount-codes.js
index c789360c3443eb0897d8c585b78bb310e910f9c1..1ec3c9a55c4ec06c832db0da82075c0f4480be23 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/discount-codes.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/discount-codes.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.discountCode', {
         options: {
         },
@@ -42,4 +46,5 @@
             }, this));
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js
index 479b413d70b306907740eda5deb439e21f6e07e8..3d028551e85d32eb3e04e6bd5aefb2b2c8845677 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js
@@ -24,8 +24,14 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
-    'use strict';    
+define([
+    "jquery",
+    "jquery/ui",
+    "Magento_Checkout/js/opc-checkout-method",
+    "mage/validation"
+], function($){
+    'use strict';
+       
     // Extension for mage.opcheckout - second section(Billing Information) in one page checkout accordion
     $.widget('mage.opcBillingInfo', $.mage.opcCheckoutMethod, {
         options: {
@@ -61,4 +67,5 @@
             });
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js
index 483a9a4781be7a54585185319f6c59c3e00d4911..3cbfea4d169924bf96c2edd976d0645468e45587 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js
@@ -24,8 +24,15 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/validation/validation",
+    "Magento_Checkout/js/accordion",
+    "mage/translate"
+], function($){
     'use strict';
+
     // Base widget, handle ajax events and first section(Checkout Method) in one page checkout accordion
     $.widget('mage.opcCheckoutMethod', {
         options: {
@@ -281,4 +288,5 @@
             }
         }
     });
-})(jQuery, window);
+
+});
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js
index b8d7cbcd04b7a7e3a1896eb254e244f22bc7b35e..16b48f9447c58d768fa63eb6f9110e55dc13e9a8 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js
@@ -24,8 +24,13 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
-    'use strict';    
+define([
+    "jquery",
+    "jquery/ui",
+    "Magento_Checkout/js/opc-payment-info"
+], function($){
+    'use strict';
+
     // Extension for mage.opcheckout - last section(Order Review) in one page checkout accordion
     $.widget('mage.opcOrderReview', $.mage.opcPaymentInfo, {
         options: {
@@ -58,4 +63,5 @@
             }
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js
index 66454cb776b319dc13b1ce44a44869943af3e365..a99908dae011630002eca533f9fd5a8bb597ded0 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js
@@ -24,8 +24,15 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
-    'use strict';    
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "mage/translate",
+    "Magento_Checkout/js/opc-shipping-method"
+], function($){
+    'use strict';
+
     // Extension for mage.opcheckout - fifth section(Payment Information) in one page checkout accordion
     $.widget('mage.opcPaymentInfo', $.mage.opcShippingMethod, {
         options: {
@@ -37,7 +44,8 @@
                     tmpl: '<input id="hidden-free" type="hidden" name="payment[method]" value="free">',
                     selector: '#hidden-free'
                 }
-            }
+            },
+            hasRecurringItems: false
         },
 
         _create: function() {
@@ -155,4 +163,5 @@
             paymentForm.find(this.options.payment.freeInput.selector).remove();
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js
index d5e3bcd54d74982cd6dc8d63d0d9f1b9b61a9f41..d1e65345729d6c3aec59e8ad09278ea3c2e36de3 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js
@@ -24,8 +24,14 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
-    'use strict';    
+define([
+    "jquery",
+    "jquery/ui",
+    "Magento_Checkout/js/opc-billing-info",
+    "mage/validation"
+], function($){
+    'use strict';
+
     // Extension for mage.opcheckout - third section(Shipping Information) in one page checkout accordion
     $.widget('mage.opcShippingInfo', $.mage.opcBillingInfo, {
         options: {
@@ -83,4 +89,5 @@
             $(this.options.shipping.copyBillingSelector).prop('checked', true);
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js
index 43501eb5876836bd7803d55393e37a0bd9515d4c..8243cd7b4938a0bb44006c27bb2a8174b9142934 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js
@@ -24,8 +24,15 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "Magento_Checkout/js/opc-shipping-info",
+    "mage/validation",
+    "mage/translate"
+], function($){
     'use strict';    
+
     // Extension for mage.opcheckout - fourth section(Shipping Method) in one page checkout accordion
     $.widget('mage.opcShippingMethod', $.mage.opcShippingInfo, {
         options: {
@@ -80,4 +87,5 @@
             return false;
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js b/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js
index 7c1862d44cdc6bd5283848b07b098960b7f7a018..9f4201bd68736c61f0da343f94582cd5bddceaab 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js
@@ -22,8 +22,15 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/validation",
+    "jquery/template",
+    "mage/translate"
+], function($){
     'use strict';
+
     // Base widget, handle ajax events and first section(Checkout Method) in one page checkout accordion
     $.widget('mage.opcheckout', {
         options: {
@@ -537,4 +544,5 @@
             }
         }
     });
-})(jQuery, window);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/overview.js b/app/code/Magento/Checkout/view/frontend/web/js/overview.js
index 9377a1407a313559960fdf5e7fae713c25d31c8e..0c087e4a4eeee54a22d8a7a675226faf0a3403f3 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/overview.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/overview.js
@@ -23,8 +23,13 @@
  */
 /*jshint jquery:true*/
 /*global alert*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     "use strict";
+    
     $.widget('mage.orderOverview', {
         options: {
             opacity: 0.5, // CSS opacity for the 'Place Order' button when it's clicked and then disabled.
@@ -57,4 +62,5 @@
             return true;
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js b/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js
index 22e4a22e7abee2eb1a8359c66b57bc3d36b6bba3..408c127eba0a520923e87adf135226e08f4774b5 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+    
     $.widget('mage.paymentAuthentication', {
         options : {
             bodySelector: '[data-container="body"]'
@@ -44,4 +48,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/payment.js b/app/code/Magento/Checkout/view/frontend/web/js/payment.js
index 05fc7cd13f94dba6a9da6ae9480a8025fa7449f4..1878072233f4aacd6fb292019f4c9b3df8dceacf 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/payment.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/payment.js
@@ -22,8 +22,14 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "jquery/template"
+], function($){
     'use strict';
+
     $.widget('mage.payment', {
         options: {
             continueSelector: '#payment-continue',
@@ -129,4 +135,4 @@
             }
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
index 10aa54c8dc1ae0e76873cd8dc9a24d43e4defa58..d076a094a4004e72f6bb4596a1e56617d7e0b2dd 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
@@ -22,7 +22,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "mage/validation"
+], function($){
+
     $.widget('mage.regionUpdater', {
         options: {
             regionTemplate: '<option value="${value}" title="${title}" {{if isSelected}}selected="selected"{{/if}}>${title}</option>',
@@ -182,4 +188,5 @@
             });
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js b/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js
index ea5ecc520376778619e98a0251cc019d95ef47d1..28bc626163fac77adbf513ea04f5098725fd7f8c 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.shoppingCart', {
         _create: function() {
             if ($(this.options.updateCartActionContainer).length > 0) { /* <!--[if lt IE 8]> Only */
@@ -36,4 +40,5 @@
             }, this));
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
index 94ea7f489c6e90835f414d8a98ef67023ff798ad..82e0df0cb606b2b47d79abeda0db94acbb214c6e 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
@@ -22,7 +22,12 @@
  */
 /*jshint browser:true jquery:true*/
 /*global confirm:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/decorate"
+], function($){
+
     $.widget('mage.sidebar', {
         options: {
             isRecursive: true
@@ -37,4 +42,5 @@
             }, this));
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..e7721e204233a98a39d928690cb9a3cdb3cef4a1
--- /dev/null
+++ b/app/code/Magento/CheckoutAgreements/composer.json
@@ -0,0 +1,22 @@
+{
+    "name": "magento/module-checkout-agreements",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CheckoutAgreements"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..94f9e1f5d553c3b54cc1f271bfb2a8fb234dcaff
--- /dev/null
+++ b/app/code/Magento/Cms/composer.json
@@ -0,0 +1,27 @@
+{
+    "name": "magento/module-cms",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-email": "0.1.0-alpha89",
+        "magento/module-install": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Cms"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml
index 1a96cacad31b22fcce0fb28726233aee3ff3c47a..9568b096e8d4fb8a93e312377517b60af1691c96 100644
--- a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml
+++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml
@@ -31,33 +31,13 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-canvas-to-blob-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/canvas-to-blob.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
+                <argument name="file" xsi:type="string">jquery/fileUploader/bootstrap.js</argument>
             </arguments>
         </block>
     </referenceBlock>
     <referenceContainer name="content">
         <block class="Magento\Cms\Block\Adminhtml\Block\Edit" name="cms_block_edit"/>
     </referenceContainer>
-</layout>
+</layout>
\ No newline at end of file
diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml
index 4197f3db4e774ce265cb50290a6f6e602c4960bb..bd330c01a4015de83d9e48177f0eee125ab922e7 100644
--- a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml
+++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml
@@ -30,29 +30,9 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-canvas-to-blob-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/canvas-to-blob.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
+                <argument name="file" xsi:type="string">jquery/fileUploader/bootstrap.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml
index 663e1703d4eb5c44ac375d9767c2e230035b3e88..f847dc30d03d38c6fb0c3ae335e851e20a21655f 100644
--- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml
+++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml
@@ -40,9 +40,8 @@
         </div>
     </script>
     <script type="text/javascript">
-    //<![CDATA[
-    (function($) {
-        $(function () {
+require(["jquery","jquery/file-uploader","jquery/template"], function($){
+    $(function () {
             $('#<?php echo $this->getHtmlId() ?> .fileupload').fileupload({
                 dataType: 'json',
                 formData: {
@@ -104,7 +103,6 @@
                 ]
             });
         });
-    })(jQuery);
-    //]]>
-    </script>
+    });
+</script>
 </div>
diff --git a/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js b/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js
index cc5a32b184481268283a927e59082dd204bb075d..82e64e2f9b0d8324b304989ecee52a9d9d196aac 100644
--- a/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js
+++ b/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js
@@ -20,7 +20,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function($) {
+define(["jquery","jquery/ui","jquery/jstree/jquery.jstree"], function($){
     'use strict';
 
     $.widget("mage.folderTree", {
@@ -96,4 +96,4 @@
             });
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..8eb91f0ab2bd040010307bc1b454bc44e43bb228
--- /dev/null
+++ b/app/code/Magento/CmsUrlRewrite/composer.json
@@ -0,0 +1,20 @@
+{
+    "name": "magento/module-cms-url-rewrite",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-url-redirect": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CmsUrlRewrite"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..27f4fed2b11a94f298b5974b161d3ce8233daecd
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/composer.json
@@ -0,0 +1,33 @@
+{
+    "name": "magento/module-configurable-product",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-catalog-rule": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/module-webapi": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/ConfigurableProduct"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml
index 71ed9ee44314bda417fd1aa6420b9e5da6a98b26..c4e5719f372eef062d4d12f3f99a9307bb205f32 100644
--- a/app/code/Magento/ConfigurableProduct/etc/module.xml
+++ b/app/code/Magento/ConfigurableProduct/etc/module.xml
@@ -46,7 +46,6 @@
             <module name="Magento_CatalogRule" />
             <module name="Magento_Directory" />
             <module name="Magento_Weee" />
-            <module name="Magento_RequireJs" />
             <module name="Magento_Webapi"/>
         </depends>
     </module>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml
index 2898874b8e11830f3f166da3aa203f8e7e87524e..5c6bfe6e98c13f20525c8f3ad05a128f6e3a6b5f 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml
@@ -30,11 +30,6 @@
         <block class="Magento\Framework\View\Element\Template" template="Magento_ConfigurableProduct::product/configurable/stock/disabler.phtml"/>
     </referenceContainer>
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-catalog-product-variation-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_ConfigurableProduct::catalog/product-variation.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-configurableproduct-product-product-css">
             <arguments>
                 <argument name="file" xsi:type="string">Magento_ConfigurableProduct::product/product.css</argument>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/default.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/default.xml
deleted file mode 100644
index bcdffbe89a9897d476d278d69b1f7280c3339021..0000000000000000000000000000000000000000
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/default.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="configurable-config-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_ConfigurableProduct::js/configurable.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="configurable-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_ConfigurableProduct::catalog/product/attribute.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
-</layout>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/js.phtml
index f63b776c8e34b67bf24b42e4983cc221cc96ec65..e22a0ed390e50ea99d7951466b0627b651f2d110 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/js.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/js.phtml
@@ -24,6 +24,8 @@
  */
 ?>
 <script type="text/javascript">
+require(["jquery", "js/theme", "prototype"], function(){
+
 function checkIsConfigurableVisibility()
 {
     if (!$('is_configurable') || !$('is_global') || !$('frontend_input')) return;
@@ -47,4 +49,8 @@ showDefaultRows = showDefaultRows.wrap(function(original) {
 if($('frontend_input')){
     Event.observe($('is_global'), 'change', checkIsConfigurableVisibility);
 }
+
+window.checkIsConfigurableVisibility = checkIsConfigurableVisibility;
+
+});
 </script>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml
index b4eb7cfdb6efc6660c3048b83afe36f15b97db0e..51f2cbc596b7b08a0c01525a8a0a14a46374d6c0 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml
@@ -25,6 +25,7 @@
 ?>
 <script type="text/javascript">
 (function ($) {
+
     var data = <?php echo $this->getAttributesBlockJson() ?>;
     var set = data.set || {id: $('#attribute_set_id').val()};
     if (data.tab == 'variations') {
@@ -33,6 +34,7 @@
         $('[data-form=edit-product]').trigger('changeAttributeSet', set);
     }
     $('#create_new_attribute').dialog('close');
+
 })(window.parent.jQuery);
 </script>
 <div class="a-center">
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml
index 9c706d108ba202558a09334b44fee33955ac61e4..cdd1018c2c51f6797aeb5a59a619bb060106e4a3 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml
@@ -24,42 +24,44 @@
  */
 ?>
 <script type="text/javascript">
-    ConfigurableNodeExists = function(currentNode) {
-        for (var i in currentNode.childNodes ) {
-            if (currentNode.childNodes[i].id) {
-                child = editSet.currentNode.childNodes[i];
-                if (child.attributes.is_configurable) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    };
-    var editSet = editSet;
 
-    editSet.submit = editSet.submit.wrap(function(original) {
-        if (editSet.currentNode){
-            if (ConfigurableNodeExists(editSet.currentNode)) {
-                alert('<?php echo $this->escapeJsQuote(__('This group contains attributes used in configurable products. Please move these attributes to another group and try again.')) ?>');
-                return;
+ConfigurableNodeExists = function(currentNode) {
+    for (var i in currentNode.childNodes ) {
+        if (currentNode.childNodes[i].id) {
+            child = editSet.currentNode.childNodes[i];
+            if (child.attributes.is_configurable) {
+                return true;
             }
         }
-        return original();
-    });
+    }
+    return false;
+};
+var editSet = editSet;
 
-    editSet.rightBeforeAppend = editSet.rightBeforeAppend.wrap(function(original, tree, nodeThis, node, newParent) {
-        if (node.attributes.is_configurable == 1) {
-            alert('<?php echo $this->escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>');
-            return false;
+editSet.submit = editSet.submit.wrap(function(original) {
+    if (editSet.currentNode){
+        if (ConfigurableNodeExists(editSet.currentNode)) {
+            alert('<?php echo $this->escapeJsQuote(__('This group contains attributes used in configurable products. Please move these attributes to another group and try again.')) ?>');
+            return;
         }
-        return original(tree, nodeThis, node, newParent);
-    });
+    }
+    return original();
+});
+
+editSet.rightBeforeAppend = editSet.rightBeforeAppend.wrap(function(original, tree, nodeThis, node, newParent) {
+    if (node.attributes.is_configurable == 1) {
+        alert('<?php echo $this->escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>');
+        return false;
+    }
+    return original(tree, nodeThis, node, newParent);
+});
+
+editSet.rightBeforeInsert = editSet.rightBeforeInsert.wrap(function(original, tree, nodeThis, node, newParent) {
+    if (node.attributes.is_configurable == 1) {
+        alert('<?php echo $this->escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>');
+        return false;
+    }
+    return original(tree, nodeThis, node, newParent);
+});
 
-    editSet.rightBeforeInsert = editSet.rightBeforeInsert.wrap(function(original, tree, nodeThis, node, newParent) {
-        if (node.attributes.is_configurable == 1) {
-            alert('<?php echo $this->escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>');
-            return false;
-        }
-        return original(tree, nodeThis, node, newParent);
-    });
 </script>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml
index 62fbcba2d274bf082216fbfe662d5a78a3c4d995..6746898653c1f00d3d82a832ede0c1a153274a05 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml
@@ -44,6 +44,11 @@
     </div>
 </fieldset>
 <script type="text/javascript">
+require([
+    "Magento_ConfigurableProduct/js/configurable",
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+
     var config = <?php echo $this->getJsonConfig() ?>;
     if (window.productConfigure) {
         config.containerId = window.productConfigure.blockFormFields.id;
@@ -51,6 +56,9 @@
             config.inputsInitialized = true;
         }
     }
+
     ProductConfigure.spConfig = new Product.Config(config);
+
+});
 </script>
 <?php endif;?>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml
index 0d125411ceb5b90b1b0c79ae06f76a6daa89701e..e269f3e3c81c0bbc1539bf0f348728ca59171535 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml
@@ -58,7 +58,14 @@ use \Magento\ConfigurableProduct\Model\Product\Type\Configurable;
     </div>
 </div>
 <script type="text/javascript">
-jQuery(function($) {
+require([
+    'jquery',
+    'jquery/ui',
+    'jquery/jquery.tabs',
+    'mage/mage',
+    'mage/backend/menu',
+    'Magento_ConfigurableProduct/catalog/product-variation'
+], function($){
     'use strict';
 
     var variationsContainer = $("#<?php echo $this->getId()?>"),
@@ -95,12 +102,12 @@ jQuery(function($) {
             disableElement(qtyField);
             enableElement(stockAvailabilityField);
 
-            $.each($('#configurable-attributes-container').variationsAttributes('getAttributes'), function() {
+            $.each($.mage.variationsAttributes($('#configurable-attributes-container')).getAttributes(), function() {
                 $('#attribute-' + this.code + '-container select').prop('disabled', true);
             })
         })
         .on('hide', function() {
-            if ($('#configurable-attributes-container').variationsAttributes('getAttributes').length) {
+            if ($.mage.variationsAttributes($('#configurable-attributes-container')).getAttributes().length) {
                 return;
             }
             currentProductTemplateControl
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml
index 1dddc29458c3a9278dbedc92ea8fc1186184c49f..e045fd29517af2e4e014b24d962bcc7d93ae9368 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml
@@ -263,6 +263,14 @@ $productByUsedAttributes = $this->getAssociatedProducts();
     <img src="${url}" class="variation" data-role="image"/>
 </script>
 <script type="text/javascript">
+require([
+    "jquery",
+    "jquery/template",
+    "jquery/file-uploader",
+    "mage/mage",
+    "mage/translate"
+], function(jQuery){
+
 jQuery(function ($) {
     var matrix = $('[data-role=product-variations-matrix]');
     matrix.find('[data-action=upload-image] [name=image]').each(function() {
@@ -306,4 +314,6 @@ jQuery(function ($) {
         parentElement.find('[data-toggle=dropdown]').trigger('close.dropdown').hide();
     });
 });
+
+});
 </script>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml
index 507b685518c66391805e07d366951f4778941d08..44a8f5e45a14803f87c290d7dbe53045ca4d9c8e 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml
@@ -24,14 +24,22 @@
 /* @var $this \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector */
 ?>
 <script type="text/javascript">
-jQuery(function($) {
-    'use strict';
-    $(function() {
-        var $form = $('#affected-attribute-set-form'),
-            resetValidation = function() {
-                $form.find('.messages .message.error').hide();
-                $form.find('form').validation().data('validator').resetForm();
-            };
+(function($){
+    var $form;
+
+    require([
+        "jquery",
+        "jquery/ui",
+        "Magento_ConfigurableProduct/catalog/product-variation"
+    ], function($){
+        'use strict';
+
+        $form = $('#affected-attribute-set-form');
+
+        var resetValidation = function() {
+            $form.find('.messages .message.error').hide();
+            $form.find('form').validation().data('validator').resetForm();
+        };
 
         $('[data-form=edit-product]').append($('<input>', {
             type: 'hidden',
@@ -107,32 +115,38 @@ jQuery(function($) {
                     $form.find('input[name=new-attribute-set-name]').focus();
                 }
             });
+    });
+    
+    /**
+     * This fix was made in order to properly handle 'stopImmediatePropagation'.
+     */
+    $('#save-split-button .item').on('click', function(event) {
+        if ($('#new-variations-attribute-set-id').val() != '') {
+            return; // affected attribute set was already chosen
+        }
+        
+        var extendingAttributes = [];
 
-        $('#save-split-button .item')
-            .on('click', function(event) {
-                if ($('#new-variations-attribute-set-id').val() != '') {
-                    return; // affected attribute set was already chosen
-                }
-                var extendingAttributes = [];
-                $.each($('#configurable-attributes-container').variationsAttributes('getAttributes'), function () {
-                    if (!$('#attribute-' + this.code + '-container').length) {
-                        extendingAttributes.push(this.id);
-                    }
-                });
-                if (!extendingAttributes.length) {
-                    $('#new-variations-attribute-set-id').val($('#attribute_set_id').val());
-                    return; // all selected configurable attributes belong to current attribute set
-                }
-                if (!$('[data-role=product-variations-matrix] [data-column=entity_id]:checked')
-                    .closest('tr').has('input[name$="[name]"]').length
-                ) {
-                    return; // no new simple products to save from matrix: uniting attribute set is not needed
-                }
+        $.each($('#configurable-attributes-container').variationsAttributes('getAttributes'), function () {
+            if (!$('#attribute-' + this.code + '-container').length) {
+                extendingAttributes.push(this.id);
+            }
+        });
+        if (!extendingAttributes.length) {
+            $('#new-variations-attribute-set-id').val($('#attribute_set_id').val());
+            return; // all selected configurable attributes belong to current attribute set
+        }
+        if (!$('[data-role=product-variations-matrix] [data-column=entity_id]:checked')
+            .closest('tr').has('input[name$="[name]"]').length
+        ) {
+            return; // no new simple products to save from matrix: uniting attribute set is not needed
+        }
 
-                event.stopImmediatePropagation();
-                $form.data('target', event.target)
-                    .dialog('open');
-            });
+        event.stopImmediatePropagation();
+
+        $form.data('target', event.target)
+            .dialog('open');
     });
-});
+
+})(jQuery);
 </script>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml
index bbdc2ac7a591990b6dc765d5047577ae7cc84f3b..9c86185ef24d1c6f22cd43acaf40ef13d191d1d0 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/attribute-selector/js.phtml
@@ -25,7 +25,7 @@
 /** @var $this \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector */
 ?>
 <script type="text/javascript">
-jQuery(function($) {
+require(["jquery","mage/mage","mage/backend/suggest"], function($){
     var options = <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getSuggestWidgetOptions())?>;
     $('#configurable-attribute-selector')
         .mage('suggest', options)
@@ -42,7 +42,7 @@ jQuery(function($) {
                 if (!$('#configurable_attribute_' + item.id ).length) {
                     items.push(item);
                 }
-            })
+            });
             renderer(items);
             return false;
         })
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/stock/disabler.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/stock/disabler.phtml
index e822663a39d34cc5c5ef9578a9e925bd91807516..525f54a7e47930d0e504e2b64c8a2bcd192323ee 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/stock/disabler.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/stock/disabler.phtml
@@ -23,11 +23,11 @@
  */
 ?>
 <script type="text/javascript">
-(function($) {
+require(['jquery'], function($){
     $('[data-tab-panel=product-details]').on('stockbeforedisable', function(e) {
         if ($('[data-panel=product-variations]').is('.opened')) {
             return false;
         }
     });
-})(jQuery);
+});
 </script>
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product-variation.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product-variation.js
index cb982176324ba729d6a5611a865ab19706a4dca4..4567beab39048949a3103a0b0c6722d8ded406ed 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product-variation.js
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product-variation.js
@@ -20,7 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "js/theme"
+], function($){
+
     $.widget('mage.variationsAttributes', {
         _create: function () {
             var widgetContainer = $(this.element);
@@ -109,4 +115,5 @@
             );
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product/attribute.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product/attribute.js
index f7f8bd30e019fd5bdcc3baf5804a458501ec8b7e..5cf2f7d8042b45d41ba066f09414ce25623eb772 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product/attribute.js
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/catalog/product/attribute.js
@@ -20,9 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+	"jquery",
+	"jquery/ui",
+	"Magento_Catalog/catalog/product"
+], function($){
 
-(function ($) {
-$.widget("mage.configurableAttribute", $.mage.productAttributes, {
+    $.widget("mage.configurableAttribute", $.mage.productAttributes, {
         _prepareUrl: function() {
             var name = $('#configurable-attribute-selector').val();
             return this.options.url +
@@ -32,4 +36,5 @@ $.widget("mage.configurableAttribute", $.mage.productAttributes, {
                 window.encodeURIComponent(name);
         }
     });
-})(jQuery);
\ No newline at end of file
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js
index f880bb19deb579e482b0d1c79122c8553280df71..09aa25badbbcee6bc9527a83b7840978c4b0491a 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js
@@ -20,11 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+/**************************** CONFIGURABLE PRODUCT **************************/
+define(["prototype"], function(){
+
 if (typeof Product == 'undefined') {
-    var Product = {};
+    window.Product = {};
 }
 
-/**************************** CONFIGURABLE PRODUCT **************************/
 Product.Config = Class.create();
 Product.Config.prototype = {
     initialize: function(config){
@@ -320,3 +322,5 @@ Product.Config.prototype = {
         }
     }
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml
index bcb93b40976a1219f7ce599f45574de644554274..1e51e658aae43020d1897704e50c29e91558a0ac 100644
--- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml
+++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml
@@ -24,14 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="requirejs" before="-">
-            <arguments>
-                <argument name="file" xsi:type="string">requirejs/require.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\RequireJs\Block\Html\Head\Config" name="requirejs-config" after="requirejs"/>
-    </referenceBlock>
     <referenceBlock name="head.components">
         <block class="Magento\Framework\View\Element\Js\Components" name="configurableproduct_product_view_head_components" template="Magento_ConfigurableProduct::js/components.phtml"/>
     </referenceBlock>
diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml b/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml
index fa41f3e8f836a813742af8415855ed77f334118b..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml
@@ -22,18 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            configurable: [
-                '<?php echo $this->getViewFileUrl('jquery/jquery.parsequery.js') ?>',
-                '<?php echo $this->getViewFileUrl('Magento_ConfigurableProduct::js/configurable.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml b/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml
index a39891d52f564ed6cb9410c0764e2438eda0f9f1..e2c303962bca5944bd3afa35e12c9bdb4ed69a0f 100644
--- a/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/frontend/templates/product/view/type/options/configurable.phtml
@@ -45,8 +45,8 @@ $_attributes = $this->decorateArray($this->getAllowAttributes());
         </div>
     <?php endforeach; ?>
     <script type="text/javascript">
-        require(["jquery", "magento!Magento_ConfigurableProduct::js/configurable"], function($){
-            $('#product_addtocart_form').configurable({"spConfig":<?php echo $this->getJsonConfig() ?>});
-        })
-    </script>
+require(["jquery", "Magento_ConfigurableProduct/js/configurable"], function($){
+    $('#product_addtocart_form').configurable({"spConfig":<?php echo $this->getJsonConfig() ?>});
+});
+</script>
 <?php endif;?>
diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
index ff53bff5ebdaad7e492bd200a821a61bedb034e2..ebd1eef54a5252e7470f9632df3df06fc4154102 100644
--- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
+++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/jquery.parsequery"
+], function($){
 
-define(['jquery', 'jquery-ui', 'jquery.parsequery'], function($){
     $.widget('mage.configurable', {
         options: {
             superSelector: '.super-attribute-select',
@@ -245,7 +249,7 @@ define(['jquery', 'jquery-ui', 'jquery.parsequery'], function($){
             if (result.length !== 1) {
                 result = [baseImage];
             }
-            if (galleryElement.length && typeof galleryElement.gallery != 'undefined') {
+            if (galleryElement.length && galleryElement.data('mageGallery')) {
                 galleryElement.gallery('option', 'images', result);
             }
         },
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php
deleted file mode 100644
index 812cb85cd7315fe2542f911f53c2ea4450671545..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Extension edit page
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom;
-
-class Edit extends \Magento\Backend\Block\Widget\Form\Container
-{
-    /**
-     * Constructor
-     *
-     * Initializes edit form container, adds necessary buttons
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-        $this->_objectId = 'id';
-        $this->_blockGroup = 'Magento_Connect';
-        $this->_controller = 'adminhtml_extension_custom';
-
-        parent::_construct();
-
-        $this->buttonList->remove('back');
-        $this->buttonList->update('reset', 'onclick', "resetPackage()");
-
-        $this->buttonList->add(
-            'create',
-            array(
-                'label' => __('Save Data and Create Package'),
-                'class' => 'save',
-                'onclick' => "createPackage()",
-                'data_attribute' => array(
-                    'mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form'))
-                )
-            )
-        );
-        $this->buttonList->add(
-            'save_as',
-            array(
-                'label' => __('Save As...'),
-                'title' => __('Save package with custom package file name'),
-                'onclick' => 'saveAsPackage(event)',
-                'data_attribute' => array(
-                    'mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form'))
-                )
-            )
-        );
-    }
-
-    /**
-     * Get header of page
-     *
-     * @return string
-     */
-    public function getHeaderText()
-    {
-        return __('New Extension');
-    }
-
-    /**
-     * Get form submit URL
-     *
-     * @return string
-     */
-    public function getFormActionUrl()
-    {
-        return $this->getUrl('adminhtml/*/save');
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php
deleted file mode 100644
index 4df865ba513b3e7868cb210d5c91b5288c9faf3d..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Abstract for extension info tabs
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-use Magento\Framework\View\LayoutInterface;
-
-abstract class AbstractTab extends \Magento\Backend\Block\Widget\Form\Generic implements
-    \Magento\Backend\Block\Widget\Tab\TabInterface
-{
-    /**
-     * @var LayoutInterface[]
-     */
-    protected $_addRowButtonHtml;
-
-    /**
-     * @var LayoutInterface[]
-     */
-    protected $_removeRowButtonHtml;
-
-    /**
-     * @var LayoutInterface[]
-     */
-    protected $_addFileDepButtonHtml;
-
-    /**
-     * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Framework\Registry $registry
-     * @param \Magento\Framework\Data\FormFactory $formFactory
-     * @param \Magento\Connect\Model\Session $session
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Backend\Block\Template\Context $context,
-        \Magento\Framework\Registry $registry,
-        \Magento\Framework\Data\FormFactory $formFactory,
-        \Magento\Connect\Model\Session $session,
-        array $data = array()
-    ) {
-        parent::__construct($context, $registry, $formFactory, $data);
-        $this->setData($session->getCustomExtensionPackageFormData());
-    }
-
-    /**
-     * TODO   remove ???
-     *
-     * @return $this
-     */
-    public function initForm()
-    {
-        return $this;
-    }
-
-    /**
-     * @param string $key
-     * @param string $default
-     * @return string
-     */
-    public function getValue($key, $default = '')
-    {
-        $value = $this->getData($key);
-        return htmlspecialchars($value ? $value : $default);
-    }
-
-    /**
-     * @param string $key
-     * @param string $value
-     * @return string
-     */
-    public function getSelected($key, $value)
-    {
-        return $this->getData($key) == $value ? 'selected="selected"' : '';
-    }
-
-    /**
-     * @param string $key
-     * @return string
-     */
-    public function getChecked($key)
-    {
-        return $this->getData($key) ? 'checked="checked"' : '';
-    }
-
-    /**
-     * @param string $container
-     * @param string $template
-     * @param string $title
-     * @return LayoutInterface[]
-     */
-    public function getAddRowButtonHtml($container, $template, $title = 'Add')
-    {
-        if (!isset($this->_addRowButtonHtml[$container])) {
-            $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock(
-                'Magento\Backend\Block\Widget\Button'
-            )->setType(
-                'button'
-            )->setClass(
-                'add'
-            )->setLabel(
-                __($title)
-            )->setOnClick(
-                "addRow('" . $container . "', '" . $template . "')"
-            )->toHtml();
-        }
-        return $this->_addRowButtonHtml[$container];
-    }
-
-    /**
-     * @param string $selector
-     * @return LayoutInterface[]
-     */
-    public function getRemoveRowButtonHtml($selector = 'span')
-    {
-        if (!$this->_removeRowButtonHtml) {
-            $this->_removeRowButtonHtml = $this->getLayout()->createBlock(
-                'Magento\Backend\Block\Widget\Button'
-            )->setType(
-                'button'
-            )->setClass(
-                'delete'
-            )->setLabel(
-                __('Remove')
-            )->setOnClick(
-                "removeRow(this, '" . $selector . "')"
-            )->toHtml();
-        }
-        return $this->_removeRowButtonHtml;
-    }
-
-    /**
-     * @param string $selector
-     * @param string $filesClass
-     * @return LayoutInterface[]
-     */
-    public function getAddFileDepsRowButtonHtml($selector = 'span', $filesClass = 'files')
-    {
-        if (!$this->_addFileDepButtonHtml) {
-            $this->_addFileDepButtonHtml = $this->getLayout()->createBlock(
-                'Magento\Backend\Block\Widget\Button'
-            )->setType(
-                'button'
-            )->setClass(
-                'add'
-            )->setLabel(
-                __('Add files')
-            )->setOnClick(
-                "showHideFiles(this, '" . $selector . "', '" . $filesClass . "')"
-            )->toHtml();
-        }
-        return $this->_addFileDepButtonHtml;
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return '';
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return '';
-    }
-
-    /**
-     * @return bool
-     */
-    public function canShowTab()
-    {
-        return true;
-    }
-
-    /**
-     * @return bool
-     */
-    public function isHidden()
-    {
-        return false;
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php
deleted file mode 100644
index ab2101598e3511bbb64fd9aafcc9eecd6dd4378b..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Authors.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Block for authors
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-use Magento\Backend\Block\Widget\Form\Generic;
-
-class Authors extends \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\AbstractTab
-{
-    /**
-     * @var \Magento\Framework\Json\EncoderInterface
-     */
-    protected $_jsonEncoder;
-
-    /**
-     * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
-     * @param \Magento\Framework\Registry $registry
-     * @param \Magento\Framework\Data\FormFactory $formFactory
-     * @param \Magento\Connect\Model\Session $session
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Backend\Block\Template\Context $context,
-        \Magento\Framework\Registry $registry,
-        \Magento\Framework\Data\FormFactory $formFactory,
-        \Magento\Connect\Model\Session $session,
-        \Magento\Framework\Json\EncoderInterface $jsonEncoder,
-        array $data = array()
-    ) {
-        $this->_jsonEncoder = $jsonEncoder;
-        parent::__construct($context, $registry, $formFactory, $session, $data);
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return __('Authors');
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return __('Authors');
-    }
-
-    /**
-     * Return add author button html
-     *
-     * @return string
-     */
-    public function getAddAuthorButtonHtml()
-    {
-        return $this->getLayout()->createBlock(
-            'Magento\Backend\Block\Widget\Button'
-        )->setType(
-            'button'
-        )->setClass(
-            'add'
-        )->setLabel(
-            __('Add Author')
-        )->setOnClick(
-            'addAuthor()'
-        )->toHtml();
-    }
-
-    /**
-     * Return array of authors
-     *
-     * @return string[]
-     */
-    public function getAuthors()
-    {
-        $authors = array();
-        if ($this->getData('authors')) {
-            $temp = array();
-            foreach ($this->getData('authors') as $param => $values) {
-                if (is_array($values)) {
-                    foreach ($values as $key => $value) {
-                        $temp[$key][$param] = $value;
-                    }
-                }
-            }
-            foreach ($temp as $key => $value) {
-                $authors[$key] = $this->_jsonEncoder->encode($value);
-            }
-        }
-        return $authors;
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php
deleted file mode 100644
index 057a5302bbd15251560ff32054a886a0bb05a4dc..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Block for contents
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Contents extends \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\AbstractTab
-{
-    /**
-     * Extension factory
-     *
-     * @var \Magento\Connect\Model\ExtensionFactory
-     */
-    protected $_extensionFactory;
-
-    /**
-     * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Framework\Registry $registry
-     * @param \Magento\Framework\Data\FormFactory $formFactory
-     * @param \Magento\Connect\Model\Session $session
-     * @param \Magento\Connect\Model\ExtensionFactory $extensionFactory
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Backend\Block\Template\Context $context,
-        \Magento\Framework\Registry $registry,
-        \Magento\Framework\Data\FormFactory $formFactory,
-        \Magento\Connect\Model\Session $session,
-        \Magento\Connect\Model\ExtensionFactory $extensionFactory,
-        array $data = array()
-    ) {
-        $this->_extensionFactory = $extensionFactory;
-        parent::__construct($context, $registry, $formFactory, $session, $data);
-    }
-
-    /**
-     * Retrieve list of targets
-     *
-     * @return array
-     */
-    public function getMageTargets()
-    {
-        $targets = $this->_extensionFactory->create()->getLabelTargets();
-        if (!is_array($targets)) {
-            $targets = array();
-        }
-        return $targets;
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return __('Contents');
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return __('Contents');
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Depends.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Depends.php
deleted file mode 100644
index 132822ef24b94ebcf2cef297f7ea0bda54fcbc7a..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Depends.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Block for Dependencies
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Depends extends \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\AbstractTab
-{
-    /**
-     * Prepare Dependencies Form before rendering HTML
-     *
-     * @return $this
-     */
-    protected function _prepareForm()
-    {
-        parent::_prepareForm();
-
-        /** @var \Magento\Framework\Data\Form $form */
-        $form = $this->_formFactory->create();
-        $form->setHtmlIdPrefix('_depends');
-
-        $fieldset = $form->addFieldset('depends_php_fieldset', array('legend' => __('PHP Version')));
-
-        $fieldset->addField(
-            'depends_php_min',
-            'text',
-            array(
-                'name' => 'depends_php_min',
-                'label' => __('Minimum'),
-                'required' => true,
-                'value' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION
-            )
-        );
-
-        $fieldset->addField(
-            'depends_php_max',
-            'text',
-            array(
-                'name' => 'depends_php_max',
-                'label' => __('Maximum'),
-                'required' => true,
-                'value' => PHP_MAJOR_VERSION . '.' . (PHP_MINOR_VERSION + 1) . '.0'
-            )
-        );
-
-        $form->setValues($this->getData());
-        $this->setForm($form);
-
-        return $this;
-    }
-
-    /**
-     * Retrieve list of loaded PHP extensions
-     *
-     * @return array
-     */
-    public function getExtensions()
-    {
-        $extensions = array();
-        foreach (get_loaded_extensions() as $ext) {
-            $extensions[$ext] = $ext;
-        }
-        asort($extensions, SORT_STRING);
-        return $extensions;
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return __('Dependencies');
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return __('Dependencies');
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php
deleted file mode 100644
index 8b186bfd9ad617fd5a7381c15c67b9b41334ef74..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Grid.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Convert profile edit tab
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
-{
-    /**
-     * Extension collection factory
-     *
-     * @var \Magento\Connect\Model\Extension\CollectionFactory
-     */
-    protected $_collectionFactory;
-
-    /**
-     * @param \Magento\Backend\Block\Template\Context $context
-     * @param \Magento\Backend\Helper\Data $backendHelper
-     * @param \Magento\Connect\Model\Extension\CollectionFactory $collectionFactory
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Backend\Block\Template\Context $context,
-        \Magento\Backend\Helper\Data $backendHelper,
-        \Magento\Connect\Model\Extension\CollectionFactory $collectionFactory,
-        array $data = array()
-    ) {
-        $this->_collectionFactory = $collectionFactory;
-        parent::__construct($context, $backendHelper, $data);
-    }
-
-    /**
-     * Initialize Grid block
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-        parent::_construct();
-        $this->_defaultLimit = 200;
-        $this->setId('extension_custom_edit_grid');
-        $this->setUseAjax(true);
-    }
-
-    /**
-     * Creates extension collection if it has not been created yet
-     *
-     * @return \Magento\Connect\Model\Extension\Collection
-     */
-    public function getCollection()
-    {
-        if (!$this->_collection) {
-            $this->_collection = $this->_collectionFactory->create();
-        }
-        return $this->_collection;
-    }
-
-    /**
-     * Prepare Local Package Collection for Grid
-     *
-     * @return \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Grid
-     */
-    protected function _prepareCollection()
-    {
-        $this->setCollection($this->getCollection());
-        return parent::_prepareCollection();
-    }
-
-    /**
-     * Prepare grid columns
-     *
-     * @return $this
-     */
-    protected function _prepareColumns()
-    {
-        $this->addColumn(
-            'folder',
-            array(
-                'header' => __('Folder'),
-                'index' => 'folder',
-                'width' => 100,
-                'type' => 'options',
-                'options' => $this->getCollection()->collectFolders()
-            )
-        );
-
-        $this->addColumn('package', array('header' => __('Package'), 'index' => 'package'));
-
-        return parent::_prepareColumns();
-    }
-
-    /**
-     * Self URL getter
-     *
-     * @param array $params
-     * @return string
-     */
-    public function getCurrentUrl($params = array())
-    {
-        if (!isset($params['_current'])) {
-            $params['_current'] = true;
-        }
-        return $this->getUrl('adminhtml/*/grid', $params);
-    }
-
-    /**
-     * Row URL getter
-     *
-     * @param string $row
-     * @return string
-     */
-    public function getRowUrl($row)
-    {
-        return $this->getUrl(
-            'adminhtml/*/load',
-            array('id' => strtr(base64_encode($row->getFilenameId()), '+/=', '-_,'))
-        );
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Local.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Local.php
deleted file mode 100644
index 8bf5148f2963b96e020b327bb93de5d8ff0a55a0..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Local.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Magento Connect View Local extensions Tab block
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Local extends \Magento\Backend\Block\Template implements \Magento\Backend\Block\Widget\Tab\TabInterface
-{
-    /**
-     * Retrieve Tab load URL
-     *
-     * @return  string
-     */
-    public function getTabUrl()
-    {
-        return $this->getUrl('adminhtml/*/loadtab', array('_current' => true));
-    }
-
-    /**
-     * Retrieve class for load by ajax
-     *
-     * @return string
-     */
-    public function getTabClass()
-    {
-        return 'ajax';
-    }
-
-    /**
-     * Retrieve class for load by ajax
-     *
-     * @return string
-     */
-    public function getClass()
-    {
-        return 'ajax';
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return __('Load Local Package');
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return __('Load Local Package');
-    }
-
-    /**
-     * Is can show tab
-     *
-     * @return bool
-     */
-    public function canShowTab()
-    {
-        return true;
-    }
-
-    /**
-     * Is hidden tab
-     *
-     * @return bool
-     */
-    public function isHidden()
-    {
-        return false;
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Package.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Package.php
deleted file mode 100644
index d1914cb9206faad818b38b408b43f77377eb496d..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Package.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class block for package
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Package extends \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\AbstractTab
-{
-    /**
-     * Prepare Package Info Form before rendering HTML
-     *
-     * @return \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Package
-     */
-    protected function _prepareForm()
-    {
-        parent::_prepareForm();
-
-        /** @var \Magento\Framework\Data\Form $form */
-        $form = $this->_formFactory->create();
-        $form->setHtmlIdPrefix('_package');
-
-        $fieldset = $form->addFieldset('package_fieldset', array('legend' => __('Package')));
-
-        if ($this->getData('name') != $this->getData('file_name')) {
-            $this->setData('file_name_disabled', $this->getData('file_name'));
-            $fieldset->addField(
-                'file_name_disabled',
-                'text',
-                array('name' => 'file_name_disabled', 'label' => __('Package File Name'), 'disabled' => 'disabled')
-            );
-        }
-
-        $fieldset->addField('file_name', 'hidden', array('name' => 'file_name'));
-
-        $fieldset->addField('name', 'text', array('name' => 'name', 'label' => __('Name'), 'required' => true));
-
-        $fieldset->addField(
-            'channel',
-            'text',
-            array('name' => 'channel', 'label' => __('Channel'), 'required' => true)
-        );
-
-        $versionsInfo = array(
-            array('label' => __('1.5.0.0 & later'), 'value' => \Magento\Framework\Connect\Package::PACKAGE_VERSION_2X),
-            array('label' => __('Pre-1.5.0.0'), 'value' => \Magento\Framework\Connect\Package::PACKAGE_VERSION_1X)
-        );
-        $fieldset->addField(
-            'version_ids',
-            'multiselect',
-            array(
-                'name' => 'version_ids',
-                'required' => true,
-                'label' => __('Supported releases'),
-                'style' => 'height: 45px;',
-                'values' => $versionsInfo
-            )
-        );
-
-        $fieldset->addField(
-            'summary',
-            'textarea',
-            array('name' => 'summary', 'label' => __('Summary'), 'style' => 'height:50px;', 'required' => true)
-        );
-
-        $fieldset->addField(
-            'description',
-            'textarea',
-            array(
-                'name' => 'description',
-                'label' => __('Description'),
-                'style' => 'height:200px;',
-                'required' => true
-            )
-        );
-
-        $fieldset->addField(
-            'license',
-            'text',
-            array(
-                'name' => 'license',
-                'label' => __('License'),
-                'required' => true,
-                'value' => 'Open Software License (OSL 3.0)'
-            )
-        );
-
-        $fieldset->addField(
-            'license_uri',
-            'text',
-            array(
-                'name' => 'license_uri',
-                'label' => __('License URI'),
-                'value' => 'http://opensource.org/licenses/osl-3.0.php'
-            )
-        );
-
-        $form->setValues($this->getData());
-        $this->setForm($form);
-
-        return $this;
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return __('Package Info');
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return __('Package Info');
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Release.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Release.php
deleted file mode 100644
index 7eb1f22b12535cb284c846a8a41c8e90fc9d5843..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Release.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Block for release info
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Release extends \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\AbstractTab
-{
-    /**
-     * Prepare Release Info Form before rendering HTML
-     *
-     * @return \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Release
-     */
-    protected function _prepareForm()
-    {
-        parent::_prepareForm();
-
-        /** @var \Magento\Framework\Data\Form $form */
-        $form = $this->_formFactory->create();
-        $form->setHtmlIdPrefix('_release');
-
-        $fieldset = $form->addFieldset('release_fieldset', array('legend' => __('Release')));
-
-        $fieldset->addField(
-            'version',
-            'text',
-            array('name' => 'version', 'label' => __('Release Version'), 'required' => true)
-        );
-
-        $fieldset->addField(
-            'stability',
-            'select',
-            array(
-                'name' => 'stability',
-                'label' => __('Release Stability'),
-                'options' => array(
-                    'devel' => 'Development',
-                    'alpha' => 'Alpha',
-                    'beta' => 'Beta',
-                    'stable' => 'Stable'
-                )
-            )
-        );
-
-        $fieldset->addField(
-            'notes',
-            'textarea',
-            array('name' => 'notes', 'label' => __('Notes'), 'style' => 'height:300px;', 'required' => true)
-        );
-
-        $form->setValues($this->getData());
-        $this->setForm($form);
-
-        return $this;
-    }
-
-    /**
-     * Get Tab Label
-     *
-     * @return string
-     */
-    public function getTabLabel()
-    {
-        return __('Release Info');
-    }
-
-    /**
-     * Get Tab Title
-     *
-     * @return string
-     */
-    public function getTabTitle()
-    {
-        return __('Release Info');
-    }
-}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php
deleted file mode 100644
index 03a90ec7c1bdc00367a22004e7c5305822d394b5..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tabs.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit;
-
-/**
- * Block for tabs in extension info
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Tabs extends \Magento\Backend\Block\Widget\Tabs
-{
-    /**
-     * Constructor
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-        parent::_construct();
-        $this->setId('connect_extension_edit_tabs');
-        $this->setDestElementId('edit_form');
-        $this->setTitle(__('Create Extension Package'));
-    }
-
-    /**
-     * Set tabs
-     *
-     * @return \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tabs
-     */
-    protected function _beforeToHtml()
-    {
-        //        $this->addTab('package', array(
-        //            'label'     => __('Package Info'),
-        //            'content'   => $this->_getTabHtml('package'),
-        //            'active'    => true,
-        //        ));
-        //
-        //        $this->addTab('release', array(
-        //            'label'     => __('Release Info'),
-        //            'content'   => $this->_getTabHtml('release'),
-        //        ));
-        //
-        //        $this->addTab('maintainers', array(
-        //            'label'     => __('Authors'),
-        //            'content'   => $this->_getTabHtml('authors'),
-        //        ));
-        //
-        //        $this->addTab('depends', array(
-        //            'label'     => __('Dependencies'),
-        //            'content'   => $this->_getTabHtml('depends'),
-        //        ));
-        //
-        //        $this->addTab('contents', array(
-        //            'label'     => __('Contents'),
-        //            'content'   => $this->_getTabHtml('contents'),
-        //        ));
-        //
-        //        $this->addTab('load', array(
-        //            'label'     => __('Load local Package'),
-        //            'class'     => 'ajax',
-        //            'url'       => $this->getUrl('adminhtml/*/loadtab', array('_current' => true)),
-        //        ));
-
-        return parent::_beforeToHtml();
-    }
-
-    /**
-     * Retrieve HTML for tab
-     *
-     * @param string $tab
-     * @return string
-     */
-    protected function _getTabHtml($tab)
-    {
-        //        $classNameParts = explode('_', $tab);
-        //        foreach ($classNameParts as $key => $part) {
-        //            $classNameParts[$key] = ucfirst($part);
-        //        }
-        //        return $this->getLayout()
-        //            ->createBlock('Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\\' . implode('_', $classNameParts))
-        //            ->initForm()
-        //            ->toHtml();
-    }
-}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Create.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Create.php
deleted file mode 100644
index fd62813b0b64410dc40dfdd3ec40c7d5ff4b6852..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Create.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/**
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
-
-class Create extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
-{
-    /**
-     * Create new Extension Package
-     *
-     * @return void
-     */
-    public function execute()
-    {
-        $session = $this->_objectManager->get('Magento\Connect\Model\Session');
-        try {
-            $post = $this->getRequest()->getPost();
-            $session->setCustomExtensionPackageFormData($post);
-            $ext = $this->_objectManager->create('Magento\Connect\Model\Extension');
-            $ext->setData($post);
-            $packageVersion = $this->getRequest()->getPost('version_ids');
-            if (is_array($packageVersion)) {
-                if (in_array(\Magento\Framework\Connect\Package::PACKAGE_VERSION_2X, $packageVersion)) {
-                    $ext->createPackage();
-                }
-                if (in_array(\Magento\Framework\Connect\Package::PACKAGE_VERSION_1X, $packageVersion)) {
-                    $ext->createPackageV1x();
-                }
-            }
-            $this->_redirect('adminhtml/*');
-        } catch (\Magento\Framework\Model\Exception $e) {
-            $this->messageManager->addError($e->getMessage());
-            $this->_redirect('adminhtml/*');
-        } catch (\Exception $e) {
-            $this->messageManager->addException($e, __('Something went wrong creating the package.'));
-            $this->_redirect('adminhtml/*');
-        }
-    }
-}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Load.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Load.php
deleted file mode 100644
index 0626253f323907610be22a8cd09233c8c3818c91..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Load.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
-
-class Load extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
-{
-    /**
-     * Load Local Extension Package
-     *
-     * @return void
-     */
-    public function execute()
-    {
-        $packageName = base64_decode(strtr($this->getRequest()->getParam('id'), '-_,', '+/='));
-        if ($packageName) {
-            $session = $this->_objectManager->get('Magento\Connect\Model\Session');
-            try {
-                $data = $this->_objectManager->get('Magento\Connect\Helper\Data')->loadLocalPackage($packageName);
-                if (!$data) {
-                    throw new \Magento\Framework\Model\Exception(__('Something went wrong loading the package data.'));
-                }
-                $data = array_merge($data, array('file_name' => $packageName));
-                $session->setCustomExtensionPackageFormData($data);
-                $this->messageManager->addSuccess(__('The package %1 data has been loaded.', $packageName));
-            } catch (\Exception $e) {
-                $this->messageManager->addError($e->getMessage());
-            }
-        }
-        $this->_redirect('adminhtml/*/edit');
-    }
-}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Reset.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Reset.php
deleted file mode 100644
index 538d7b5d73c28fd6ea48a141810b8e1b0931f3d6..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Reset.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
-
-class Reset extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
-{
-    /**
-     * Reset Extension Package form data
-     *
-     * @return void
-     */
-    public function execute()
-    {
-        $this->_objectManager->get('Magento\Connect\Model\Session')->unsCustomExtensionPackageFormData();
-        $this->_redirect('adminhtml/*/edit');
-    }
-}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Save.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Save.php
deleted file mode 100644
index b10b82c40a8c4b59f96dac0f1a65096b01db99a3..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Save.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
-
-class Save extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
-{
-    /**
-     * Save Extension Package
-     *
-     * @return void
-     */
-    public function execute()
-    {
-        $session = $this->_objectManager->get('Magento\Connect\Model\Session');
-        $p = $this->getRequest()->getPost();
-
-        if (!empty($p['_create'])) {
-            $create = true;
-            unset($p['_create']);
-        }
-
-        if ($p['file_name'] == '') {
-            $p['file_name'] = $p['name'];
-        }
-
-        $session->setCustomExtensionPackageFormData($p);
-        try {
-            $ext = $this->_objectManager->create('Magento\Connect\Model\Extension');
-            /** @var $ext \Magento\Connect\Model\Extension */
-            $ext->setData($p);
-            if ($ext->savePackage()) {
-                $this->messageManager->addSuccess(__('The package data has been saved.'));
-            } else {
-                $this->messageManager->addError(__('Something went wrong saving the package data.'));
-                $this->_redirect('adminhtml/*/edit');
-            }
-            if (empty($create)) {
-                $this->_redirect('adminhtml/*/edit');
-            } else {
-                $this->_forward('create');
-            }
-        } catch (\Magento\Framework\Model\Exception $e) {
-            $this->messageManager->addError($e->getMessage());
-            $this->_redirect('adminhtml/*');
-        } catch (\Exception $e) {
-            $this->messageManager->addException($e, __('Something went wrong saving the package.'));
-            $this->_redirect('adminhtml/*');
-        }
-    }
-}
diff --git a/app/code/Magento/Connect/Helper/Data.php b/app/code/Magento/Connect/Helper/Data.php
deleted file mode 100644
index 21b1d60a3a2adda0c29c36ddde8cd04a04b345e9..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Helper/Data.php
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Helper;
-
-/**
- * Default helper of the module
- */
-class Data extends \Magento\Core\Helper\Data
-{
-    /**
-     * @var \Magento\Framework\App\Filesystem
-     */
-    protected $filesystem;
-
-    /**
-     * @var \Magento\Framework\Convert\Xml
-     */
-    protected $_xmlConverter;
-
-    /**
-     * @var \Magento\Framework\Filesystem\Directory\Read
-     */
-    protected $readDirectory;
-
-    /**
-     * @param \Magento\Framework\App\Helper\Context $context
-     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
-     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
-     * @param \Magento\Framework\App\State $appState
-     * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
-     * @param \Magento\Framework\App\Filesystem $filesystem
-     * @param \Magento\Framework\Convert\Xml $xmlConverter
-     * @param bool $dbCompatibleMode
-     */
-    public function __construct(
-        \Magento\Framework\App\Helper\Context $context,
-        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
-        \Magento\Store\Model\StoreManagerInterface $storeManager,
-        \Magento\Framework\App\State $appState,
-        \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
-        \Magento\Framework\App\Filesystem $filesystem,
-        \Magento\Framework\Convert\Xml $xmlConverter,
-        $dbCompatibleMode = true
-    ) {
-        $this->filesystem = $filesystem;
-        $this->readDirectory = $this->filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem::VAR_DIR);
-        $this->_xmlConverter = $xmlConverter;
-        parent::__construct(
-            $context,
-            $scopeConfig,
-            $storeManager,
-            $appState,
-            $priceCurrency,
-            $dbCompatibleMode
-        );
-    }
-
-    /**
-     * Retrieve a map to convert a channel from previous version of Magento Connect Manager
-     *
-     * @return array
-     */
-    public function getChannelMapFromV1x()
-    {
-        return array(
-            'connect.magentocommerce.com/community' => 'community',
-            'connect.magentocommerce.com/core' => 'community'
-        );
-    }
-
-    /**
-     * Retrieve a map to convert a channel to previous version of Magento Connect Manager
-     *
-     * @return array
-     */
-    public function getChannelMapToV1x()
-    {
-        return array('community' => 'connect.magentocommerce.com/community');
-    }
-
-    /**
-     * Convert package channel in order for it to be compatible with current version of Magento Connect Manager
-     *
-     * @param string $channel
-     *
-     * @return string
-     */
-    public function convertChannelFromV1x($channel)
-    {
-        $channelMap = $this->getChannelMapFromV1x();
-        if (isset($channelMap[$channel])) {
-            $channel = $channelMap[$channel];
-        }
-        return $channel;
-    }
-
-    /**
-     * Convert package channel in order for it to be compatible with previous version of Magento Connect Manager
-     *
-     * @param string $channel
-     *
-     * @return string
-     */
-    public function convertChannelToV1x($channel)
-    {
-        $channelMap = $this->getChannelMapToV1x();
-        if (isset($channelMap[$channel])) {
-            $channel = $channelMap[$channel];
-        }
-        return $channel;
-    }
-
-    /**
-     * Load local package data array
-     *
-     * @param string $packageName without extension
-     * @return array|boolean
-     */
-    public function loadLocalPackage($packageName)
-    {
-        $xmlFile = sprintf('connect/%.xml', $packageName);
-        $serFile = sprintf('connect/%.ser', $packageName);
-        if ($this->readDirectory->isFile($xmlFile) && $this->readDirectory->isReadable($xmlFile)) {
-            $xml = simplexml_load_string($this->readDirectory->readFile($xmlFile));
-            $data = $this->_xmlConverter->xmlToAssoc($xml);
-            if (!empty($data)) {
-                return $data;
-            }
-        }
-        if ($this->readDirectory->isFile($serFile) && $this->readDirectory->isReadable($xmlFile)) {
-            $data = unserialize($this->readDirectory->readFile($serFile));
-            if (!empty($data)) {
-                return $data;
-            }
-        }
-        return false;
-    }
-}
diff --git a/app/code/Magento/Connect/Model/Extension.php b/app/code/Magento/Connect/Model/Extension.php
deleted file mode 100644
index b8cae0028df9a42c7fd07e5ce87d4a7ce618d524..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Model/Extension.php
+++ /dev/null
@@ -1,388 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Model;
-
-/**
- * Extension model
- */
-class Extension extends \Magento\Framework\Object
-{
-    /**
-     * Cache for targets
-     *
-     * @var array
-     */
-    protected $_targets;
-
-    /**
-     * Internal cache for package
-     *
-     * @var \Magento\Framework\Connect\Package
-     */
-    protected $_package;
-
-    /**
-     * @var \Magento\Framework\App\Filesystem $filesystem
-     */
-    protected $filesystem;
-
-    /**
-     * @var \Magento\Framework\Convert\ConvertArray
-     */
-    protected $_convertArray;
-
-    /**
-     * Session
-     *
-     * @var \Magento\Connect\Model\Session
-     */
-    protected $_session;
-
-    /**
-     * @var \Magento\Framework\Filesystem\Directory\Write
-     */
-    protected $writeDirectory;
-
-    /**
-     * @var \Magento\Framework\Logger
-     */
-    protected $logger;
-
-    /**
-     * Constructor
-     *
-     * @param \Magento\Framework\Convert\ConvertArray $convertArray
-     * @param \Magento\Framework\App\Filesystem           $filesystem
-     * @param Session                       $session
-     * @param \Magento\Framework\Logger               $logger
-     * @param array                         $data
-     */
-    public function __construct(
-        \Magento\Framework\Convert\ConvertArray $convertArray,
-        \Magento\Framework\App\Filesystem $filesystem,
-        \Magento\Connect\Model\Session $session,
-        \Magento\Framework\Logger $logger,
-        array $data = array()
-    ) {
-        $this->_convertArray = $convertArray;
-        $this->_session = $session;
-        $this->filesystem = $filesystem;
-        $this->writeDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem::VAR_DIR);
-        $this->logger = $logger;
-        parent::__construct($data);
-    }
-
-    /**
-     * Return package object
-     *
-     * @return \Magento\Framework\Connect\Package
-     */
-    protected function getPackage()
-    {
-        if (!$this->_package instanceof \Magento\Framework\Connect\Package) {
-            $this->_package = new \Magento\Framework\Connect\Package();
-        }
-        return $this->_package;
-    }
-
-    /**
-     * Set package object
-     *
-     * @return $this
-     * @throws \Magento\Framework\Model\Exception
-     */
-    public function generatePackageXml()
-    {
-        $this->_session->setLocalExtensionPackageFormData($this->getData());
-
-        $this->_setPackage()->_setRelease()->_setAuthors()->_setDependencies()->_setContents();
-        if (!$this->getPackage()->validate()) {
-            $message = $this->getPackage()->getErrors();
-            throw new \Magento\Framework\Model\Exception(__($message[0]));
-        }
-        $this->setPackageXml($this->getPackage()->getPackageXml());
-        return $this;
-    }
-
-    /**
-     * Set general information.
-     *
-     * @return $this
-     */
-    protected function _setPackage()
-    {
-        $this->getPackage()->setName(
-            $this->getData('name')
-        )->setChannel(
-            $this->getData('channel')
-        )->setLicense(
-            $this->getData('license'),
-            $this->getData('license_uri')
-        )->setSummary(
-            $this->getData('summary')
-        )->setDescription(
-            $this->getData('description')
-        );
-        return $this;
-    }
-
-    /**
-     * Set release information
-     *
-     * @return $this
-     */
-    protected function _setRelease()
-    {
-        $this->getPackage()->setDate(
-            date('Y-m-d')
-        )->setTime(
-            date('H:i:s')
-        )->setVersion(
-            $this->getData('version') ? $this->getData('version') : $this->getData('release_version')
-        )->setStability(
-            $this->getData('stability')
-        )->setNotes(
-            $this->getData('notes')
-        );
-        return $this;
-    }
-
-    /**
-     * Set authors
-     *
-     * @return $this
-     */
-    protected function _setAuthors()
-    {
-        $authors = $this->getData('authors');
-        foreach ($authors['name'] as $i => $name) {
-            $user = $authors['user'][$i];
-            $email = $authors['email'][$i];
-            $this->getPackage()->addAuthor($name, $user, $email);
-        }
-        return $this;
-    }
-
-    /**
-     * @param string $filesString
-     * @return array
-     */
-    protected function packageFilesToArray($filesString)
-    {
-        $packageFiles = array();
-        if ($filesString) {
-            $filesArray = preg_split("/[\n\r]+/", $filesString);
-            foreach ($filesArray as $file) {
-                $file = trim($file, "/");
-                $res = explode('/', $file, 2);
-                array_map('trim', $res);
-                if (2 == count($res)) {
-                    $packageFiles[] = array('target' => $res[0], 'path' => $res[1]);
-                }
-            }
-        }
-        return $packageFiles;
-    }
-
-    /**
-     * Set php, php extensions, another packages dependencies
-     *
-     * @return $this
-     */
-    protected function _setDependencies()
-    {
-        $this->getPackage()->clearDependencies()->setDependencyPhpVersion(
-            $this->getData('depends_php_min'),
-            $this->getData('depends_php_max')
-        );
-
-        foreach ($this->getData('depends') as $depType => $deps) {
-            foreach (array_keys($deps['name']) as $key) {
-                if (0 === $key) {
-                    continue;
-                }
-                $name = $deps['name'][$key];
-                $min = !empty($deps['min'][$key]) ? $deps['min'][$key] : false;
-                $max = !empty($deps['max'][$key]) ? $deps['max'][$key] : false;
-
-                $files = !empty($deps['files'][$key]) ? $deps['files'][$key] : false;
-                $packageFiles = $this->packageFilesToArray($files);
-
-                if ($depType !== 'extension') {
-                    $channel = !empty($deps['channel'][$key]) ? $deps['channel'][$key] : 'connect.magentocommerce.com/core';
-                }
-                switch ($depType) {
-                    case 'package':
-                        $this->getPackage()->addDependencyPackage($name, $channel, $min, $max, $packageFiles);
-                        break;
-                    case 'extension':
-                        $this->getPackage()->addDependencyExtension($name, $min, $max);
-                        break;
-                    default:
-                        break;
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Set contents. Add file or entire directory.
-     *
-     * @return $this
-     */
-    protected function _setContents()
-    {
-        $this->getPackage()->clearContents();
-        $contents = $this->getData('contents');
-        foreach ($contents['target'] as $i => $target) {
-            if (0 === $i) {
-                continue;
-            }
-            switch ($contents['type'][$i]) {
-                case 'file':
-                    $this->getPackage()->addContent($contents['path'][$i], $contents['target'][$i]);
-                    break;
-                case 'dir':
-                    $target = $contents['target'][$i];
-                    $path = $contents['path'][$i];
-                    $include = $contents['include'][$i];
-                    $ignore = $contents['ignore'][$i];
-                    $this->getPackage()->addContentDir($target, $path, $ignore, $include);
-                    break;
-                default:
-                    break;
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Save package file to var/connect.
-     *
-     * @return boolean
-     */
-    public function savePackage()
-    {
-        if ($this->getData('file_name') != '') {
-            $fileName = $this->getData('file_name');
-            $this->unsetData('file_name');
-        } else {
-            $fileName = $this->getName();
-        }
-
-        if (!preg_match('/^[a-z0-9]+[a-z0-9\-\_\.]*([\/\\\\]{1}[a-z0-9]+[a-z0-9\-\_\.]*)*$/i', $fileName)) {
-            return false;
-        }
-
-        if (!$this->getPackageXml()) {
-            $this->generatePackageXml();
-        }
-
-        if (!$this->getPackageXml()) {
-            return false;
-        }
-
-        try {
-            //            $path = $this->writeDirectory->getAbsolutePath();
-            $this->writeDirectory->writeFile(sprintf('connect/%s', 'package.xml'), $this->getPackageXml());
-            $this->unsPackageXml();
-            $this->unsTargets();
-            $xml = $this->_convertArray->assocToXml($this->getData());
-            $xml = new \Magento\Framework\Simplexml\Element($xml->asXML());
-
-            // prepare dir to save
-            $parts = explode('/', $fileName);
-            array_pop($parts);
-            $directoryPath = implode('/', $parts);
-
-            if (!empty($directoryPath)) {
-                $this->writeDirectory->create(sprintf('connect/%s', $directoryPath));
-            }
-            $this->writeDirectory->writeFile(sprintf('connect/%s.xml', $fileName), $xml->asNiceXml());
-        } catch (\Magento\Framework\Filesystem\FilesystemException $e) {
-            $this->logger->addStreamLog(\Magento\Framework\Logger::LOGGER_EXCEPTION);
-            $this->logger->log($e->getMessage());
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Create package file
-     *
-     * @return boolean
-     */
-    public function createPackage()
-    {
-        try {
-            $this->writeDirectory->create('connect/');
-        } catch (\Magento\Framework\Filesystem\FilesystemException $e) {
-            $this->logger->addStreamLog(\Magento\Framework\Logger::LOGGER_EXCEPTION);
-            $this->logger->log($e->getMessage());
-            return false;
-        }
-        if (!$this->getPackageXml()) {
-            $this->generatePackageXml();
-        }
-        $this->getPackage()->save($this->writeDirectory->getAbsolutePath('connect/'));
-        return true;
-    }
-
-    /**
-     * Create package file compatible with previous version of Magento Connect Manager
-     *
-     * @return boolean
-     */
-    public function createPackageV1x()
-    {
-        try {
-            $this->writeDirectory->create('pear/');
-        } catch (\Magento\Framework\Filesystem\FilesystemException $e) {
-            $this->logger->addStreamLog(\Magento\Framework\Logger::LOGGER_EXCEPTION);
-            $this->logger->log($e->getMessage());
-            return false;
-        }
-
-        if (!$this->getPackageXml()) {
-            $this->generatePackageXml();
-        }
-        $this->getPackage()->saveV1x($this->writeDirectory->getAbsolutePath('pear/'));
-        return true;
-    }
-
-    /**
-     * Retrieve targets
-     *
-     * @return array
-     */
-    public function getLabelTargets()
-    {
-        if (!is_array($this->_targets)) {
-            $objectTarget = new \Magento\Framework\Connect\Package\Target();
-            $this->_targets = $objectTarget->getLabelTargets();
-        }
-        return $this->_targets;
-    }
-}
diff --git a/app/code/Magento/Connect/Model/Extension/Collection.php b/app/code/Magento/Connect/Model/Extension/Collection.php
deleted file mode 100644
index 8e2c3640ea3591ca1d502af149cfa58b9e272fa5..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Model/Extension/Collection.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Model\Extension;
-
-/**
- * Extension packages files collection
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Collection extends \Magento\Framework\Data\Collection\Filesystem
-{
-    /**
-     * Files and folders regexsp
-     *
-     * @var string
-     */
-    protected $_allowedDirsMask = '/^[a-z0-9\.\-]+$/i';
-
-    /**
-     * @var string
-     */
-    protected $_allowedFilesMask = '/^[a-z0-9\.\-\_]+\.(xml|ser)$/i';
-
-    /**
-     * @var string
-     */
-    protected $_disallowedFilesMask = '/^package\.xml$/i';
-
-    /**
-     * @var \Magento\Framework\App\Filesystem
-     */
-    protected $filesystem;
-
-    /**
-     * @var \Magento\Framework\Filesystem\Directory\Write
-     */
-    protected $connectDirectory;
-
-    /**
-     * Set base dir
-     *
-     * @param \Magento\Core\Model\EntityFactory $entityFactory
-     * @param \Magento\Framework\App\Filesystem $filesystem
-     */
-    public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\Framework\App\Filesystem $filesystem)
-    {
-        parent::__construct($entityFactory);
-        $this->filesystem = $filesystem;
-        $this->connectDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem::VAR_DIR);
-        $this->connectDirectory->create('connect');
-        $this->addTargetDir($this->connectDirectory->getAbsolutePath('connect'));
-    }
-
-    /**
-     * Row generator
-     *
-     * @param string $filename
-     * @return array
-     */
-    protected function _generateRow($filename)
-    {
-        $row = parent::_generateRow($filename);
-        $row['package'] = preg_replace(
-            '/\.(xml|ser)$/',
-            '',
-            str_replace($this->connectDirectory->getAbsolutePath('connect/'), '', $filename)
-        );
-        $row['filename_id'] = $row['package'];
-        $folder = explode('/', $row['package']);
-        array_pop($folder);
-        $row['folder'] = '/';
-        if (!empty($folder)) {
-            $row['folder'] = implode('/', $folder) . '/';
-        }
-        return $row;
-    }
-
-    /**
-     * Get all folders as options array
-     *
-     * @return array
-     */
-    public function collectFolders()
-    {
-        $collectFiles = $this->_collectFiles;
-        $collectDirs = $this->_collectDirs;
-        $this->setCollectFiles(false)->setCollectDirs(true);
-
-        $this->_collectRecursive($this->connectDirectory->getAbsolutePath('connect'));
-        $result = array('/' => '/');
-        foreach ($this->_collectedDirs as $dir) {
-            $dir = substr($this->connectDirectory->getRelativePath($dir), strlen('connect/')) . '/';
-            $result[$dir] = $dir;
-        }
-
-        $this->setCollectFiles($collectFiles)->setCollectDirs($collectDirs);
-        return $result;
-    }
-}
diff --git a/app/code/Magento/Connect/Model/Session.php b/app/code/Magento/Connect/Model/Session.php
deleted file mode 100644
index 76f0baed01a40a1c320d5a6e1cd8835f11966a2f..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/Model/Session.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Model;
-
-/**
- * Auth session model
- */
-class Session extends \Magento\Framework\Session\SessionManager
-{
-    /**
-     * Connect data
-     *
-     * @var \Magento\Connect\Helper\Data
-     */
-    protected $_connectData;
-
-    /**
-     * @param \Magento\Framework\App\Request\Http $request
-     * @param \Magento\Framework\Session\SidResolverInterface $sidResolver
-     * @param \Magento\Framework\Session\Config\ConfigInterface $sessionConfig
-     * @param \Magento\Framework\Session\SaveHandlerInterface $saveHandler
-     * @param \Magento\Framework\Session\ValidatorInterface $validator
-     * @param \Magento\Framework\Session\StorageInterface $storage
-     * @param \Magento\Connect\Helper\Data $connectData
-     */
-    public function __construct(
-        \Magento\Framework\App\Request\Http $request,
-        \Magento\Framework\Session\SidResolverInterface $sidResolver,
-        \Magento\Framework\Session\Config\ConfigInterface $sessionConfig,
-        \Magento\Framework\Session\SaveHandlerInterface $saveHandler,
-        \Magento\Framework\Session\ValidatorInterface $validator,
-        \Magento\Framework\Session\StorageInterface $storage,
-        \Magento\Connect\Helper\Data $connectData
-    ) {
-        $this->_connectData = $connectData;
-        parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage);
-        $this->start();
-    }
-
-    /**
-     * Retrieve parameters of extension from session.
-     * Compatible with old version extension info file.
-     *
-     * @return array
-     */
-    public function getCustomExtensionPackageFormData()
-    {
-        $data = $this->getData('custom_extension_package_form_data');
-        /* convert Maintainers to Authors */
-        if (!isset($data['authors']) || count($data['authors']) == 0) {
-            if (isset($data['maintainers'])) {
-                $data['authors']['name'] = array();
-                $data['authors']['user'] = array();
-                $data['authors']['email'] = array();
-                foreach ($data['maintainers']['name'] as $i => $name) {
-                    if (!$data['maintainers']['name'][$i] &&
-                        !$data['maintainers']['handle'][$i] &&
-                        !$data['maintainers']['email'][$i]
-                    ) {
-                        continue;
-                    }
-                    $data['authors']['name'][] = $data['maintainers']['name'][$i];
-                    $data['authors']['user'][] = $data['maintainers']['handle'][$i];
-                    $data['authors']['email'][] = $data['maintainers']['email'][$i];
-                }
-                // Convert channel from previous version for entire package
-                $helper = $this->_connectData;
-                if (isset($data['channel'])) {
-                    $data['channel'] = $helper->convertChannelFromV1x($data['channel']);
-                }
-                // Convert channel from previous version for each required package
-                $nRequiredPackages = count($data['depends']['package']['channel']);
-                for ($i = 0; $i < $nRequiredPackages; $i++) {
-                    $channel = $data['depends']['package']['channel'][$i];
-                    if ($channel) {
-                        $data['depends']['package']['channel'][$i] = $helper->convertChannelFromV1x($channel);
-                    }
-                }
-            }
-        }
-
-        /* convert Release version to Version */
-        if (!isset($data['version'])) {
-            if (isset($data['release_version'])) {
-                $data['version'] = $data['release_version'];
-            }
-        }
-        /* convert Release stability to Stability */
-        if (!isset($data['stability'])) {
-            if (isset($data['release_stability'])) {
-                $data['stability'] = $data['release_stability'];
-            }
-        }
-        /* convert contents */
-        if (!isset($data['contents']['target'])) {
-            $data['contents']['target'] = $data['contents']['role'];
-        }
-        return $data;
-    }
-}
diff --git a/app/code/Magento/Connect/etc/adminhtml/menu.xml b/app/code/Magento/Connect/etc/adminhtml/menu.xml
deleted file mode 100644
index dcb7ba3524a6a105a2168d8d5738926dfa0fc498..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/etc/adminhtml/menu.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">
-    <menu>
-        <add id="Magento_Connect::system_extensions" title="Magento Connect" module="Magento_Connect" sortOrder="20" parent="Magento_Backend::system" resource="Magento_Adminhtml::extensions"/>
-        <add id="Magento_Connect::system_extensions_local" title="Connect Manager" module="Magento_Connect" sortOrder="10" parent="Magento_Connect::system_extensions" action="adminhtml/extension_local" resource="Magento_Adminhtml::local"/>
-        <add id="Magento_Connect::system_extensions_custom" title="Package Extensions" module="Magento_Connect" sortOrder="20" parent="Magento_Connect::system_extensions" action="adminhtml/extension_custom" resource="Magento_Adminhtml::custom"/>
-    </menu>
-</config>
diff --git a/app/code/Magento/Connect/etc/di.xml b/app/code/Magento/Connect/etc/di.xml
deleted file mode 100644
index 0d0897fee963d9962e46148259c605439acc03d4..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/etc/di.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
-    <virtualType name="Magento\Connect\Model\Session\Storage" type="Magento\Framework\Session\Storage">
-        <arguments>
-            <argument name="namespace" xsi:type="string">adminhtml</argument>
-        </arguments>
-    </virtualType>
-    <type name="Magento\Connect\Model\Session">
-        <arguments>
-            <argument name="storage" xsi:type="object">Magento\Connect\Model\Session\Storage</argument>
-        </arguments>
-    </type>
-</config>
diff --git a/app/code/Magento/Connect/etc/module.xml b/app/code/Magento/Connect/etc/module.xml
deleted file mode 100644
index 8930208afa6c36eea3620f5ab2501f2ff7824f88..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/etc/module.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Connect" schema_version="1.6.0.0" active="true">
-        <depends>
-            <module name="Magento_Store"/>
-            <module name="Magento_Core"/>
-            <module name="Magento_Backend"/>
-        </depends>
-    </module>
-</config>
diff --git a/app/code/Magento/Connect/i18n/de_DE.csv b/app/code/Magento/Connect/i18n/de_DE.csv
deleted file mode 100644
index 51c0c7efdb89116a9a354c92671b1c27e935ef84..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/de_DE.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,Entfernen
-Action,Aktion
-File,File
-Email,E-Mail
-Name,Name
-Type,Typ
-Description,Beschreibung
-Summary,Zusammenfassung
-Include,Inkludieren
-"Save Data and Create Package","Daten speichern und Paket erstellen"
-"Save As...","Speichern als..."
-"Save package with custom package file name","Paket speichern mit individueller Bezeichnung der Paketdatei"
-"New Extension","Neue Erweiterung"
-"Add files","Dateien hinzufügen"
-Authors,Verfasser
-"Add Author","Verfasser hinzufügen"
-Contents,Inhalte
-"PHP Version","PHP Version"
-Minimum,Minimum
-Maximum,Maximum
-Dependencies,Abhängigkeiten
-Folder,Ordner
-Package,Verpackung
-"Load Local Package","Lokales Paket laden"
-"Package File Name","Paket Datei-Name"
-Channel,Kanal
-"1.5.0.0 & later","1.5.0.0 & neuer"
-Pre-1.5.0.0,"früher als 1.5.0.0"
-"Supported releases","Unterstützte Versionen"
-License,Lizenz
-"License URI","Lizenz URI"
-"Package Info","Paket Info"
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info","Informationen zur Veröffentlichung"
-"Create Extension Package","Erweiterungs-Paket erstellen"
-"Package Extensions",Paket-Erweiterungen
-Extension,Erweiterung
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.","Die Paketdaten wurden gespeichert."
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,Benutzer
-Target,Ziel
-Path,Pfad
-Ignore,Ignorieren
-"Recursive Dir","Recursive Dir"
-"Add Contents Path","Inhalte hinzufügen Pfad"
-Packages,Pakete
-Min,Min
-Max,Max
-Files,Dateien
-"Add Package dependency","Paket Abhängigkeit hinzufügen"
-Extensions,Erweiterungen
-"Add PHP Extension dependency","PHP Erweiterung Abhängigkeit hinzufügen"
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/i18n/en_US.csv b/app/code/Magento/Connect/i18n/en_US.csv
deleted file mode 100644
index e295c68fbf6380ca471fb6ba83e4cec4401d8483..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/en_US.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,Remove
-Action,Action
-File,File
-Email,Email
-Name,Name
-Type,Type
-Description,Description
-Summary,Summary
-Include,Include
-"Save Data and Create Package","Save Data and Create Package"
-"Save As...","Save As..."
-"Save package with custom package file name","Save package with custom package file name"
-"New Extension","New Extension"
-"Add files","Add files"
-Authors,Authors
-"Add Author","Add Author"
-Contents,Contents
-"PHP Version","PHP Version"
-Minimum,Minimum
-Maximum,Maximum
-Dependencies,Dependencies
-Folder,Folder
-Package,Package
-"Load Local Package","Load Local Package"
-"Package File Name","Package File Name"
-Channel,Channel
-"1.5.0.0 & later","1.5.0.0 & later"
-Pre-1.5.0.0,Pre-1.5.0.0
-"Supported releases","Supported releases"
-License,License
-"License URI","License URI"
-"Package Info","Package Info"
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info","Release Info"
-"Create Extension Package","Create Extension Package"
-"Package Extensions","Package Extensions"
-Extension,Extension
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.","The package data has been saved."
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,User
-Target,Target
-Path,Path
-Ignore,Ignore
-"Recursive Dir","Recursive Dir"
-"Add Contents Path","Add Contents Path"
-Packages,Packages
-Min,Min
-Max,Max
-Files,Files
-"Add Package dependency","Add Package dependency"
-Extensions,Extensions
-"Add PHP Extension dependency","Add PHP Extension dependency"
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/i18n/es_ES.csv b/app/code/Magento/Connect/i18n/es_ES.csv
deleted file mode 100644
index a6d22252e5699d721012f5033bba00b8b57f0391..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/es_ES.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,Eliminar
-Action,Acción
-File,File
-Email,"Correo electrónico"
-Name,Nombre
-Type,Tipo
-Description,Descripción
-Summary,Resumen
-Include,Incluir
-"Save Data and Create Package","Guardar datos y crear paquete"
-"Save As...","Guardar como..."
-"Save package with custom package file name","Guardar paquete con nombre de archivo de paquete personalizado"
-"New Extension","Nueva extensión"
-"Add files","Agregar archivos"
-Authors,Autores
-"Add Author","Añadir Autor"
-Contents,Contenido
-"PHP Version","Versión de PHP"
-Minimum,Mínimo
-Maximum,Máximo
-Dependencies,Dependencias
-Folder,Carpeta
-Package,Paquete
-"Load Local Package","Cargar paquete local"
-"Package File Name","Nombre de archivo de paquete"
-Channel,Canal
-"1.5.0.0 & later","1.5.0.0 y posterior"
-Pre-1.5.0.0,"Pre 1.5.0.0"
-"Supported releases","Publicaciones soportadas"
-License,Licencia
-"License URI","Dirección URI de la licencia"
-"Package Info","Información de paquete"
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info","Información de versión"
-"Create Extension Package","Crear paquete de extensión"
-"Package Extensions","Extensiones de paquete"
-Extension,Extensión
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.","Se guardaron los datos del paquete."
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,Usuario
-Target,Destino
-Path,Camino
-Ignore,Ignorar
-"Recursive Dir","Recursive Dir"
-"Add Contents Path","Añadir Trayectoria de Contenidos"
-Packages,Paquetes
-Min,Mínimo
-Max,Máximo
-Files,Archivos
-"Add Package dependency","Añadir dependencia del Paquete"
-Extensions,Extensiones
-"Add PHP Extension dependency","Añadir dependencia de la Extensión PHP"
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/i18n/fr_FR.csv b/app/code/Magento/Connect/i18n/fr_FR.csv
deleted file mode 100644
index 7f7655d9e894cddca9bc2d69492af6dcadb1ae49..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/fr_FR.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,Supprimer
-Action,Action
-File,File
-Email,Email
-Name,Nom
-Type,Type
-Description,Description
-Summary,Résumé
-Include,Inclure
-"Save Data and Create Package","Enregistrer les données et créer un paquet"
-"Save As...","Enregistrer sous..."
-"Save package with custom package file name","Enregistrer le paquet avec un nom de fichier personnalisé"
-"New Extension","Nouvelle extension"
-"Add files","Ajouter des fichiers"
-Authors,Auteurs
-"Add Author","Ajouter un auteur"
-Contents,Contenus
-"PHP Version","Version PHP"
-Minimum,Minimum
-Maximum,Maximum
-Dependencies,Dépendances
-Folder,Dossier
-Package,Colis
-"Load Local Package","Charger le paquet local"
-"Package File Name","Nom de fichier du paquet"
-Channel,Canal
-"1.5.0.0 & later","1.5.0.0 et suivantes"
-Pre-1.5.0.0,"Antérieures à 1.5.0.0"
-"Supported releases","Versions supportées"
-License,Licence
-"License URI","URI de la licence"
-"Package Info","Info du paquet"
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info","Info sur la release"
-"Create Extension Package","Créer un paquet d'extension"
-"Package Extensions","Extensions du paquet"
-Extension,Extension
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.","Les données du paquet ont été sauvegardées"
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,Utilisateur
-Target,Cible
-Path,Chemin
-Ignore,Ignorer
-"Recursive Dir","Recursive Dir"
-"Add Contents Path","Ajouter un chemin vers des contenus"
-Packages,Paquets
-Min,Min
-Max,Max
-Files,Fichiers
-"Add Package dependency","Ajouter dépendances"
-Extensions,Extensions
-"Add PHP Extension dependency","Ajouter dépendances PHP"
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/i18n/nl_NL.csv b/app/code/Magento/Connect/i18n/nl_NL.csv
deleted file mode 100644
index 402f35fa1a9c06c508094d23c1c6fcdcfe5e5952..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/nl_NL.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,Verwijder
-Action,Actie
-File,File
-Email,Email
-Name,Naam
-Type,type
-Description,Omschrijving
-Summary,Overzicht
-Include,"Sluit in"
-"Save Data and Create Package","Sla data op en creëer pakket."
-"Save As...","Sla op als..."
-"Save package with custom package file name","Sla pakket op met aangepaste pakket bestandsnaam"
-"New Extension","Nieuwe extensie"
-"Add files","Voeg bestanden toe"
-Authors,Auteurs
-"Add Author","Voeg auteur toe"
-Contents,Inhoud
-"PHP Version","PHP versie"
-Minimum,Minimum
-Maximum,Maximum
-Dependencies,Afhankelijkheden
-Folder,Map
-Package,Pakket
-"Load Local Package","Laad lokaal pakket"
-"Package File Name","Pakket bestandsnaam"
-Channel,Kanaal
-"1.5.0.0 & later","1.5.0.0 & later"
-Pre-1.5.0.0,Pre-1.5.0.0
-"Supported releases","Ondersteunde uitbrenging"
-License,Licentie
-"License URI","Licentie URL"
-"Package Info","Pakket info"
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info",Uitbrengingsinformatie
-"Create Extension Package","Creëer extensie pakket"
-"Package Extensions","Pakket extensies"
-Extension,Extensie
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.","De data van het pakket is opgeslagen"
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,Gebruiker
-Target,Doel
-Path,Pad
-Ignore,Negeer
-"Recursive Dir","Recursive Dir"
-"Add Contents Path","Voeg inhoudspad toe"
-Packages,Pakketten
-Min,Minimaal
-Max,Maximaal
-Files,Bestanden
-"Add Package dependency","Voeg pakket afhankelijkheid toe"
-Extensions,Extensies
-"Add PHP Extension dependency","Voeg PHP extensie afhankelijkheid toe"
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/i18n/pt_BR.csv b/app/code/Magento/Connect/i18n/pt_BR.csv
deleted file mode 100644
index d716e05c15e7d1a3882b32a24ec299f383ea57e1..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/pt_BR.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,Remover
-Action,Ação
-File,File
-Email,E-mail
-Name,Nome
-Type,Tipo
-Description,Descrição
-Summary,Sumário
-Include,Incluir
-"Save Data and Create Package","Salvar Dados e Criar Pacote"
-"Save As...","Salvar Como..."
-"Save package with custom package file name","Salvar pacote com nome do arquivo de pacote personalizado"
-"New Extension","Nova Extensão"
-"Add files","Adicionar arquivos"
-Authors,Autores
-"Add Author","Adicionar autor"
-Contents,Conteúdos
-"PHP Version","Versão PHP"
-Minimum,Mínimo
-Maximum,Máximo
-Dependencies,Dependências
-Folder,Pasta
-Package,Embalagem
-"Load Local Package","Carregar Pacote Local"
-"Package File Name","Nome do Arquivo do Pacote"
-Channel,Canal
-"1.5.0.0 & later","1.5.0.0 e posterior"
-Pre-1.5.0.0,Pré-1.5.0.0
-"Supported releases","Versões suportadas"
-License,Licença
-"License URI","Licença de URI"
-"Package Info","Informação do Pacote"
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info","Informação de Lançamento"
-"Create Extension Package","Criar pacote de expansão"
-"Package Extensions","Extensões da Embalagem"
-Extension,Extensão
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.","Os dados do pacote foram salvos."
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,Usuário
-Target,Objetivo
-Path,Caminho
-Ignore,Ignorar
-"Recursive Dir","Recursive Dir"
-"Add Contents Path","Adicionar sequência de conteúdos"
-Packages,Embalagens
-Min,Min
-Max,Máximo
-Files,Arquivos
-"Add Package dependency","Adicionar dependência de Pacote"
-Extensions,Extensões
-"Add PHP Extension dependency","Adicionar dependência de Extensão PHP"
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/i18n/zh_CN.csv b/app/code/Magento/Connect/i18n/zh_CN.csv
deleted file mode 100644
index f23e3c39cac4e5d84bf14ea91fbd3b835efca550..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/i18n/zh_CN.csv
+++ /dev/null
@@ -1,60 +0,0 @@
-Remove,删除
-Action,操作
-File,File
-Email,电子邮件
-Name,姓名
-Type,类型
-Description,描述
-Summary,摘要
-Include,包含
-"Save Data and Create Package",保存数据并创建包
-"Save As...",另存为...
-"Save package with custom package file name",使用自定义包文件名保存包
-"New Extension",新扩展
-"Add files",添加文件
-Authors,作者
-"Add Author",添加作者
-Contents,内容
-"PHP Version",PHP版本
-Minimum,最小
-Maximum,最大
-Dependencies,依存性
-Folder,文件夹
-Package,包裹
-"Load Local Package",加载本地包
-"Package File Name",包文件名
-Channel,渠道
-"1.5.0.0 & later","1.5.0.0 及更新版"
-Pre-1.5.0.0,Pre-1.5.0.0
-"Supported releases",支持的版本
-License,许可
-"License URI",许可URI
-"Package Info",包信息
-Release,Release
-"Release Version","Release Version"
-"Release Stability","Release Stability"
-Notes,Notes
-"Release Info",发布信息
-"Create Extension Package",创建扩展包
-"Package Extensions",包括扩展
-Extension,扩展
-"Something went wrong loading the package data.","Something went wrong loading the package data."
-"The package %1 data has been loaded.","The package %1 data has been loaded."
-"The package data has been saved.",包中数据已保存。
-"Something went wrong saving the package data.","Something went wrong saving the package data."
-"Something went wrong saving the package.","Something went wrong saving the package."
-"Something went wrong creating the package.","Something went wrong creating the package."
-User,用户
-Target,目标
-Path,路径
-Ignore,忽略
-"Recursive Dir","Recursive Dir"
-"Add Contents Path",添加内容路径
-Packages,包裹
-Min,最小
-Max,最大
-Files,文件
-"Add Package dependency",添加数据包依存性
-Extensions,扩展
-"Add PHP Extension dependency",添加PHP扩展依存性
-"Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.","Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads."
diff --git a/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_edit.xml b/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_edit.xml
deleted file mode 100644
index 4b42a077d0a5736d4cf96d9809d335375d27d5c3..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_edit.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceContainer name="content">
-        <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit" name="connect_extension_edit"/>
-    </referenceContainer>
-    <referenceContainer name="left">
-        <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tabs" name="connect_extension_edit_tabs">
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Package" name="tab_package" template="extension/custom/package.phtml"/>
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Release" name="tab_release" template="extension/custom/release.phtml"/>
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Authors" name="tab_authors" template="extension/custom/authors.phtml"/>
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Depends" name="tab_depends" template="extension/custom/depends.phtml"/>
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Contents" name="tab_contents" template="extension/custom/contents.phtml"/>
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Local" name="tab_local"/>
-            <action method="addTab">
-                <argument name="name" xsi:type="string">package_info</argument>
-                <argument name="block" xsi:type="string">tab_package</argument>
-            </action>
-            <action method="addTab">
-                <argument name="name" xsi:type="string">release_info</argument>
-                <argument name="block" xsi:type="string">tab_release</argument>
-            </action>
-            <action method="addTab">
-                <argument name="name" xsi:type="string">authors</argument>
-                <argument name="block" xsi:type="string">tab_authors</argument>
-            </action>
-            <action method="addTab">
-                <argument name="name" xsi:type="string">dependencies</argument>
-                <argument name="block" xsi:type="string">tab_depends</argument>
-            </action>
-            <action method="addTab">
-                <argument name="name" xsi:type="string">contents</argument>
-                <argument name="block" xsi:type="string">tab_contents</argument>
-            </action>
-            <action method="addTab">
-                <argument name="name" xsi:type="string">load_local_package</argument>
-                <argument name="block" xsi:type="string">tab_local</argument>
-            </action>
-        </block>
-    </referenceContainer>
-</layout>
diff --git a/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_loadtab.xml b/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_loadtab.xml
deleted file mode 100644
index cd0e32d10709e751f790020e4a7d65798878e63a..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_loadtab.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <container name="root" label="Root" output="1">
-        <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Load" name="connect_extension_load_local_package_grid" template="extension/custom/load.phtml">
-            <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Grid" name="local_package_grid"/>
-        </block>
-    </container>
-</layout>
diff --git a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/authors.phtml b/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/authors.phtml
deleted file mode 100644
index 45b6211629dece6370a720f4f4af4d78697a6cd1..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/authors.phtml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<script type="text/javascript">
-var id = 0;
-var authorTemplate =
-    '<tr>'+
-        '<td class="col-name">'+
-            '<input type="text" class="input-text required-entry" name="authors[name][]" id="authors_name_{{id}}" value="{{name}}"/>'+
-        '</td>'+
-        '<td class="col-user">'+
-            '<input type="text" class="input-text required-entry" name="authors[user][]" id="authors_user_{{id}}" value="{{user}}"/>'+
-        '</td>'+
-        '<td class="col-email">'+
-            '<input type="text" class="input-text required-entry validate-email" name="authors[email][]" id="authors_email_{{id}}" value="{{email}}"/>'+
-        '</td>'+
-        '<td class="col-delete">'+
-            <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getRemoveRowButtonHtml('tr')) ?> +
-        '</td>'+
-    '</tr>';
-
-function addAuthor(data)
-{
-    if (data == undefined) {
-        data = {};
-    }
-    data.id = id++;
-
-    var template = new Template(authorTemplate, /(^|.|\r|\n)({{(\w+)}})/);
-    Element.insert($('authors_container'), {bottom: template.evaluate(data)});
-}
-</script>
-
-<fieldset class="fieldset">
-    <?php echo $this->getFormHtml() ?>
-    <legend class="legend"><span><?php echo __("Authors") ?></span></legend>
-    <br>
-    <div id="authors_fieldset">
-        <table class="data-table" cellspacing="0">
-            <thead>
-                <tr>
-                    <th class="col-name required"><?php echo __("Name") ?></th>
-                    <th class="col-user required"><?php echo __("User") ?></th>
-                    <th class="col-email required"><?php echo __("Email") ?></th>
-                    <th class="col-delete"><?php echo __("Remove") ?></th>
-                </tr>
-            </thead>
-            <tfoot>
-            <tr>
-                <td colspan="4" class="col-actions-add"><?php echo $this->getAddAuthorButtonHtml() ?></td>
-            </tr>
-            </tfoot>
-            <tbody id="authors_container">
-                <script type="text/javascript">
-                <?php if (count($this->getAuthors())): ?>
-                    <?php foreach ($this->getAuthors() as $author): ?>
-                        addAuthor(<?php echo $author ?>);
-                    <?php endforeach ?>
-                <?php else: ?>
-                    addAuthor();
-                <?php endif;?>
-                </script>
-            </tbody>
-        </table>
-    </div>
-</fieldset>
diff --git a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/contents.phtml b/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/contents.phtml
deleted file mode 100644
index 93fe5574d2c480a803e5c45dc072432ec83907a0..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/contents.phtml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-
-<?php echo $this->getFormHtml() ?>
-<fieldset id="contents_fieldset" class="fieldset">
-    <legend class="legend"><span><?php echo __("Contents") ?></span></legend>
-    <table class="data-table" cellspacing="0">
-        <thead>
-            <tr>
-                <th><?php echo __("Target") ?></th>
-                <th><?php echo __("Path") ?></th>
-                <th><?php echo __("Type") ?></th>
-                <th><?php echo __("Include") ?></th>
-                <th><?php echo __("Ignore") ?></th>
-                <th class="col-delete"><?php echo __("Action") ?></th>
-            </tr>
-            <tr id="contents_template" style="display:none">
-            <?php function showContentsTemplate($self, $_i = 0)
-            { ?>
-                <td>
-                    <select name="contents[target][]">
-                        <optgroup label="Magento">
-                            <?php foreach ($self->getMageTargets() as $_value => $_label): ?>
-                            <option value="<?php echo $_value ?>" <?php echo $self->getSelected('contents/target/' . $_i, $_value) ?>><?php echo $_label ?></option>
-                            <?php endforeach ?>
-                        </optgroup>
-                    </select>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="contents[path][]" value="<?php echo $self->getValue('contents/path/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <select name="contents[type][]">
-                        <option value="file" <?php echo $self->getSelected('contents/type/' . $_i, 'file') ?>><?php echo __("File") ?></option>
-                        <option value="dir" <?php echo $self->getSelected('contents/type/' . $_i, 'dir') ?>><?php echo __("Recursive Dir") ?></option>
-                    </select>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="contents[include][]" value="<?php echo $self->getValue('contents/include/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="contents[ignore][]" value="<?php echo $self->getValue('contents/ignore/' . $_i) ?>"/>
-                </td>
-                <td class="col-delete">
-                    <?php echo $self->getRemoveRowButtonHtml('tr') ?>
-                </td>
-            <?php } ?>
-            <?php showContentsTemplate($this) ?>
-            </tr>
-        </thead>
-        <tbody id="contents_container">
-        <?php if ($this->getData('contents/target')): ?>
-            <?php foreach ($this->getData('contents/target') as $_i => $_dbField): ?>
-                <?php if (0 === $_i) continue; ?>
-            <tr>
-                <?php showContentsTemplate($this, $_i) ?>
-            </tr>
-            <?php endforeach ?>
-        <?php endif ?>
-        </tbody>
-        <tfoot>
-            <tr>
-                <td colspan="6" class="col-actions-add"><?php echo $this->getAddRowButtonHtml('contents_container', 'contents_template', __('Add Contents Path')) ?></td>
-            </tr>
-        </tfoot>
-    </table>
-</fieldset>
-
diff --git a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/depends.phtml b/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/depends.phtml
deleted file mode 100644
index 36f0ccd6a0ba170821506395027fa4ec600dcb5f..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/depends.phtml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-
-<?php echo $this->getFormHtml() ?>
-
-<fieldset id="depends_packages_fieldset" class="fieldset">
-    <legend class="legend"><span><?php echo __("Packages") ?></span></legend>
-    <table class="data-table" cellspacing="0">
-        <thead>
-            <tr>
-                <th><?php echo __("Package") ?></th>
-                <th><?php echo __("Channel") ?></th>
-                <th><?php echo __("Min") ?></th>
-                <th><?php echo __("Max") ?></th>
-                <th><?php echo __("Files") ?></th>
-                <th class="col-delete"><?php echo __("Action") ?></th>
-            </tr>
-            <tr id="depends_packages_template" style="display:none">
-            <?php function showDependsPackageTemplate($self, $_i = 0)
-            {
-                $filesClass = "files";
-            ?>
-                <td>
-                    <input type="text" class="input-text" name="depends[package][name][]"  value="<?php echo $self->getValue('depends/package/name/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="depends[package][channel][]" value="<?php echo $self->getValue('depends/package/channel/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="depends[package][min][]" value="<?php echo $self->getValue('depends/package/min/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="depends[package][max][]" value="<?php echo $self->getValue('depends/package/max/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <textarea class="<?php echo $filesClass ?>" style="display:none" name="depends[package][files][]"><?php echo $self->getValue('depends/package/files/' . $_i)?> </textarea>
-                    <?php echo $self->getAddFileDepsRowButtonHtml("tr", $filesClass) ?>
-                </td>
-                <td class="col-delete">
-                    <?php echo $self->getRemoveRowButtonHtml('tr') ?>
-                </td>
-            <?php } ?>
-            <?php showDependsPackageTemplate($this) ?>
-            </tr>
-        </thead>
-        <tbody id="depends_packages_container">
-        <?php if ($this->getData('depends/package/name')): ?>
-            <?php foreach ($this->getData('depends/package/name') as $_i => $_dbField): ?>
-                <?php if (0 === $_i) continue; ?>
-                <tr>
-                    <?php showDependsPackageTemplate($this, $_i) ?>
-                </tr>
-            <?php endforeach ?>
-        <?php endif ?>
-        </tbody>
-        <tfoot>
-            <tr>
-                <td colspan="8" class="col-actions-add"><?php echo $this->getAddRowButtonHtml('depends_packages_container', 'depends_packages_template', __('Add Package dependency')) ?></td>
-            </tr>
-        </tfoot>
-    </table>
-</fieldset>
-
-<fieldset id="depends_extensions_fieldset" class="fieldset">
-    <legend class="legend"><span><?php echo __("Extensions") ?></span></legend>
-    <table class="data-table" cellspacing="0">
-        <thead>
-            <tr>
-                <th><?php echo __("Extension") ?></th>
-                <th><?php echo __("Min") ?></th>
-                <th><?php echo __("Max") ?></th>
-                <th><?php echo __("Action") ?></th>
-            </tr>
-            <tr id="depends_extensions_template" style="display:none">
-            <?php function showDependsExtensionsTemplate($self, $_i=0) { ?>
-                <td>
-                    <select name="depends[extension][name][]" style="width:100px">
-                        <?php foreach ($self->getExtensions() as $_value => $_label): ?>
-                        <option value="<?php echo $_value ?>" <?php echo $self->getSelected('depends/extension/name/' . $_i, $_value) ?>><?php echo $_label ?></option>
-                        <?php endforeach ?>
-                    </select>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="depends[extension][min][]" value="<?php echo $self->getValue('depends/extension/min/' . $_i) ?>"/>
-                </td>
-                <td>
-                    <input type="text" class="input-text" name="depends[extension][max][]" value="<?php echo $self->getValue('depends/extension/max/' . $_i) ?>"/>
-                </td>
-                <td class="col-delete">
-                    <?php echo $self->getRemoveRowButtonHtml('tr') ?>
-                </td>
-            <?php } ?>
-            <?php showDependsExtensionsTemplate($this) ?>
-            </tr>
-        </thead>
-        <tbody id="depends_extensions_container">
-        <?php if ($this->getData('depends/extension/name')): ?>
-            <?php foreach ($this->getData('depends/extension/name') as $_i=>$_dbField): ?>
-                <?php if (0===$_i) continue; ?>
-                <tr>
-                    <?php showDependsExtensionsTemplate($this, $_i) ?>
-                </tr>
-            <?php endforeach ?>
-        <?php endif ?>
-        </tbody>
-        <tfoot>
-            <tr>
-                <td colspan="7" class="col-actions-add"><?php echo $this->getAddRowButtonHtml('depends_extensions_container', 'depends_extensions_template', __('Add PHP Extension dependency')) ?></td>
-            </tr>
-        </tfoot>
-    </table>
-</fieldset>
diff --git a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/package.phtml b/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/package.phtml
deleted file mode 100644
index c67b8f7cdee743180455e5b7a2a9695098c3c2fb..0000000000000000000000000000000000000000
--- a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/package.phtml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-
-<script type="text/javascript">
-function addRow(container, template)
-{
-    Element.insert($(container), {bottom: '<tr>' + $(template).innerHTML + '</tr>'});
-}
-
-function removeRow(button, selector)
-{
-    Element.remove($(button).up(selector));
-}
-
-function showHideFiles(button, selector, filesClass)
-{
-    $(button).up(selector).select('[class="'+filesClass+'"]').map(Element.toggle);
-}
-
-
-function loadPackage()
-{
-    var package = prompt('Please enter package name');
-    if (!package) return false;
-    var url = '<?php echo $this->getUrl('*/*/load') ?>';
-    location.href = url+(url.indexOf('?')==-1 ? '?':'&')+'id='+package;
-}
-
-function saveAsPackage(e)
-{
-    _defaultPackageName = '';
-    if ($('_packagefile_name')) {
-        _defaultPackageName = $('_packagefile_name').getValue();
-    } else if ($('_packagename')) {
-        _defaultPackageName = $('_packagename').getValue();
-    }
-    var package = prompt('Please enter package file name', _defaultPackageName);
-    if (!package) {
-        return e.stopImmediatePropagation();
-    }
-    if ($('_packagefile_name')) {
-        $('_packagefile_name').value = package;
-    }
-}
-
-function createPackage()
-{
-    $('_create').value = 1;
-}
-
-function resetPackage()
-{
-    location.href = '<?php echo $this->getUrl('*/*/reset') ?>';
-}
-</script>
-
-<style type="text/css">
-.table-editable { border:solid 1px #CCC; background:#FAFAFA; padding:5px; margin-bottom:5px; }
-.table-editable th { border-bottom:solid 1px #CCC; text-align:center; }
-.table-editable th, .table-editable td { padding:1px 3px; vertical-align:middle; }
-.table-editable select { height:19px; }
-</style>
-
-<div class="entry-edit">
-    <input type="hidden" id="_create" name="_create" />
-    <?php echo $this->getFormHtml() ?>
-</div>
diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..067e82511f5de133ff1f837c874ad0168c3d290f
--- /dev/null
+++ b/app/code/Magento/Contact/composer.json
@@ -0,0 +1,23 @@
+{
+    "name": "magento/module-contact",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Contact"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1cef33c57154dcb4f9aee70a08ac58415b89c9a6
--- /dev/null
+++ b/app/code/Magento/Core/composer.json
@@ -0,0 +1,26 @@
+{
+    "name": "magento/module-core",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-cron": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-page-cache": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Core"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php b/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php
index c3701b869e5ed75ccd18721216daa16a7220f9d8..f9acae362c9a045d8247c3ab33ec297a8a24d3af 100644
--- a/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php
@@ -255,7 +255,7 @@ $table = $installer->getConnection()->newTable(
     'string',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     255,
-    array('nullable' => false, 'default' => \Magento\Framework\TranslateInterface::DEFAULT_STRING),
+    array('nullable' => false, 'default' => 'Translate String'),
     'Translation String'
 )->addColumn(
     'store_id',
@@ -372,7 +372,11 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Variable Name'
 )->addIndex(
-    $installer->getIdxName('core_variable', array('code'), \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE),
+    $installer->getIdxName(
+        'core_variable',
+        array('code'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
     array('code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->setComment(
diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php
index 34b1e549abb046af1b6589248e1bad511865d3ec..ad640dfd353910928c31bafbf4b5c7bb4fe921a4 100644
--- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php
+++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php
@@ -88,7 +88,11 @@ $connection->changeColumn(
  */
 $connection->addIndex(
     $newTableName,
-    $installer->getIdxName($newTableName, 'theme_id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE),
+    $installer->getIdxName(
+        $newTableName,
+        'theme_id',
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
     'theme_id',
     \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
 );
@@ -103,7 +107,11 @@ $connection->addForeignKey(
 );
 $connection->addIndex(
     $newTableName,
-    $installer->getIdxName($newTableName, 'layout_update_id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX),
+    $installer->getIdxName(
+        $newTableName,
+        'layout_update_id',
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
+    ),
     'layout_update_id',
     \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
 );
diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php
index 17552f41c8d258f2f37d8ba94962f16ecac67e0c..555b3bcd2b03474073b13883420b5fd24a7de1f6 100644
--- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php
+++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php
@@ -44,7 +44,7 @@ $connection->addColumn(
     array(
         'type' => \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
         'nullable' => false,
-        'default' => crc32(\Magento\Framework\TranslateInterface::DEFAULT_STRING),
+        'default' => crc32('Translate String'),
         'comment' => 'Translation String CRC32 Hash'
     )
 );
diff --git a/app/code/Magento/Core/view/frontend/templates/require_cookie.phtml b/app/code/Magento/Core/view/frontend/templates/require_cookie.phtml
index f6054ddb1bf2d8af20dce9c3e1130c6b4019af44..377881e024cb852a45f752f36bfe245e77a4bdea 100644
--- a/app/code/Magento/Core/view/frontend/templates/require_cookie.phtml
+++ b/app/code/Magento/Core/view/frontend/templates/require_cookie.phtml
@@ -24,9 +24,10 @@
 ?>
 <?php /** @var \Magento\Core\Block\RequireCookie $this */ ?>
 <script type="text/javascript">
-    //<![CDATA[
-    (function ($) {
-        $('body').mage('requireCookie', <?php echo $this->getScriptOptions(); ?>);
-    })(jQuery);
-    //]]>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+    $('body').mage('requireCookie', <?php echo $this->getScriptOptions(); ?>);
+});
 </script>
\ No newline at end of file
diff --git a/app/code/Magento/Core/view/frontend/web/js/require-cookie.js b/app/code/Magento/Core/view/frontend/web/js/require-cookie.js
index e2fb5b411d186564be09219f1d9c2a10ecbd15a3..602a26490ff0bb4c146b5de90b4de3a0c1c702ba 100644
--- a/app/code/Magento/Core/view/frontend/web/js/require-cookie.js
+++ b/app/code/Magento/Core/view/frontend/web/js/require-cookie.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint evil:true browser:true jquery:true */
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.requireCookie', {
         options: {
             event: 'click',
@@ -61,4 +65,5 @@
             window.location = this.options.noCookieUrl;
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..a46386ee521500672cd26852394bf31cb6fb7dfb
--- /dev/null
+++ b/app/code/Magento/Cron/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-cron",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Cron"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..a47864769f579f33d621b72bcca3a3b407804709
--- /dev/null
+++ b/app/code/Magento/CurrencySymbol/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-currency-symbol",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-page-cache": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CurrencySymbol"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml
index 49a3f20735561c27a716f69189611758c016d195..0dc1845e796ce5bb83006a6275df1bb8737c82bc 100644
--- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml
+++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml
@@ -61,6 +61,8 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#currency-symbols-form').mage('form').mage('validation');
 
     function toggleUseDefault(code, value)
@@ -74,5 +76,8 @@
             input.disabled = false;
         }
     }
+
+    window.toggleUseDefault = toggleUseDefault;
+});
 </script>
 
diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml
index 96a411ae3a6690113809046becb5a58002e2ae75..1032576aeaea3cbf69258e7bf2a6e70ef4b94444 100644
--- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml
+++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml
@@ -74,5 +74,9 @@ $_rates = ( $_newRates ) ? $_newRates : $_oldRates;
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#rate-form').mage('form').mage('validation');
+
+});
 </script>
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php
index 9ad06d6d429f0504264a574ee892332833f78690..d2bac5798a8e11cbc61045e01dbc38bd6d77fb14 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php
@@ -83,6 +83,7 @@ class Region extends \Magento\Backend\Block\AbstractBlock implements
         $html .= '</select>';
 
         $html .= '<script type="text/javascript">' . "\n";
+        $html .= 'require(["prototype", "mage/adminhtml/form"], function(){';
         $html .= '$("' . $selectId . '").setAttribute("defaultValue", "' . $regionId . '");' . "\n";
         $html .= 'new regionUpdater("' .
             $country->getHtmlId() .
@@ -94,6 +95,8 @@ class Region extends \Magento\Backend\Block\AbstractBlock implements
             $this->_directoryHelper->getRegionJson() .
             ');' .
             "\n";
+
+        $html .= '});';
         $html .= '</script>' . "\n";
 
         $html .= '</div></div>' . "\n";
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..020cabb48bc29f3519154a11cfd0fc216a7c0776
--- /dev/null
+++ b/app/code/Magento/Customer/composer.json
@@ -0,0 +1,35 @@
+{
+    "name": "magento/module-customer",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-newsletter": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/module-log": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-review": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-page-cache": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Customer"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php b/app/code/Magento/Customer/data/customer_setup/data-install-1.6.0.0.php
similarity index 54%
rename from app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php
rename to app/code/Magento/Customer/data/customer_setup/data-install-1.6.0.0.php
index 94362e8c2a680683c3ad336cbbf2490458a8e1fb..4e21d4d43fe24f474b3ff8459375f32781aede2e 100644
--- a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php
+++ b/app/code/Magento/Customer/data/customer_setup/data-install-1.6.0.0.php
@@ -24,26 +24,24 @@
 
 /* @var $installer \Magento\Customer\Model\Resource\Setup */
 $installer = $this;
-$installer->startSetup();
-
-// Add reset password link token attribute
-$installer->addAttribute(
-    'customer',
-    'rp_token',
-    array('type' => 'varchar', 'input' => 'hidden', 'visible' => false, 'required' => false)
+// insert default customer groups
+$installer->getConnection()->insertForce(
+    $installer->getTable('customer_group'),
+    array('customer_group_id' => 0, 'customer_group_code' => 'NOT LOGGED IN', 'tax_class_id' => 3)
 );
-
-// Add reset password link token creation date attribute
-$installer->addAttribute(
-    'customer',
-    'rp_token_created_at',
-    array(
-        'type' => 'datetime',
-        'input' => 'date',
-        'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}',
-        'visible' => false,
-        'required' => false
-    )
+$installer->getConnection()->insertForce(
+    $installer->getTable('customer_group'),
+    array('customer_group_id' => 1, 'customer_group_code' => 'General', 'tax_class_id' => 3)
+);
+$installer->getConnection()->insertForce(
+    $installer->getTable('customer_group'),
+    array('customer_group_id' => 2, 'customer_group_code' => 'Wholesale', 'tax_class_id' => 3)
 );
+$installer->getConnection()->insertForce(
+    $installer->getTable('customer_group'),
+    array('customer_group_id' => 3, 'customer_group_code' => 'Retailer', 'tax_class_id' => 3)
+);
+
+$installer->installEntities();
 
-$installer->endSetup();
+$installer->installCustomerForms();
diff --git a/app/code/Magento/Customer/sql/customer_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php b/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.0.0-1.6.1.0.php
similarity index 100%
rename from app/code/Magento/Customer/sql/customer_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php
rename to app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.0.0-1.6.1.0.php
diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.1.0-1.6.2.0.php b/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.1.0.0-1.6.1.0.1.php
similarity index 100%
rename from app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.1.0-1.6.2.0.php
rename to app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.1.0.0-1.6.1.0.1.php
diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.1-1.6.2.0.3.php b/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.2-1.6.2.0.3.php
similarity index 100%
rename from app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.1-1.6.2.0.3.php
rename to app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.2-1.6.2.0.3.php
diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.3-1.6.2.0.4.php b/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.3-1.6.2.0.4.php
similarity index 100%
rename from app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0.3-1.6.2.0.4.php
rename to app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.3-1.6.2.0.4.php
diff --git a/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php b/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php
index affc7f0b4f7bf4ae036b5e65ead6655007620e74..943efd8259a2304c49d065b8acc1cec91d81099d 100644
--- a/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php
@@ -1159,25 +1159,3 @@ $table = $installer->getConnection()->newTable(
 $installer->getConnection()->createTable($table);
 
 $installer->endSetup();
-
-// insert default customer groups
-$installer->getConnection()->insertForce(
-    $installer->getTable('customer_group'),
-    array('customer_group_id' => 0, 'customer_group_code' => 'NOT LOGGED IN', 'tax_class_id' => 3)
-);
-$installer->getConnection()->insertForce(
-    $installer->getTable('customer_group'),
-    array('customer_group_id' => 1, 'customer_group_code' => 'General', 'tax_class_id' => 3)
-);
-$installer->getConnection()->insertForce(
-    $installer->getTable('customer_group'),
-    array('customer_group_id' => 2, 'customer_group_code' => 'Wholesale', 'tax_class_id' => 3)
-);
-$installer->getConnection()->insertForce(
-    $installer->getTable('customer_group'),
-    array('customer_group_id' => 3, 'customer_group_code' => 'Retailer', 'tax_class_id' => 3)
-);
-
-$installer->installEntities();
-
-$installer->installCustomerForms();
diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml
index 1490bb24988a20336ca8c0fc2ed937c81298609c..a70312fb623ca02d48f9c24d86d18dd24121bc3d 100644
--- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml
+++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml
@@ -27,19 +27,6 @@
     <referenceContainer name="content">
         <block class="Magento\Customer\Block\Adminhtml\Edit" name="customer_edit"/>
     </referenceContainer>
-    <referenceBlock name="head">
-        <block class="Magento\Backend\Block\Template" name="optional_zip_countries" as="optional_zip_countries" template="Magento_Directory::js/optional_zip_countries.phtml"/>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-catalog-product-composite-configure-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::catalog/product/composite/configure.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-customer-edit-tab-js-addresses.js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Customer::edit/tab/js/addresses.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceContainer name="left">
         <block class="Magento\Customer\Block\Adminhtml\Edit\Tabs" name="customer_edit_tabs">
             <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View" name="customer_edit_tab_view" template="tab/view.phtml">
diff --git a/app/code/Magento/Customer/view/adminhtml/templates/edit/tab/account/form/renderer/sendemail.phtml b/app/code/Magento/Customer/view/adminhtml/templates/edit/tab/account/form/renderer/sendemail.phtml
index c3982a964baf63667e3bd174bf93cdfa6d0ac0c8..fd9df05f27925bcbf668f62301dfa735794fbb68 100644
--- a/app/code/Magento/Customer/view/adminhtml/templates/edit/tab/account/form/renderer/sendemail.phtml
+++ b/app/code/Magento/Customer/view/adminhtml/templates/edit/tab/account/form/renderer/sendemail.phtml
@@ -35,6 +35,8 @@ $element = $this->getElement();
 </div>
 
 <script type="text/javascript">
+require(['prototype'], function(){
+
     document.observe('dom:loaded', function() {
         $('<?php echo $this->getFormHtmlId() ?>website_id').disableSendemail = function() {
             $('<?php echo $this->getFormHtmlId() ?>sendemail').disabled = ('' == this.value || '0' == this.value);
@@ -49,4 +51,6 @@ $element = $this->getElement();
         );
         $('<?php echo $this->getFormHtmlId() ?>website_id').disableSendemail();
     });
+
+});
 </script>
diff --git a/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml b/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml
index 17c2a51cd13c02c7f07ba1123224b1d7419e4f9d..ee693fade2916dcb8225cbebb160c8a9426e1641 100644
--- a/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml
+++ b/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml
@@ -28,6 +28,8 @@
  */
 ?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
     function validateVat() {
         var validationMessage = $('validation_result');
@@ -56,7 +58,11 @@
             }
         });
     }
+
+    window.validateVat = validateVat;
 //]]>
+
+});
 </script>
 <div class="actions actions-validate-vat">
     <div id="validation_result" class="message-validation hidden"></div>
diff --git a/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml b/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml
index 3fb580338cfbd38f1e3c7fe7959bba653e4d943b..1235971bb3ab926ab1e9466f63f0d82441c40f72 100644
--- a/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml
+++ b/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml
@@ -38,6 +38,10 @@
     $listType = $this->getJsObjectName();
 ?>
 <script type="text/javascript">
+require([
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+
 <?php echo $this->getJsObjectName() ?>cartControl = {
     reload: function (params) {
         if (!params) {
@@ -89,6 +93,8 @@ productConfigure.addListType(
         urlConfirm: '<?php echo $this->getUrl('customer/cart_product_composite_cart/update', $params) ?>'
     }
 );
+
+});
 </script>
 <?php endif ?>
 <br />
diff --git a/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js b/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js
index 8a4ca266f0395ede92f1ee194f6d2529dd29b4e7..156f4c0be4414fc03c15d543fd1d4006606d8d03 100644
--- a/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js
+++ b/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js
@@ -20,8 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "mage/backend/tabs"
+], function($){
 
-(function ($, window) {
     $.widget('mage.addressTabs', $.mage.tabs, {
         options: {
             itemCount: 0,
@@ -522,4 +527,6 @@
             return false;
         }
     });
-})(jQuery, window);
+
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Customer/view/frontend/templates/address/book.phtml b/app/code/Magento/Customer/view/frontend/templates/address/book.phtml
index b39c39eb4bed6638d73054103682024f64c46c36..04ebec1baf729e3a28d0fd45701b62b88f5e742c 100644
--- a/app/code/Magento/Customer/view/frontend/templates/address/book.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/address/book.phtml
@@ -116,10 +116,14 @@
 </div>
 
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('.page.main').mage('address', {
         deleteAddress: "li.item a[role='delete-address']",
         deleteUrlPrefix: '<?php echo $this->getDeleteUrl() ?>id/',
         addAddress: "button[role='add-address']",
         addAddressLocation: '<?php echo $this->getAddAddressUrl() ?>'
     });
+
+});
 </script>
diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml
index 3b5617d2d1d78c98cb64fff2af4e09ca13faef10..1ae68868affa68a9e6f8336a9cea1e1ca7c2ba4a 100644
--- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml
@@ -145,10 +145,14 @@
     </div>
 </form>
 <script type="text/javascript">
-    (function($) {
+require([
+    "jquery",
+    "mage/validation",
+    "Magento_Checkout/js/region-updater"
+], function($){
         var $form = $('#form-validate');
-        $form.mage('validation');
-        $('#country').mage('regionUpdater', {
+        $form.validation();
+        $('#country').regionUpdater({
             optionalRegionAllowed: <?php echo ($this->getConfig('general/region/display_all')? 'true' : 'false'); ?>,
             regionListId: '#region_id',
             regionInputId: '#region',
@@ -158,5 +162,5 @@
             defaultRegion: "<?php echo $this->getRegionId() ?>",
             countriesWithOptionalZip: <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
         });
-    })(jQuery);
+});
 </script>
diff --git a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml
index 13ed3a52c04585ba6ffe225442fe072f42cf9c49..2eccf9173c37c156609f9e280fc5250795f2b474 100755
--- a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml
@@ -84,7 +84,11 @@
     </div>
 </form>
 <script type="text/javascript">
-    (function($) {
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
+
         $('#change-password').mage('setPassword', {
             'currentPasswordId': '#current-password',
             'passwordId': '#password',
@@ -114,5 +118,6 @@
             ignore: ignore ? ':hidden:not(' + ignore + ')' : ':hidden'
         <?php endif ?>
         });
-    })(jQuery);
+
+    });
 </script>
diff --git a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml
index ddbc6c2b1634145ff56597976ac279afb288c32d..45f5babe56f253e6a4d4ceb82e5d004f98ce8545 100644
--- a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml
@@ -173,6 +173,8 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     (function($) {
         var dataForm = $('#form-validate');
         var ignore = <?php echo $_dob->isEnabled() ? '\'input[id$="full"]\'' : 'null'; ?>;
@@ -208,4 +210,6 @@
         });
         <?php endif; ?>
     })(jQuery);
+
+});
 </script>
diff --git a/app/code/Magento/Customer/view/frontend/templates/js/components.phtml b/app/code/Magento/Customer/view/frontend/templates/js/components.phtml
index 43e8f0079d1c6e414839c4b1dffbb1fcaf255541..7f09edca5e9e00f2910a409b93b988bf716bcbb7 100644
--- a/app/code/Magento/Customer/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/js/components.phtml
@@ -23,32 +23,18 @@
  */
 ?>
 <script type="text/javascript">
-    (function($) {
-        "use strict";
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
+        'use strict';
+        
         /**
          * Declaration of resources needed for defined components
          */
         $.mage.component({
-            validation: [
-                '<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>',
-                '<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js') ?>',
-                '<?php echo $this->getViewFileUrl('mage/validation.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/validation/validation.js') ?>',
-                '<?php echo $this->getViewFileUrl('mage/validation/dob-rule.js') ?>'
-            ],
-            regionUpdater: [
-                '<?php echo $this->getViewFileUrl('Magento_Checkout::js/region-updater.js') ?>'
-            ],
-            requireCookie: [
-                '<?php echo $this->getViewFileUrl('Magento_Core::js/require-cookie.js') ?>'
-            ],
-            address: [
-                '<?php echo $this->getViewFileUrl('Magento_Customer::address.js') ?>'
-            ],
-            setPassword: [
-                '<?php echo $this->getViewFileUrl('Magento_Customer::set-password.js') ?>'
-            ]
+            validation: 'mage/validation/dob-rule'
         });
-    })(jQuery);
+    });
 </script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Customer/view/frontend/templates/logout.phtml b/app/code/Magento/Customer/view/frontend/templates/logout.phtml
index 80febcb6ee66f9f96e96b9d1205f85ff29752abe..5f94e6edce8c58d1bf1199baa8049fabee41b4af 100644
--- a/app/code/Magento/Customer/view/frontend/templates/logout.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/logout.phtml
@@ -24,7 +24,12 @@
 ?>
 <p><?php echo __('You have logged out and will be redirected to our homepage in 5 seconds.') ?></p>
 <script type="text/javascript">
-    (function($){
-        $($.mage.redirect("<?php echo $this->getUrl() ?>", "assign", 5000));
-    })(jQuery);
+require([
+	"jquery",
+	"mage/mage"
+], function($){
+
+   	$($.mage.redirect("<?php echo $this->getUrl() ?>", "assign", 5000));
+
+});
 </script>
diff --git a/app/code/Magento/Customer/view/frontend/web/address.js b/app/code/Magento/Customer/view/frontend/web/address.js
index 21dce1b4ad65e808787b2727fd455ef9b8c04e9d..89338ed4a90389de2986a588c00bd60d4965f557 100644
--- a/app/code/Magento/Customer/view/frontend/web/address.js
+++ b/app/code/Magento/Customer/view/frontend/web/address.js
@@ -22,7 +22,7 @@
  */
 /*jshint browser:true, jquery:true*/
 /*global confirm:true*/
-(function($, window) {
+define(["jquery","jquery/ui","mage/translate"], function(jQuery){
     "use strict";
     $.widget('mage.address', {
         /**
@@ -68,4 +68,4 @@
             return false;
         }
     });
-})(jQuery, window);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Customer/view/frontend/web/js/checkout-balance.js b/app/code/Magento/Customer/view/frontend/web/js/checkout-balance.js
index c8ef4b3cb0ea16e1278b8d329e4c310bbf55fc3b..1ef5f90858ab9fdad09781ba5db79b118c3fd969 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/checkout-balance.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/checkout-balance.js
@@ -21,7 +21,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define(["jquery","jquery/ui"], function($){
     "use strict";
     $.widget('mage.checkoutBalance', {
         /**
@@ -48,4 +48,4 @@
             }, this));
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Customer/view/frontend/web/set-password.js b/app/code/Magento/Customer/view/frontend/web/set-password.js
index d0b6d33aba4f00e856457ad0b88e83e6eec79f29..b14eb46ff395a7146180a3ae387429a7247fb730 100644
--- a/app/code/Magento/Customer/view/frontend/web/set-password.js
+++ b/app/code/Magento/Customer/view/frontend/web/set-password.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.setPassword', {
         options: {
         },
@@ -56,4 +60,4 @@
                 '{required:true, equalTo:"' + this.options.passwordId + '"}');
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..df27250c37b04c1bdb12d08589f392efd1585707
--- /dev/null
+++ b/app/code/Magento/CustomerImportExport/composer.json
@@ -0,0 +1,26 @@
+{
+    "name": "magento/module-customer-import-export",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-import-export": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/CustomerImportExport"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/Tabs.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/Tabs.php
index ea0f89d2070cd61316fe95a6cebb193b5a16142e..568e65089f19f4e28dba379ee74bf1c8ab8cf66f 100644
--- a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/Tabs.php
+++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/Tabs.php
@@ -63,10 +63,9 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs
     protected function _getScript()
     {
         $script = sprintf(
-            "
-            (function ($) {
+            "require(['jquery', 'Magento_DesignEditor/js/theme-selector'], function($){
                 $('.themes-customizations .theme').themeControl({url: '%s'});
-            })(jQuery);",
+            });",
             $this->getUrl('adminhtml/*/quickEdit')
         );
         return sprintf('<script type="text/javascript">%s</script>', $script);
diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..d88235ca453bf1b1e2079585b6b5b56d74f2fa48
--- /dev/null
+++ b/app/code/Magento/DesignEditor/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-design-editor",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-url-rewrite": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/DesignEditor"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml
index e096532fad394af875537fd67506f550896cec0d..d6bc09796d40432c1e5feabf431c2f9eede95581 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_firstentrance.xml
@@ -25,29 +25,9 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-dialog-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-bootstrap-edit-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/dialog.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-infinitescroll-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/infinitescroll.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-selector-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-selector.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-assign-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-assign.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-edit-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-edit.js</argument>
+                <argument name="file" xsi:type="string">Magento_DesignEditor::js/bootstrap/edit.js</argument>
             </arguments>
         </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-designeditor-css-styles-css">
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml
index 55e41c9381bcd5c18da5f0750ce1e3938f4767ff..d1913556e7e26a6622d0e8ee33167daf13af4768 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_index.xml
@@ -25,34 +25,9 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-dialog-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-bootstrap-edit-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/dialog.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-infinitescroll-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/infinitescroll.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-selector-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-selector.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-assign-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-assign.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-delete-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-delete.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-edit-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-edit.js</argument>
+                <argument name="file" xsi:type="string">Magento_DesignEditor::js/bootstrap/edit.js</argument>
             </arguments>
         </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-designeditor-css-styles-css">
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml
index 6d16857051c480c94184edfc51f91cef0491f989..13d27bf353ff73d892a285f5cdc1aea33f299006 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/layout/adminhtml_system_design_editor_launch.xml
@@ -38,104 +38,14 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-tabs-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.tabs.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jstree-jquery-jstree-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jstree/jquery.jstree.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-slimscroll-slimscroll-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/slimScroll/slimScroll.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-tools-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/tools.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-tools-panel-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/tools-panel.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-custom-css-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/custom-css.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-theme-js-custom-js-list-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Theme::js/custom-js-list.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-dialog-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/dialog.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-assign-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-assign.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-vde-frame-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/vde-frame.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-theme-save-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/theme-save.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-image-sizing-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/image-sizing.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-quick-style-element-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/quick-style-element.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-quick-style-uploader-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/quick-style-uploader.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-designeditor-css-styles-css">
             <arguments>
                 <argument name="file" xsi:type="string">Magento_DesignEditor::css/styles.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-message-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/message.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-tools-files-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-designeditor-js-bootstrap-launch-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_DesignEditor::js/tools-files.js</argument>
+                <argument name="file" xsi:type="string">Magento_DesignEditor::js/bootstrap/launch.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/dialog.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/dialog.phtml
index 7d85c9a0fc82a4d824565854f20ff5447781d87b..fc77fad97fa778536de53e0a9f1336d0838f4984 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/dialog.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/dialog.phtml
@@ -29,15 +29,20 @@
 </div>
 
 <script type="text/javascript">
-    (function ($) {
-        $(document).ready(function() {
-            var options = {
-                autoOpen:    false,
-                modal:       true,
-                width:       570,
-                dialogClass: 'vde-dialog'
-            };
-            $('#dialog-message-confirm').dialog(options);
-        });
-    })(jQuery);
+require([
+    'jquery',
+    'Magento_DesignEditor/js/dialog'
+], function($){
+
+    $(document).ready(function() {
+        var options = {
+            autoOpen:    false,
+            modal:       true,
+            width:       570,
+            dialogClass: 'vde-dialog'
+        };
+        $('#dialog-message-confirm').dialog(options);
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/container.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/container.phtml
index 113376a62cb27d71a7c3963da4ced286188658cf..b3987543e183826eb66ca2139f9a233c048fce04 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/container.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/container.phtml
@@ -29,13 +29,19 @@
 <iframe name="vde_container_frame" data-frame="editor" id="vde_container_frame" class="vde_container_frame" src="<?php echo $this->getFrameUrl(); ?>"></iframe>
 <?php echo $this->getChildHtml('design_editor_tools'); ?>
 <script type="text/javascript">
-    (function ($) {
-        $(document).ready(function(){
-            $("#vde_container_frame").vdeFrame({
-                vdeToolbar: '#vde_toolbar_row',
-                vdePanel: '.vde-tools'
-            });
-            $("#vde_toolbar_row").themeSave();
-        });
-    })(jQuery);
+require([
+	"jquery",
+	"Magento_DesignEditor/js/theme-save",
+	"Magento_DesignEditor/js/vde-frame"
+], function($){
+
+$(document).ready(function(){
+    $("#vde_container_frame").vdeFrame({
+        vdeToolbar: '#vde_toolbar_row',
+        vdePanel: '.vde-tools'
+    });
+    $("#vde_toolbar_row").themeSave();
+});
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/background-uploader.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/background-uploader.phtml
index 11ef172f485aa42bd9d5326b9703f538d0a0963c..38f4238af21e7d040d91e5607e0d7ee14327bf54 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/background-uploader.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/background-uploader.phtml
@@ -53,15 +53,20 @@ $element = $this->getElement();
     </div>
 
     <script type="text/javascript">
-        (function($) {
-            $(document.getElementById('<?php echo $imageUploader->getHtmlId(); ?>-uploader')).quickStyleUploader({
-                uploader_id: '<?php echo $imageUploader->getHtmlId(); ?>',
-                container:   '<?php echo $imageUploader->getHtmlId(); ?>-uploader',
-                value:       '<?php echo $imageUploader->getValue(); ?>',
-                url:         '<?php echo $this->getImageUploadUrl(); ?>',
-                remove_url:  '<?php echo $this->getImageRemoveUrl(); ?>',
-                tile_available:'<?php echo $element->isTileAvailable(); ?>'
-            });
-        })(jQuery);
-    </script>
+require([
+    "jquery",
+    "Magento_DesignEditor/js/quick-style-uploader"
+], function($){
+
+    $(document.getElementById('<?php echo $imageUploader->getHtmlId(); ?>-uploader')).quickStyleUploader({
+        uploader_id: '<?php echo $imageUploader->getHtmlId(); ?>',
+        container:   '<?php echo $imageUploader->getHtmlId(); ?>-uploader',
+        value:       '<?php echo $imageUploader->getValue(); ?>',
+        url:         '<?php echo $this->getImageUploadUrl(); ?>',
+        remove_url:  '<?php echo $this->getImageRemoveUrl(); ?>',
+        tile_available:'<?php echo $element->isTileAvailable(); ?>'
+    });
+    
+});
+</script>
 </div>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/checkbox-utility.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/checkbox-utility.phtml
index 1dd8ac739def1fca21ad24924f2799c468172a13..7a58b671b553f2b809e248f386d9dbf433d26202 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/checkbox-utility.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/checkbox-utility.phtml
@@ -31,15 +31,17 @@ $element = $this->getElement();
 <?php echo $this->getHtml() ?>
 
 <script type="text/javascript">
-    (function($) {
-        var checkbox = document.getElementById('<?php echo $element->getHtmlId() ?>');
-        $(checkbox).on('quickStyleElementBeforeChange', function(e) {
-            var checkbox = $(e.target);
-            if (checkbox && checkbox.attr('checked')) {
-                checkbox.val('<?php echo $element->getValue() ?>');
-            } else {
-                checkbox.val('<?php echo $element->getUncheckedValue() ?>');
-            }
-        });
-    })(jQuery);
+require(['jquery'], function($){
+
+    var checkbox = document.getElementById('<?php echo $element->getHtmlId() ?>');
+    $(checkbox).on('quickStyleElementBeforeChange', function(e) {
+        var checkbox = $(e.target);
+        if (checkbox && checkbox.attr('checked')) {
+            checkbox.val('<?php echo $element->getValue() ?>');
+        } else {
+            checkbox.val('<?php echo $element->getUncheckedValue() ?>');
+        }
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/logo-uploader.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/logo-uploader.phtml
index ae5c7550ed58f3d24c2dcbdb45c00b0817545e92..a01c9dc782e0ef3a8de871b0c9dd19b5f9405c9e 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/logo-uploader.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/form/renderer/logo-uploader.phtml
@@ -53,16 +53,21 @@
         </div>
 
         <script type="text/javascript">
-            (function($) {
-                $(document.getElementById('<?php echo $elementId; ?>-uploader')).quickStyleUploader({
-                    uploader_id:   '<?php echo $elementId; ?>',
-                    container:     '<?php echo $elementId; ?>-uploader',
-                    value:         '<?php echo $this->getLogoImage($store); ?>',
-                    url:           '<?php echo $this->getLogoUploadUrl($store); ?>',
-                    remove_url:    '<?php echo $this->getLogoRemoveUrl($store); ?>',
-                    hide_uploader: false
-                });
-            })(jQuery);
-        </script>
+require([
+    'jquery',
+    'Magento_DesignEditor/js/quick-style-uploader'
+], function($){
+
+    $(document.getElementById('<?php echo $elementId; ?>-uploader')).quickStyleUploader({
+        uploader_id:   '<?php echo $elementId; ?>',
+        container:     '<?php echo $elementId; ?>-uploader',
+        value:         '<?php echo $this->getLogoImage($store); ?>',
+        url:           '<?php echo $this->getLogoUploadUrl($store); ?>',
+        remove_url:    '<?php echo $this->getLogoRemoveUrl($store); ?>',
+        hide_uploader: false
+    });
+        
+});
+</script>
     <?php endforeach; ?>
 <?php endif; ?>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/toolbar/buttons/edit.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/toolbar/buttons/edit.phtml
index ec8970cc1304c33c8ddab4e757ef8aef62c59d24..21359fd2e47e74d5feb2cf297e5d436039fb3fca 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/toolbar/buttons/edit.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/toolbar/buttons/edit.phtml
@@ -43,15 +43,14 @@
 </div>
 
 <script type="text/javascript">
-    (function($) {
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
         'use strict';
-        $.mage.component({
-            'vde-edit-button': [
-                '<?php echo $this->getViewFileUrl('Magento_DesignEditor::js/theme-revert.js') ?>'
-            ]
-        });
+        
         $('#vde_edit_options').on('click', function(){
             $(this).toggleClass('active');
         });
-    })(jQuery);
+    });
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools.phtml
index e26025803a7db07f521cebb596843dca9707be00..c04e8e399a4fbb1d35678fb6f075a17efbfea2a9 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools.phtml
@@ -88,7 +88,13 @@
 </div>
 
 <script type="text/javascript">
-(function($) {
+require([
+    'jquery',
+    'Magento_DesignEditor/js/quick-style-element',
+    'Magento_DesignEditor/js/message',
+    'Magento_DesignEditor/js/tools-panel'
+], function($){
+
     'use strict';
 
     $(function () {
@@ -96,7 +102,9 @@
         e.preventDefault();
       })
     })
+
     $('.vde-tools').toolsPanel();
+    
     $('#vde-tab-quick-styles .element-font-picker select,' +
       '#vde-tab-quick-styles .element-color-picker input,' +
       '#vde-tab-quick-styles .element-background .element-checkbox'
@@ -115,5 +123,6 @@
     $('.vde-tools').vdeMessage({
         messageTemplateId: '#vde-message-template'
     });
-})(window.jQuery);
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/custom.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/custom.phtml
index 81cc96d5f02dc893145dfaf062170874bd392273..baf3ab1990e6c9c6ea8267e6a7c4f6b3dab1cf17 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/custom.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/custom.phtml
@@ -67,73 +67,81 @@
 
 
 <script type="text/javascript">
-    (function ($) {
-        $('[data-manage="fonts"]').on('click', function() {
-            MediabrowserUtility.openDialog(
-                '<?php echo $this->getMediaBrowserUrl('custom_code', \Magento\Theme\Model\Wysiwyg\Storage::TYPE_FONT) ?>',
-                null,
-                null,
-                '<?php echo $this->escapeQuote(__('Font Assets'), true); ?>'
-            );
-        });
-        $('[data-manage="images"]').on('click', function() {
-            MediabrowserUtility.openDialog(
-                '<?php echo $this->getMediaBrowserUrl('custom_code', \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE) ?>',
-                null,
-                null,
-                '<?php echo $this->escapeQuote(__('Image Assets'), true); ?>'
-            );
-        });
-        $('#vde-tab-custom').customCssPanel({
-            saveCustomCssUrl: '<?php echo $this->getSaveCustomCssUrl() ?>',
-            downloadCustomCssUrl: '<?php echo $this->getDownloadCustomCssUrl() ?>'
-        });
+require([
+    "jquery",
+    "jquery/file-uploader",
+    "Magento_DesignEditor/js/tools-files",
+    "Magento_DesignEditor/js/custom-css"
+], function($){
 
-        $( '#' + '<?php echo $this->getFileElementName() ?>' ).fileupload({
-            dataType: 'json',
-            replaceFileInput: false,
-            url : '<?php echo $this->getUploadUrl() ?>',
 
-            /**
-             * Handler of "file selected" event
-             * @param e
-             * @param data
-             */
-            add: function (e, data) {
-                data.submit();
-            },
+    $('[data-manage="fonts"]').on('click', function() {
+        MediabrowserUtility.openDialog(
+            '<?php echo $this->getMediaBrowserUrl('custom_code', \Magento\Theme\Model\Wysiwyg\Storage::TYPE_FONT) ?>',
+            null,
+            null,
+            '<?php echo $this->escapeQuote(__('Font Assets'), true); ?>'
+        );
+    });
+    $('[data-manage="images"]').on('click', function() {
+        MediabrowserUtility.openDialog(
+            '<?php echo $this->getMediaBrowserUrl('custom_code', \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE) ?>',
+            null,
+            null,
+            '<?php echo $this->escapeQuote(__('Image Assets'), true); ?>'
+        );
+    });
+    $('#vde-tab-custom').customCssPanel({
+        saveCustomCssUrl: '<?php echo $this->getSaveCustomCssUrl() ?>',
+        downloadCustomCssUrl: '<?php echo $this->getDownloadCustomCssUrl() ?>'
+    });
 
-            /**
-             * Handler on "upload ajax request done" event
-             * @param e
-             * @param data
-             */
-            done: function (e, data) {
-                var contentArea = $('#custom_code');
-                contentArea.val('');
-                $(this).val('');
-                $('#css_uploader_button').attr('disabled', true);
-                if (!data.result.error) {
-                    contentArea.val(data.result.content);
-                    $('#vde-tab-custom').customCssPanel('updateButtons');
-                    $('#vde-tab-custom').trigger('refreshIframe');
-                }
+    $( '#' + '<?php echo $this->getFileElementName() ?>' ).fileupload({
+        dataType: 'json',
+        replaceFileInput: false,
+        url : '<?php echo $this->getUploadUrl() ?>',
 
-                $('#vde-tab-custom').trigger('addMessage', {
-                    containerId: '#vde-tab-custom-messages-placeholder',
-                    message: data.result.message
-                });
-                $('.vde-tools-content').trigger('resize.vdeToolsResize');
-            },
+        /**
+         * Handler of "file selected" event
+         * @param e
+         * @param data
+         */
+        add: function (e, data) {
+            data.submit();
+        },
 
-            /**
-             * Handle on "upload ajax request fail" event
-             * @param e
-             * @param data
-             */
-            fail: function (e, data) {
+        /**
+         * Handler on "upload ajax request done" event
+         * @param e
+         * @param data
+         */
+        done: function (e, data) {
+            var contentArea = $('#custom_code');
+            contentArea.val('');
+            $(this).val('');
+            $('#css_uploader_button').attr('disabled', true);
+            if (!data.result.error) {
+                contentArea.val(data.result.content);
                 $('#vde-tab-custom').customCssPanel('updateButtons');
+                $('#vde-tab-custom').trigger('refreshIframe');
             }
-        });
-    })(jQuery);
+
+            $('#vde-tab-custom').trigger('addMessage', {
+                containerId: '#vde-tab-custom-messages-placeholder',
+                message: data.result.message
+            });
+            $('.vde-tools-content').trigger('resize.vdeToolsResize');
+        },
+
+        /**
+         * Handle on "upload ajax request fail" event
+         * @param e
+         * @param data
+         */
+        fail: function (e, data) {
+            $('#vde-tab-custom').customCssPanel('updateButtons');
+        }
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/image-sizing.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/image-sizing.phtml
index a223b4ec04442bb889ff44a7687888de4a05ba83..610c10f2124f1a54e986f52ffba29bc722ead7d2 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/image-sizing.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/image-sizing.phtml
@@ -30,15 +30,20 @@
 <?php echo $this->getFormHtml(); ?>
 </div>
 <script type="text/javascript">
-    (function ($) {
-        $('#product_image_sizing_form').vdeImageSizing({
-            formId: '#product_image_sizing_form',
-            imageRatioClass: '.image-ratio',
-            imageWidthClass: '.image-width',
-            imageHeightClass: '.image-height',
-            formUrl: '<?php echo $this->getImageSizingUrl() ?>',
-            maxSizeValue: <?php echo \Magento\DesignEditor\Model\Editor\Tools\ImageSizing\Validator::MAX_SIZE_VALUE ?>,
-            messagesContainer: '#vde-tab-imagesizing-messages-placeholder'
-        });
-    })(jQuery);
+require([
+    "jquery",
+    "Magento_DesignEditor/js/image-sizing"
+], function($){
+
+    $('#product_image_sizing_form').vdeImageSizing({
+        formId: '#product_image_sizing_form',
+        imageRatioClass: '.image-ratio',
+        imageWidthClass: '.image-width',
+        imageHeightClass: '.image-height',
+        formUrl: '<?php echo $this->getImageSizingUrl() ?>',
+        maxSizeValue: <?php echo \Magento\DesignEditor\Model\Editor\Tools\ImageSizing\Validator::MAX_SIZE_VALUE ?>,
+        messagesContainer: '#vde-tab-imagesizing-messages-placeholder'
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml
index 8c7f52baf5df8ebf2025176bf78c6f1b79f42b89..dff01c1d757874dec76fb0aaa4420619d2bba269 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml
@@ -66,141 +66,149 @@
 </li>
 
 <script type="text/javascript">
-    (function ($) {
-        $('#vde-tab-js .files-list-content .items').themeJsList({
-            templateId : '#js-uploaded-file-template',
-            emptyTemplateId: '#js-empty-template',
-            refreshFileListEvent : 'refreshJsList',
-            prefixItemId: 'js-file-'
-        });
-        $('body').trigger('refreshJsList', {jsList : <?php echo $this->getFiles() ?>});
-
-        $('#vde-tab-js .js-file .action-delete').live('click', function() {
-            if (!confirm('<?php echo $this->getConfirmMessageDelete() ?>')) {
-                return false;
+require([
+    "jquery",
+    "jquery/ui",
+    "jquery/file-uploader",
+    "mage/translate",
+    "Magento_Theme/js/custom-js-list"
+], function($){
+
+    $('#vde-tab-js .files-list-content .items').themeJsList({
+        templateId : '#js-uploaded-file-template',
+        emptyTemplateId: '#js-empty-template',
+        refreshFileListEvent : 'refreshJsList',
+        prefixItemId: 'js-file-'
+    });
+    $('body').trigger('refreshJsList', {jsList : <?php echo $this->getFiles() ?>});
+
+    $('#vde-tab-js .js-file .action-delete').live('click', function() {
+        if (!confirm('<?php echo $this->getConfirmMessageDelete() ?>')) {
+            return false;
+        }
+
+        $.ajax({
+            url: '<?php echo $this->getJsDeleteUrl(); ?>',
+            data: {js_removed_files: [$(this).data('id')]},
+            dataType: 'json'
+        }).done(function(data) {
+            if (!data.error) {
+                $('body').trigger('refreshJsList', {jsList : data.files});
+                $('#vde-tab-js .files-list-content .items').trigger('refreshIframe');
             }
 
-            $.ajax({
-                url: '<?php echo $this->getJsDeleteUrl(); ?>',
-                data: {js_removed_files: [$(this).data('id')]},
-                dataType: 'json'
-            }).done(function(data) {
-                if (!data.error) {
-                    $('body').trigger('refreshJsList', {jsList : data.files});
-                    $('#vde-tab-js .files-list-content .items').trigger('refreshIframe');
-                }
-
-                $('#vde-tab-js .js-file .action-delete').trigger('addMessage', {
-                    containerId : '#vde-tab-js-messages-placeholder',
-                    message : data.message
-                });
+            $('#vde-tab-js .js-file .action-delete').trigger('addMessage', {
+                containerId : '#vde-tab-js-messages-placeholder',
+                message : data.message
             });
-
-            return false;
         });
 
-        $('#js_files_uploader').fileupload({
-            dataType: 'json',
-            replaceFileInput: false,
-            sequentialUploads: true,
-            url : '<?php echo $this->getJsUploadUrl(); ?>',
-
-            /**
-             * Add data
-             * @param e
-             * @param data
-             */
-            add: function (e, data) {
-                $.each(data.files, function (index, file) {
-                    data.fileId =  Math.random().toString(36).substr(2,9);
-                    var progressTmpl = $('#js-file-uploader-template').children(':first').clone();
-                    progressTmpl.attr('id', data.fileId);
-                    var fileSize = typeof(file.size) == "undefined"
-                        ? $.mage.__('We could not detect a size.')
-                        : byteConvert(file.size);
-                    var fileInfoHtml = progressTmpl.html().replace('{{size}}', fileSize)
-                        .replace('{{name}}', file.name);
-                    progressTmpl.html(fileInfoHtml) ;
-                    progressTmpl.appendTo('#js-file-uploader');
-                });
-                data.submit();
-            },
-
-            /**
-             * On done event
-             * @param e
-             * @param data
-             */
-            done: function (e, data) {
-                var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
-                $(progressSelector).css('width','100%');
-
-                $(this).val('');
-                if (!data.result.error) {
-                    $(progressSelector).removeClass('upload-progress').addClass('upload-success');
-                    $('#js_files_uploader').trigger('refreshJsList', {jsList : data.result.files});
-                } else {
-                    $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
-                }
-                $('#' + data.fileId).delay(2000).fadeOut(2000);
-
-                $('#js_files_uploader').trigger('addMessage', {
-                    containerId: '#vde-tab-js-messages-placeholder',
-                    message: data.result.message
-                });
-            },
-
-            /**
-             * On progress
-             * @param e
-             * @param data
-             */
-            progress: function(e, data) {
-                var progress = parseInt(data.loaded / data.total * 100, 10);
-                var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
-                $(progressSelector).css('width', progress + '%');
-            },
-
-            stop: function(e, data) {
-                $('.ui-sortable').trigger('refreshIframe');
-            },
-
-            /**
-             * Fail event
-             * @param e
-             * @param data
-             */
-            fail: function(e, data) {
-                var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+        return false;
+    });
+
+    $('#js_files_uploader').fileupload({
+        dataType: 'json',
+        replaceFileInput: false,
+        sequentialUploads: true,
+        url : '<?php echo $this->getJsUploadUrl(); ?>',
+
+        /**
+         * Add data
+         * @param e
+         * @param data
+         */
+        add: function (e, data) {
+            $.each(data.files, function (index, file) {
+                data.fileId =  Math.random().toString(36).substr(2,9);
+                var progressTmpl = $('#js-file-uploader-template').children(':first').clone();
+                progressTmpl.attr('id', data.fileId);
+                var fileSize = typeof(file.size) == "undefined"
+                    ? $.mage.__('We could not detect a size.')
+                    : byteConvert(file.size);
+                var fileInfoHtml = progressTmpl.html().replace('{{size}}', fileSize)
+                    .replace('{{name}}', file.name);
+                progressTmpl.html(fileInfoHtml) ;
+                progressTmpl.appendTo('#js-file-uploader');
+            });
+            data.submit();
+        },
+
+        /**
+         * On done event
+         * @param e
+         * @param data
+         */
+        done: function (e, data) {
+            var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+            $(progressSelector).css('width','100%');
+
+            $(this).val('');
+            if (!data.result.error) {
+                $(progressSelector).removeClass('upload-progress').addClass('upload-success');
+                $('#js_files_uploader').trigger('refreshJsList', {jsList : data.result.files});
+            } else {
                 $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
-
-                $(this).val('');
-                alert($.mage.__('We don\'t recognize or support this file extension type.'));
             }
-        });
+            $('#' + data.fileId).delay(2000).fadeOut(2000);
 
-        $('.ui-sortable').sortable({
-            update: function( event, ui ) {
-                var jsOrder = $(this).sortable('serialize', {key: 'js_order[]'});
-                $.ajax({
-                    url: '<?php echo $this->getJsReorderUrl(); ?>',
-                    type: 'POST',
-                    dataType: 'json',
-                    data: jsOrder,
-                    showLoader: false,
-                    success: $.proxy(function(response) {
-                        $('.ui-sortable').trigger('refreshIframe');
-                        $('.ui-sortable').trigger('addMessage', {
-                            containerId : '#vde-tab-custom-messages-placeholder',
-                            message : response.message
-                        });
-                    }, this),
-                    error: $.proxy(function() {
-                        alert($.mage.__('Sorry, there was an unknown error.'));
-                    }, this)
-                });
-            }
-        });
-        $('.ui-sortable').disableSelection();
-    })(jQuery);
+            $('#js_files_uploader').trigger('addMessage', {
+                containerId: '#vde-tab-js-messages-placeholder',
+                message: data.result.message
+            });
+        },
+
+        /**
+         * On progress
+         * @param e
+         * @param data
+         */
+        progress: function(e, data) {
+            var progress = parseInt(data.loaded / data.total * 100, 10);
+            var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+            $(progressSelector).css('width', progress + '%');
+        },
+
+        stop: function(e, data) {
+            $('.ui-sortable').trigger('refreshIframe');
+        },
+
+        /**
+         * Fail event
+         * @param e
+         * @param data
+         */
+        fail: function(e, data) {
+            var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+            $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
+
+            $(this).val('');
+            alert($.mage.__('We don\'t recognize or support this file extension type.'));
+        }
+    });
+
+    $('.ui-sortable').sortable({
+        update: function( event, ui ) {
+            var jsOrder = $(this).sortable('serialize', {key: 'js_order[]'});
+            $.ajax({
+                url: '<?php echo $this->getJsReorderUrl(); ?>',
+                type: 'POST',
+                dataType: 'json',
+                data: jsOrder,
+                showLoader: false,
+                success: $.proxy(function(response) {
+                    $('.ui-sortable').trigger('refreshIframe');
+                    $('.ui-sortable').trigger('addMessage', {
+                        containerId : '#vde-tab-custom-messages-placeholder',
+                        message : response.message
+                    });
+                }, this),
+                error: $.proxy(function() {
+                    alert($.mage.__('Sorry, there was an unknown error.'));
+                }, this)
+            });
+        }
+    });
+    $('.ui-sortable').disableSelection();
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml
index 26b9a278c3e687a275331f111b2d62f2675fc10b..29f48af677c073e34e5ae8e230dfdd437a245a7f 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml
@@ -69,8 +69,16 @@
 </div>
 
 <script type="text/javascript">
+require([
+    'jquery',
+    'jquery/ui',
+    'jquery/template',
+    'jquery/file-uploader',
+    'mage/mage',
+    'mage/translate'
+], function($){
+
 //<![CDATA[
-(function($) {
     $(function () {
         $('[data-action="upload"]').on('click', function() {
             $('[data-action="browse"]').prop('disabled', true);
@@ -226,6 +234,7 @@
             }
         });
     });
-})(jQuery);
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/js.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/js.phtml
index 8ea0f500fab07b9a58859e02be35577c13f23a2a..5ab39ae972fa2840b5bb9b02b9e418f52e847e67 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/js.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/js.phtml
@@ -24,8 +24,14 @@
 ?>
 
 <script type="text/javascript">
+require([
+	'Magento_DesignEditor/js/tools-files'
+], function(){
+
 //<![CDATA[
 MediabrowserInstance = new Mediabrowser(<?php echo $this->getFilebrowserSetupObject() ?>);
 MediabrowserInstance.storeId = '<?php echo $this->getStoreId() ?>';
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml
index ed5a85765d6fa84edcafd8d1ca402f99e2aeae0f..5da00b950be6c279657946262c26d8c276abc3cd 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml
@@ -48,6 +48,11 @@
 <div id="tree" style="width:100%; overflow:auto;"></div>
 
 <script type="text/javascript">
+require([
+    'jquery',
+    'Magento_DesignEditor/js/tools-files'
+], function(jQuery){
+
 Ext.onReady(function(){
     var Tree = Ext.tree;
     var tree = new Tree.TreePanel('tree', {
@@ -91,4 +96,6 @@ Ext.onReady(function(){
             MediabrowserInstance.newFolder();
         });
     })(jQuery);
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available.phtml
index 0ca68d0c2caf7e9b35aaf3657741a7e0e2304654..05ed53559f4621ee349a67f833e1fadfeb835df9 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available.phtml
@@ -29,7 +29,11 @@
 </div>
 
 <script type="text/javascript">
-    (function ($) {
+require([
+    'jquery',
+    'Magento_DesignEditor/js/infinitescroll'
+], function($){
+
         $( document ).ready(function( ) {
             <?php if ($this->getTabId()): ?>
                 $('.infinite_scroll').infinite_scroll({
@@ -42,5 +46,6 @@
                 });
             <?php endif; ?>
         });
-    })(jQuery);
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available_ajax.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available_ajax.phtml
index baa0a67d3adda65af8d6c7f535d5afc2dc404cb6..208f939dcdd2a6f46b7a3a6966a9d75ad3a80beb 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available_ajax.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/list/available_ajax.phtml
@@ -26,5 +26,12 @@
 <?php echo join("\n", $this->getListItems()) ?>
 
 <script type="text/javascript">
+require([
+	'jquery',
+	'Magento_DesignEditor/js/infinitescroll'
+], function(jQuery){
+
     jQuery('.infinite_scroll').infinite_scroll({url :'<?php echo $this->getNextPageUrl() ?>'});
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/first_entrance.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/first_entrance.phtml
index 7b6a18ee4b50c231838d70436e77958ec600d803..9b9718b009d414c52b0c8858d4a7bae23d36f9b7 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/first_entrance.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/first_entrance.phtml
@@ -40,5 +40,12 @@
 <div>
 
 <script type="text/javascript">
+require([
+    'jquery',
+    'Magento_DesignEditor/js/infinitescroll'
+], function(jQuery){
+
     jQuery('.infinite_scroll').infinite_scroll({url :'<?php echo $this->getUrl('*/*/loadthemelist') ?>'});
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/my_customizations_tab.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/my_customizations_tab.phtml
index ff4a63f6cf97de3b6efb5bb6f5dba8182463a943..06c7159d36b08c5e2056d985a2d22773a710217b 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/my_customizations_tab.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/my_customizations_tab.phtml
@@ -28,9 +28,14 @@
 <div class="themes-unassigned"><?php echo $this->getChildHtml('unassigned.theme.list') ?></div>
 
 <script type="text/javascript">
-    (function ($) {
-        $(document).ready(function() {
-            $('body').themeDelete();
-        });
-    })(jQuery);
+require([
+	'jquery',
+	'Magento_DesignEditor/js/theme-delete'
+], function($){
+
+    $(document).ready(function() {
+        $('body').themeDelete();
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/storeview.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/storeview.phtml
index 9553840570b430f46293b9ce1c55483760135a0f..b5b97475dbe591d317b0ca8db192408934191d7f 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/storeview.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/storeview.phtml
@@ -63,9 +63,15 @@
 </div>
 
 <script type="text/javascript">
-    (function ($) {
-        $(document).ready(function() {
-            $('body').themeAssign(<?php echo $this->getOptionsJson(); ?>);
-        });
-    })(jQuery);
+require([
+    'jquery',
+    'Magento_DesignEditor/js/theme-assign'
+], function($){
+
+
+    $(document).ready(function() {
+        $('body').themeAssign(<?php echo $this->getOptionsJson(); ?>);
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/theme_edit.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/theme_edit.phtml
index 6cd32da3e5a199da75cf2154a7e770beef46f4c5..242a8c750dc7aed6f797c3fe19e9f25cc15b7aa1 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/theme_edit.phtml
+++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/theme/selector/theme_edit.phtml
@@ -24,14 +24,19 @@
 ?>
 
 <script type="text/javascript">
-    (function ($) {
-        $(document).ready(function() {
-            $('body').themeEdit({
-                dialogSelector: '#dialog-message-confirm',
-                title: '<?php echo __('Edit Theme') ?>',
-                confirmMessage: '<?php echo __('When you edit a theme, we save it as a unique version in "My Customizations."') ?>',
-                launchUrl: '<?php echo $this->getUrl('*/*/launch') ?>'
-            });
+require([
+    'jquery',
+    'Magento_DesignEditor/js/theme-edit'
+], function($){
+
+    $(document).ready(function() {
+        $('body').themeEdit({
+            dialogSelector: '#dialog-message-confirm',
+            title: '<?php echo __('Edit Theme') ?>',
+            confirmMessage: '<?php echo __('When you edit a theme, we save it as a unique version in "My Customizations."') ?>',
+            launchUrl: '<?php echo $this->getUrl('*/*/launch') ?>'
         });
-    })(jQuery);
+    });
+
+});
 </script>
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/bootstrap/edit.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/bootstrap/edit.js
new file mode 100644
index 0000000000000000000000000000000000000000..16ca2f4d92f1fa50d732f154955da83e73b33fac
--- /dev/null
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/bootstrap/edit.js
@@ -0,0 +1,27 @@
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+require([
+    "Magento_DesignEditor/js/theme-selector",
+    "Magento_DesignEditor/js/theme-assign"
+]);
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/bootstrap/launch.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/bootstrap/launch.js
new file mode 100644
index 0000000000000000000000000000000000000000..cbedde7221fd10aac3b9d727ca6ede4ef67ef1e3
--- /dev/null
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/bootstrap/launch.js
@@ -0,0 +1,28 @@
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+require([
+    "jquery/jstree/jquery.jstree",
+    "Magento_DesignEditor/js/tools",
+    "Magento_DesignEditor/js/tools-files"
+]);
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/custom-css.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/custom-css.js
index e15bb01008b9ca457c0b5d38ac24b799038c22b9..662dacb6f1e1f939fbd5d4b1fb2516c53265e540 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/custom-css.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/custom-css.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     'use strict';
+
     $.widget('vde.customCssPanel', {
         options: {
             saveCustomCssUrl: null,
@@ -111,4 +116,5 @@
             }
         }
     });
-})(window.jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js
index 75ac6da4ad2a011c809f9327f03460035d4dcd30..4fbc308c11cdb59889975afaff37cb4803a8909f 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js
@@ -21,7 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "jquery/template"
+], function($){
+
     $.widget('vde.dialog', $.ui.dialog, {
         options: {
             text: {
@@ -187,4 +193,5 @@
             this._setOption('buttons', buttons);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/image-sizing.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/image-sizing.js
index c185d02f3475f94ad9162f5f8a5b1947fc1b2b9f..c43530204c22de1dd62b4f643f71c7a65f9481ef 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/image-sizing.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/image-sizing.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
+
     $.widget('vde.vdeImageSizing', {
         options: {
             restoreDefaultDataEvent: 'restoreDefaultData',
@@ -190,4 +195,5 @@
             });
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js
index a2072fc9c643e1f1c047175efe4aa20f29d56d6b..b2ab4255f8cf343459307aa7231b08497ace89dd 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js
@@ -1,4 +1,4 @@
-    /**
+/**
  * Magento
  *
  * NOTICE OF LICENSE
@@ -20,9 +20,20 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-    /*jshint jquery:true*/
-(function($) {
+/*jshint jquery:true*/
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "mage/translate"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     'use strict';
+
     /**
      * Load theme list
      */
@@ -172,4 +183,4 @@
             }
         }
     });
-})(jQuery);
+}));
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/message.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/message.js
index f36ec967964e73e8cd79ae5a7c3583268ba9d1b9..3cf030a839b559f09221dec1285f1d8e399b16c6 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/message.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/message.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+
     $.widget('vde.vdeMessage', {
         options: {
             addMessageEvent: 'addMessage',
@@ -104,4 +109,5 @@
             messageTemplate.appendTo(containerId);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-element.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-element.js
index 15b935c4c53ffb5113bf642aae0df2fee6d1ebf0..ed99a79630bbde8a0db292d82636a11385a6ee5a 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-element.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-element.js
@@ -22,8 +22,13 @@
  */
 /*jshint jquery:true*/
 /*global alert*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     'use strict';
+
     $.widget('vde.quickStyleElement', {
         options: {
             changeEvent: 'change.quickStyleElement',
@@ -88,4 +93,5 @@
             });
         }
     });
-})(window.jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-uploader.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-uploader.js
index b76f1877ef4793184b6857556c0e694aa42e785b..a74c6bb3b53001499b4018724eec2d7e08bfb469 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-uploader.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/quick-style-uploader.js
@@ -21,9 +21,15 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "jquery/file-uploader"
+], function($){
 
     var parentWidget = ($.blueimpFP || $.blueimp).fileupload;
+    
     $.widget("vde.quickStyleUploader", parentWidget, {
         options: {
             dataType: 'json',
@@ -189,4 +195,5 @@
             return document.getElementById(id);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-assign.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-assign.js
index 0a665a4250ab69f7560376773a7e3d45c217506c..ac01b076d00cca7da14abee3b261fe23613c1fc5 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-assign.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-assign.js
@@ -21,8 +21,14 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "Magento_DesignEditor/js/dialog"
+], function($){
     'use strict';
+
     /**
      * Dialog button title
      *
@@ -458,4 +464,4 @@
         }
     });
 
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-delete.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-delete.js
index 460925142eda966102cc5c1f93aeb38b7d2410d5..56d698f24e934469ba0795e60cc28f72e210fd51 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-delete.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-delete.js
@@ -21,7 +21,14 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "jquery/template",
+    "Magento_DesignEditor/js/dialog"
+], function($){
+
     /**
      * VDE theme remove button widget
      */
@@ -117,4 +124,5 @@
             return $(this.options.dialogSelector);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-edit.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-edit.js
index 7b1f5c471e6d794d2f0e22d69ba78a537c9e2d4e..f3f5fb3b86330118a04df1e9cf364e9442440d44 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-edit.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-edit.js
@@ -21,7 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "Magento_DesignEditor/js/dialog"
+], function($){
+
     'use strict';
     /**
      * Widget theme edit
@@ -101,4 +107,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-revert.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-revert.js
index aba89cad8d5718ab32f68fbd0cdc92fdd1ffd967..86a760e0f92348c4560fc8d330c707b61f941fb9 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-revert.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-revert.js
@@ -21,7 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "Magento_DesignEditor/js/dialog"
+], function($){
+
     'use strict';
     /**
      * VDE revert theme button widget
@@ -138,4 +144,5 @@
             return this.options.dialog;
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-save.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-save.js
index 88051106cc4442bd50b42f51379a5af9f9538823..44de84eb7978efeec24e29fdcfb1268dc7c2ab85 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-save.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-save.js
@@ -20,9 +20,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "Magento_DesignEditor/js/dialog"
+], function($){
+
     /**
      * Widget theme save
      */
@@ -188,7 +193,7 @@
 
             //NOTE: Line below makes copy of eventData to have an ability to unset 'confirm.message' later
             // and to not miss this 'confirm.message' for next calls of _onSaveAndAssign
-            var tempData = jQuery.extend({}, eventData);
+            var tempData = $.extend({}, eventData);
             tempData.saveAfter = function() {};
             tempData.reportToSession = 0;
             $('body').trigger(this.options.saveConfirmEvent, tempData);
@@ -249,4 +254,5 @@
             this._super();
         }
     });
-})( jQuery );
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-selector.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-selector.js
index 771a74a5914b9d4ea786c83b974363178fd8434e..0b7637df6547ae591a18361bf5b861276f6c8df7 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-selector.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/theme-selector.js
@@ -20,8 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "Magento_DesignEditor/js/dialog"
+], function($){
 
-(function($) {
     /**
      * Theme quick edit controls
      */
@@ -182,4 +187,5 @@
         });
     });
 
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-files.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-files.js
index e70d0d9913eb985112d0543d7296b287017c7563..e4f54ad8516ae5290df5a374d89c34db1c4a2461 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-files.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-files.js
@@ -20,420 +20,433 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-MediabrowserUtility = {
-    getMaxZIndex: function() {
-        var max = 0, i;
-        var cn = document.body.childNodes;
-        for (i = 0; i < cn.length; i++) {
-            var el = cn[i];
-            var zIndex = el.nodeType == 1 ? parseInt(el.style.zIndex, 10) || 0 : 0;
-            if (zIndex < 10000) {
-                max = Math.max(max, zIndex);
-            }
-        }
-        return max + 10;
-    },
-    openDialog: function(url, width, height, title, options) {
-        var windowId = 'modal_dialog_message';
-        jQuery('body').append('<div class="popup-window magento_message" id="' + windowId + '"></div>');
-        jQuery('#' + windowId).dialog({
-            autoOpen:   false,
-            title:      title || 'Insert File...',
-            modal:      true,
-            resizable:  false,
-            width:      width || 950,
-            height:     height || 456,
-            zIndex:     this.getMaxZIndex(),
-            close:      function(event, ui) {
-                jQuery(this).dialog('destroy');
-                jQuery('#' + windowId).remove();
+define([
+    "jquery",
+    "jquery/ui",
+    "Magento_DesignEditor/js/dialog",
+    "js/theme",
+    "mage/translate",
+    "prototype",
+    "mage/adminhtml/events"
+], function(jQuery){
+
+    window.MediabrowserUtility = {
+        getMaxZIndex: function() {
+            var max = 0, i;
+            var cn = document.body.childNodes;
+            for (i = 0; i < cn.length; i++) {
+                var el = cn[i];
+                var zIndex = el.nodeType == 1 ? parseInt(el.style.zIndex, 10) || 0 : 0;
+                if (zIndex < 10000) {
+                    max = Math.max(max, zIndex);
+                }
             }
-        });
+            return max + 10;
+        },
+        openDialog: function(url, width, height, title, options) {
+            var windowId = 'modal_dialog_message';
+            jQuery('body').append('<div class="popup-window magento_message" id="' + windowId + '"></div>');
+            jQuery('#' + windowId).dialog({
+                autoOpen:   false,
+                title:      title || 'Insert File...',
+                modal:      true,
+                resizable:  false,
+                width:      width || 950,
+                height:     height || 456,
+                zIndex:     this.getMaxZIndex(),
+                close:      function(event, ui) {
+                    jQuery(this).dialog('destroy');
+                    jQuery('#' + windowId).remove();
+                }
+            });
 
-        jQuery('#' + windowId).dialog('open');
+            jQuery('#' + windowId).dialog('open');
 
-        new Ajax.Updater('modal_dialog_message', url, {evalScripts: true});
-    },
-    closeDialog: function(window) {
-        if (!window) {
-            window = this.dialogWindow;
-        }
-        if (window) {
-            // IE fix - hidden form select fields after closing dialog
-            WindowUtilities._showSelect();
-            jQuery('#modal_dialog_message').dialog('close');
+            new Ajax.Updater('modal_dialog_message', url, {evalScripts: true});
+        },
+        closeDialog: function(window) {
+            if (!window) {
+                window = this.dialogWindow;
+            }
+            if (window) {
+                // IE fix - hidden form select fields after closing dialog
+                WindowUtilities._showSelect();
+                jQuery('#modal_dialog_message').dialog('close');
+            }
         }
-    }
-};
+    };
 
-Mediabrowser = Class.create();
-Mediabrowser.prototype = {
-    targetElementId: null,
-    contentsUrl: null,
-    onInsertUrl: null,
-    newFolderUrl: null,
-    deleteFolderUrl: null,
-    deleteFilesUrl: null,
-    headerText: null,
-    tree: null,
-    currentNode: null,
-    storeId: null,
-    showBreadcrumbs: null,
-    initialize: function (setup) {
-        this.newFolderPrompt = setup.newFolderPrompt;
-        this.deleteFolderConfirmationMessage = setup.deleteFolderConfirmationMessage;
-        this.deleteFileConfirmationMessage = setup.deleteFileConfirmationMessage;
-        this.targetElementId = setup.targetElementId;
-        this.contentsUrl = setup.contentsUrl;
-        this.onInsertUrl = setup.onInsertUrl;
-        this.newFolderUrl = setup.newFolderUrl;
-        this.deleteFolderUrl = setup.deleteFolderUrl;
-        this.deleteFilesUrl = setup.deleteFilesUrl;
-        this.headerText = setup.headerText;
-        this.showBreadcrumbs = setup.showBreadcrumbs;
-    },
-    setTree: function (tree) {
-        this.tree = tree;
-        this.currentNode = tree.getRootNode();
-    },
+    window.Mediabrowser = Class.create();
 
-    getTree: function (tree) {
-        return this.tree;
-    },
+    Mediabrowser.prototype = {
+        targetElementId: null,
+        contentsUrl: null,
+        onInsertUrl: null,
+        newFolderUrl: null,
+        deleteFolderUrl: null,
+        deleteFilesUrl: null,
+        headerText: null,
+        tree: null,
+        currentNode: null,
+        storeId: null,
+        showBreadcrumbs: null,
+        initialize: function (setup) {
+            this.newFolderPrompt = setup.newFolderPrompt;
+            this.deleteFolderConfirmationMessage = setup.deleteFolderConfirmationMessage;
+            this.deleteFileConfirmationMessage = setup.deleteFileConfirmationMessage;
+            this.targetElementId = setup.targetElementId;
+            this.contentsUrl = setup.contentsUrl;
+            this.onInsertUrl = setup.onInsertUrl;
+            this.newFolderUrl = setup.newFolderUrl;
+            this.deleteFolderUrl = setup.deleteFolderUrl;
+            this.deleteFilesUrl = setup.deleteFilesUrl;
+            this.headerText = setup.headerText;
+            this.showBreadcrumbs = setup.showBreadcrumbs;
+        },
+        setTree: function (tree) {
+            this.tree = tree;
+            this.currentNode = tree.getRootNode();
+        },
 
-    selectFolder: function (node, event) {
-        this.currentNode = node;
-        this.activateBlock('contents');
+        getTree: function (tree) {
+            return this.tree;
+        },
 
-        // Activate/deactivate trash can icon
-        var dataFolderDelete = jQuery('[data-folder="delete"]');
-        if (dataFolderDelete != undefined) {
-            var deleteFolderTitle = '';
-            if(node.id == 'root') {
-                dataFolderDelete.removeClass('activate');
-            }
-            else {
-                deleteFolderTitle = jQuery.mage.__('Delete') + ' ' + node.text + ' ' + jQuery.mage.__('Folder');
-                dataFolderDelete.addClass('activate')
-                    .on('click', function() {
-                        MediabrowserInstance.deleteFolder();
-                    });
+        selectFolder: function (node, event) {
+            this.currentNode = node;
+            this.activateBlock('contents');
+
+            // Activate/deactivate trash can icon
+            var dataFolderDelete = jQuery('[data-folder="delete"]');
+            if (dataFolderDelete != undefined) {
+                var deleteFolderTitle = '';
+                if(node.id == 'root') {
+                    dataFolderDelete.removeClass('activate');
+                }
+                else {
+                    deleteFolderTitle = jQuery.mage.__('Delete') + ' ' + node.text + ' ' + jQuery.mage.__('Folder');
+                    dataFolderDelete.addClass('activate')
+                        .on('click', function() {
+                            MediabrowserInstance.deleteFolder();
+                        });
+                }
+                dataFolderDelete.on('mouseover', function() {
+                    jQuery(this).attr('title', deleteFolderTitle);
+                });
             }
-            dataFolderDelete.on('mouseover', function() {
-                jQuery(this).attr('title', deleteFolderTitle);
-            });
-        }
 
-        this.updateHeader(this.currentNode);
-        if (this.showBreadcrumbs)
-            this.drawBreadcrumbs(this.currentNode);
+            this.updateHeader(this.currentNode);
+            if (this.showBreadcrumbs)
+                this.drawBreadcrumbs(this.currentNode);
 
-        jQuery('#contents').loadingPopup({ timeout: false });
-        new Ajax.Request(this.contentsUrl, {
-            parameters: {node: this.currentNode.id},
-            evalJS: true,
-            onSuccess: function(transport) {
-                try {
-                    this.currentNode.select();
-                    this.onAjaxSuccess(transport);
-                    jQuery('#contents').trigger('hideLoadingPopup');
-                    if ($('contents') != undefined) {
-                        $('contents').update(transport.responseText);
-                        $$('div.filecnt').each(function(s) {
-                            // Bind to the Insert File button.
-                            var dataInsertFile = "[data-insert-file='" + s.id + "']";
-                            jQuery(dataInsertFile).on('click', function() {
-                                MediabrowserInstance.insert(s.id);
-                            });
-                            // Bind to the trash can.
-                            var dataDeleteFile = "[data-delete-file='" + s.id + "']";
-                            jQuery(dataDeleteFile).on('click', function() {
-                                MediabrowserInstance.deleteFiles(s.id);
-                            });
-                        }.bind(this));
+            jQuery('#contents').loadingPopup({ timeout: false });
+            new Ajax.Request(this.contentsUrl, {
+                parameters: {node: this.currentNode.id},
+                evalJS: true,
+                onSuccess: function(transport) {
+                    try {
+                        this.currentNode.select();
+                        this.onAjaxSuccess(transport);
+                        jQuery('#contents').trigger('hideLoadingPopup');
+                        if ($('contents') != undefined) {
+                            $('contents').update(transport.responseText);
+                            $$('div.filecnt').each(function(s) {
+                                // Bind to the Insert File button.
+                                var dataInsertFile = "[data-insert-file='" + s.id + "']";
+                                jQuery(dataInsertFile).on('click', function() {
+                                    MediabrowserInstance.insert(s.id);
+                                });
+                                // Bind to the trash can.
+                                var dataDeleteFile = "[data-delete-file='" + s.id + "']";
+                                jQuery(dataDeleteFile).on('click', function() {
+                                    MediabrowserInstance.deleteFiles(s.id);
+                                });
+                            }.bind(this));
+                        }
+                    } catch(e) {
+                        alert(e.message);
                     }
-                } catch(e) {
-                    alert(e.message);
-                }
-            }.bind(this)
-        });
-    },
+                }.bind(this)
+            });
+        },
 
-    selectFolderById: function (nodeId) {
-        var node = this.tree.getNodeById(nodeId);
-        if (node.id) {
-            this.selectFolder(node);
-        }
-    },
+        selectFolderById: function (nodeId) {
+            var node = this.tree.getNodeById(nodeId);
+            if (node.id) {
+                this.selectFolder(node);
+            }
+        },
 
-    handleUploadComplete: function(files) {
-        $$('div[class*="file-row complete"]').each(function(e) {
-            $(e.id).remove();
-        });
-        this.selectFolder(this.currentNode);
-    },
+        handleUploadComplete: function(files) {
+            $$('div[class*="file-row complete"]').each(function(e) {
+                $(e.id).remove();
+            });
+            this.selectFolder(this.currentNode);
+        },
 
-    insert: function(id) {
-        var targetEl = this.getTargetElement();
-        if (! targetEl) {
-            alert("Target element not found for content update");
-            jQuery('#modal_dialog_message').dialog('close');
-            return;
-        }
+        insert: function(id) {
+            var targetEl = this.getTargetElement();
+            if (! targetEl) {
+                alert("Target element not found for content update");
+                jQuery('#modal_dialog_message').dialog('close');
+                return;
+            }
 
-        var params = {filename:id, node:this.currentNode.id, store:this.storeId};
+            var params = {filename:id, node:this.currentNode.id, store:this.storeId};
 
-        if (targetEl.tagName.toLowerCase() == 'textarea') {
-            params.as_is = 1;
-        }
+            if (targetEl.tagName.toLowerCase() == 'textarea') {
+                params.as_is = 1;
+            }
 
-        jQuery('#contents').loadingPopup({ timeout: false });
-        new Ajax.Request(this.onInsertUrl, {
-            parameters: params,
-            onSuccess: function(transport) {
-                try {
-                    jQuery('#contents').trigger('hideLoadingPopup');
-                    this.onAjaxSuccess(transport);
-                    if (this.getMediaBrowserOpener()) {
-                        self.blur();
-                    }
-                    jQuery('#modal_dialog_message').dialog('close');
-                    if (targetEl.tagName.toLowerCase() == 'input') {
-                        targetEl.value = transport.responseText;
-                    } else {
-                        updateElementAtCursor(targetEl, transport.responseText);
-                        if (varienGlobalEvents) {
-                            varienGlobalEvents.fireEvent('tinymceChange');
+            jQuery('#contents').loadingPopup({ timeout: false });
+            new Ajax.Request(this.onInsertUrl, {
+                parameters: params,
+                onSuccess: function(transport) {
+                    try {
+                        jQuery('#contents').trigger('hideLoadingPopup');
+                        this.onAjaxSuccess(transport);
+                        if (this.getMediaBrowserOpener()) {
+                            self.blur();
+                        }
+                        jQuery('#modal_dialog_message').dialog('close');
+                        if (targetEl.tagName.toLowerCase() == 'input') {
+                            targetEl.value = transport.responseText;
+                        } else {
+                            updateElementAtCursor(targetEl, transport.responseText);
+                            if (varienGlobalEvents) {
+                                varienGlobalEvents.fireEvent('tinymceChange');
+                            }
                         }
+                    } catch (e) {
+                        alert(e.message);
                     }
-                } catch (e) {
-                    alert(e.message);
+                }.bind(this)
+            });
+        },
+
+        /**
+         * Find document target element in next order:
+         *  in active file browser opener:
+         *  - input field with ID: "src" in opener window
+         *  - input field with ID: "href" in opener window
+         *  in document:
+         *  - element with target ID
+         *
+         * return HTMLelement | null
+         */
+        getTargetElement: function() {
+            if (typeof(tinyMCE) != 'undefined' && tinyMCE.get(this.targetElementId)) {
+                var opener = this.getMediaBrowserOpener();
+                if ((opener)) {
+                    var targetElementId = tinyMceEditors.get(this.targetElementId).getMediaBrowserTargetElementId();
+                    return opener.document.getElementById(targetElementId);
+                } else {
+                    return null;
                 }
-            }.bind(this)
-        });
-    },
+            } else {
+                return document.getElementById(this.targetElementId);
+            }
+        },
 
-    /**
-     * Find document target element in next order:
-     *  in active file browser opener:
-     *  - input field with ID: "src" in opener window
-     *  - input field with ID: "href" in opener window
-     *  in document:
-     *  - element with target ID
-     *
-     * return HTMLelement | null
-     */
-    getTargetElement: function() {
-        if (typeof(tinyMCE) != 'undefined' && tinyMCE.get(this.targetElementId)) {
-            var opener = this.getMediaBrowserOpener();
-            if ((opener)) {
-                var targetElementId = tinyMceEditors.get(this.targetElementId).getMediaBrowserTargetElementId();
-                return opener.document.getElementById(targetElementId);
+        /**
+         * Return opener Window object if it exists, not closed and editor is active
+         *
+         * return object | null
+         */
+        getMediaBrowserOpener: function() {
+            if (typeof(tinyMCE) != 'undefined'
+                && tinyMCE.get(this.targetElementId)
+                && typeof(tinyMceEditors) != 'undefined'
+                && ! tinyMceEditors.get(this.targetElementId).getMediaBrowserOpener().closed) {
+                return tinyMceEditors.get(this.targetElementId).getMediaBrowserOpener();
             } else {
                 return null;
             }
-        } else {
-            return document.getElementById(this.targetElementId);
-        }
-    },
+        },
 
-    /**
-     * Return opener Window object if it exists, not closed and editor is active
-     *
-     * return object | null
-     */
-    getMediaBrowserOpener: function() {
-        if (typeof(tinyMCE) != 'undefined'
-            && tinyMCE.get(this.targetElementId)
-            && typeof(tinyMceEditors) != 'undefined'
-            && ! tinyMceEditors.get(this.targetElementId).getMediaBrowserOpener().closed) {
-            return tinyMceEditors.get(this.targetElementId).getMediaBrowserOpener();
-        } else {
-            return null;
-        }
-    },
+        newFolder: function() {
+            var folderName = prompt(this.newFolderPrompt);
+            if (!folderName) {
+                return false;
+            }
+            new Ajax.Request(this.newFolderUrl, {
+                parameters: {name: folderName},
+                onSuccess: function(transport) {
+                    try {
+                        this.onAjaxSuccess(transport);
+                        if (transport.responseText.isJSON()) {
+                            var response = transport.responseText.evalJSON()
+                            var newNode = new Ext.tree.AsyncTreeNode({
+                                text: response.short_name,
+                                draggable:false,
+                                id:response.id,
+                                expanded: true
+                            });
+                            var child = this.currentNode.appendChild(newNode);
+                            this.tree.expandPath(child.getPath(), '', function(success, node) {
+                                this.selectFolder(node);
+                            }.bind(this));
+                        }
+                    } catch (e) {
+                        alert(e.message);
+                    }
+                }.bind(this)
+            })
+        },
 
-    newFolder: function() {
-        var folderName = prompt(this.newFolderPrompt);
-        if (!folderName) {
-            return false;
-        }
-        new Ajax.Request(this.newFolderUrl, {
-            parameters: {name: folderName},
-            onSuccess: function(transport) {
-                try {
-                    this.onAjaxSuccess(transport);
-                    if (transport.responseText.isJSON()) {
-                        var response = transport.responseText.evalJSON()
-                        var newNode = new Ext.tree.AsyncTreeNode({
-                            text: response.short_name,
-                            draggable:false,
-                            id:response.id,
-                            expanded: true
+        deleteFolder: function() {
+            var dialogId = 'dialog-message-confirm-mediabrowser-deletefolder';
+            jQuery('body').append('<div class="ui-dialog-content ui-widget-content" id="' + dialogId + '"></div>');
+            jQuery('#' + dialogId).dialog({
+                autoOpen:    false,
+                title:       jQuery.mage.__('Delete Folder'),
+                modal:       true,
+                resizable:   false,
+                dialogClass: 'vde-dialog',
+                width:       500,
+                buttons: [{
+                    text: jQuery.mage.__('Cancel'),
+                    'class': 'action-close',
+                    click: function() {
+                        jQuery('#contents').trigger('hideLoadingPopup');
+                        jQuery('#' + dialogId).dialog('close');
+                    }
+                }, {
+                    text: jQuery.mage.__('Yes'),
+                    'class': 'primary',
+                    click: function() {
+                        new Ajax.Request(MediabrowserInstance.deleteFolderUrl, {
+                            onSuccess: function(transport) {
+                                try {
+                                    MediabrowserInstance.onAjaxSuccess(transport);
+                                    var parent = MediabrowserInstance.currentNode.parentNode;
+                                    parent.removeChild(MediabrowserInstance.currentNode);
+                                    MediabrowserInstance.selectFolder(parent);
+                                }
+                                catch (e) {
+                                    alert(e.message);
+                                }
+                            }.bind(MediabrowserInstance)
                         });
-                        var child = this.currentNode.appendChild(newNode);
-                        this.tree.expandPath(child.getPath(), '', function(success, node) {
-                            this.selectFolder(node);
-                        }.bind(this));
+                        jQuery('#' + dialogId).dialog('close');
                     }
-                } catch (e) {
-                    alert(e.message);
-                }
-            }.bind(this)
-        })
-    },
-
-    deleteFolder: function() {
-        var dialogId = 'dialog-message-confirm-mediabrowser-deletefolder';
-        jQuery('body').append('<div class="ui-dialog-content ui-widget-content" id="' + dialogId + '"></div>');
-        jQuery('#' + dialogId).dialog({
-            autoOpen:    false,
-            title:       jQuery.mage.__('Delete Folder'),
-            modal:       true,
-            resizable:   false,
-            dialogClass: 'vde-dialog',
-            width:       500,
-            buttons: [{
-                text: jQuery.mage.__('Cancel'),
-                'class': 'action-close',
-                click: function() {
-                    jQuery('#contents').trigger('hideLoadingPopup');
-                    jQuery('#' + dialogId).dialog('close');
-                }
-            }, {
-                text: jQuery.mage.__('Yes'),
-                'class': 'primary',
-                click: function() {
-                    new Ajax.Request(MediabrowserInstance.deleteFolderUrl, {
-                        onSuccess: function(transport) {
-                            try {
-                                MediabrowserInstance.onAjaxSuccess(transport);
-                                var parent = MediabrowserInstance.currentNode.parentNode;
-                                parent.removeChild(MediabrowserInstance.currentNode);
-                                MediabrowserInstance.selectFolder(parent);
-                            }
-                            catch (e) {
-                                alert(e.message);
-                            }
-                        }.bind(MediabrowserInstance)
-                    });
-                    jQuery('#' + dialogId).dialog('close');
-                }
-            }]
-        });
-        jQuery('#' + dialogId).text(jQuery.mage.__('Are you sure you want to delete the folder named') + ' "' + this.currentNode.text + '"?');
-        jQuery('#' + dialogId).dialog('open');
-    },
+                }]
+            });
+            jQuery('#' + dialogId).text(jQuery.mage.__('Are you sure you want to delete the folder named') + ' "' + this.currentNode.text + '"?');
+            jQuery('#' + dialogId).dialog('open');
+        },
 
-    deleteFiles: function(value) {
-        var ids = [];
-        ids[0] = value;
-        jQuery('#contents').loadingPopup({ timeout: false });
-        var dialogId = 'dialog-message-confirm-mediabrowser-deletefiles';
-        jQuery('body').append('<div class="ui-dialog-content ui-widget-content" id="' + dialogId + '"></div>');
-        jQuery('#' + dialogId).dialog({
-            autoOpen:    false,
-            title:       jQuery.mage.__('Delete File'),
-            modal:       true,
-            resizable:   false,
-            dialogClass: 'vde-dialog',
-            width:       500,
-            buttons: [{
-                text: jQuery.mage.__('Cancel'),
-                'class': 'action-close',
-                click: function() {
-                    jQuery('#contents').trigger('hideLoadingPopup');
-                    jQuery('#' + dialogId).dialog('close');
-                }
-            }, {
-                text: jQuery.mage.__('Yes'),
-                'class': 'primary',
-                click: function() {
-                    new Ajax.Request(MediabrowserInstance.deleteFilesUrl, {
-                        parameters: {files: Object.toJSON(ids)},
-                        onSuccess: function(transport) {
-                            try {
-                                jQuery('#contents').trigger('hideLoadingPopup');
-                                MediabrowserInstance.onAjaxSuccess(transport);
-                                MediabrowserInstance.selectFolder(MediabrowserInstance.currentNode);
-                            } catch(e) {
-                                alert(e.message);
-                            }
-                        }.bind(MediabrowserInstance)
-                    });
-                    jQuery('#' + dialogId).dialog('close');
-                }
-            }]
-        });
-        jQuery('#' + dialogId).text(this.deleteFileConfirmationMessage);
-        jQuery('#' + dialogId).dialog('open');
-    },
+        deleteFiles: function(value) {
+            var ids = [];
+            ids[0] = value;
+            jQuery('#contents').loadingPopup({ timeout: false });
+            var dialogId = 'dialog-message-confirm-mediabrowser-deletefiles';
+            jQuery('body').append('<div class="ui-dialog-content ui-widget-content" id="' + dialogId + '"></div>');
+            jQuery('#' + dialogId).dialog({
+                autoOpen:    false,
+                title:       jQuery.mage.__('Delete File'),
+                modal:       true,
+                resizable:   false,
+                dialogClass: 'vde-dialog',
+                width:       500,
+                buttons: [{
+                    text: jQuery.mage.__('Cancel'),
+                    'class': 'action-close',
+                    click: function() {
+                        jQuery('#contents').trigger('hideLoadingPopup');
+                        jQuery('#' + dialogId).dialog('close');
+                    }
+                }, {
+                    text: jQuery.mage.__('Yes'),
+                    'class': 'primary',
+                    click: function() {
+                        new Ajax.Request(MediabrowserInstance.deleteFilesUrl, {
+                            parameters: {files: Object.toJSON(ids)},
+                            onSuccess: function(transport) {
+                                try {
+                                    jQuery('#contents').trigger('hideLoadingPopup');
+                                    MediabrowserInstance.onAjaxSuccess(transport);
+                                    MediabrowserInstance.selectFolder(MediabrowserInstance.currentNode);
+                                } catch(e) {
+                                    alert(e.message);
+                                }
+                            }.bind(MediabrowserInstance)
+                        });
+                        jQuery('#' + dialogId).dialog('close');
+                    }
+                }]
+            });
+            jQuery('#' + dialogId).text(this.deleteFileConfirmationMessage);
+            jQuery('#' + dialogId).dialog('open');
+        },
 
-    drawBreadcrumbs: function(node) {
-        if ($('breadcrumbs') != undefined) {
-            $('breadcrumbs').remove();
-        }
-        if (node.id == 'root') {
-            return;
-        }
-        var path = node.getPath().split('/');
-        var breadcrumbs = '';
-        for(var i = 0, length = path.length; i < length; i++) {
-            if (path[i] == '') {
-                continue;
+        drawBreadcrumbs: function(node) {
+            if ($('breadcrumbs') != undefined) {
+                $('breadcrumbs').remove();
+            }
+            if (node.id == 'root') {
+                return;
             }
-            var currNode = this.tree.getNodeById(path[i]);
-            if (currNode.id) {
-                breadcrumbs += '<li>';
-                breadcrumbs += '<a href="#" onclick="MediabrowserInstance.selectFolderById(\'' + currNode.id + '\');">' + currNode.text + '</a>';
-                if(i < (length - 1)) {
-                    breadcrumbs += ' <span>/</span>';
+            var path = node.getPath().split('/');
+            var breadcrumbs = '';
+            for(var i = 0, length = path.length; i < length; i++) {
+                if (path[i] == '') {
+                    continue;
+                }
+                var currNode = this.tree.getNodeById(path[i]);
+                if (currNode.id) {
+                    breadcrumbs += '<li>';
+                    breadcrumbs += '<a href="#" onclick="MediabrowserInstance.selectFolderById(\'' + currNode.id + '\');">' + currNode.text + '</a>';
+                    if(i < (length - 1)) {
+                        breadcrumbs += ' <span>/</span>';
+                    }
+                    breadcrumbs += '</li>';
                 }
-                breadcrumbs += '</li>';
             }
-        }
 
-        if (breadcrumbs != '') {
-            breadcrumbs = '<ul class="breadcrumbs" id="breadcrumbs">' + breadcrumbs + '</ul>';
-            $('content_header').insert({after: breadcrumbs});
-        }
-    },
+            if (breadcrumbs != '') {
+                breadcrumbs = '<ul class="breadcrumbs" id="breadcrumbs">' + breadcrumbs + '</ul>';
+                $('content_header').insert({after: breadcrumbs});
+            }
+        },
 
-    updateHeader: function(node) {
-        var header = (node.id == 'root' ? this.headerText : node.text);
-        var dataContentText = jQuery('[data-content-text="header"]');
-        if (dataContentText != undefined) {
-            dataContentText.html(header);
-        }
-    },
+        updateHeader: function(node) {
+            var header = (node.id == 'root' ? this.headerText : node.text);
+            var dataContentText = jQuery('[data-content-text="header"]');
+            if (dataContentText != undefined) {
+                dataContentText.html(header);
+            }
+        },
 
-    activateBlock: function(id) {
-        //$$('div [id^=contents]').each(this.hideElement);
-        this.showElement(id);
-    },
+        activateBlock: function(id) {
+            //$$('div [id^=contents]').each(this.hideElement);
+            this.showElement(id);
+        },
 
-    hideElement: function(id) {
-        if ($(id) != undefined) {
-            $(id).addClassName('no-display');
-            $(id).hide();
-        }
-    },
+        hideElement: function(id) {
+            if ($(id) != undefined) {
+                $(id).addClassName('no-display');
+                $(id).hide();
+            }
+        },
 
-    showElement: function(id) {
-        if ($(id) != undefined) {
-            $(id).removeClassName('no-display');
-            $(id).show();
-        }
-    },
+        showElement: function(id) {
+            if ($(id) != undefined) {
+                $(id).removeClassName('no-display');
+                $(id).show();
+            }
+        },
 
-    onAjaxSuccess: function(transport) {
-        if (transport.responseText.isJSON()) {
-            var response = transport.responseText.evalJSON()
-            if (response.error) {
-                throw response;
-            } else if (response.ajaxExpired && response.ajaxRedirect) {
-                setLocation(response.ajaxRedirect);
+        onAjaxSuccess: function(transport) {
+            if (transport.responseText.isJSON()) {
+                var response = transport.responseText.evalJSON()
+                if (response.error) {
+                    throw response;
+                } else if (response.ajaxExpired && response.ajaxRedirect) {
+                    setLocation(response.ajaxRedirect);
+                }
             }
         }
-    }
-};
+    };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-panel.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-panel.js
index 94fc4e29b390d8fd21cc113f570f3ef44266e58d..b2bca3e2758116a1b6e0c65559c6eb23972bdcef 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-panel.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools-panel.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     'use strict';
+    
     /**
      * VDE tool panel
      */
@@ -216,4 +220,5 @@
             }, this));
         }
     });
-})(window.jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools.js
index 7b2a10c2f1fb8c6eb293dc3abbb5c0f3c6a96333..fc36369355b0f5dbfbfffc59f3ca8a2e5a7f8578 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/tools.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function(jQuery){
     'use strict';
 
     $.widget("vde.translateInlineToggle", {
@@ -243,4 +247,5 @@
             return disableInlineTranslation;
         }
     });
-})(window.jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/vde-frame.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/vde-frame.js
index 4f238746adc21572ad8c61174c30905c5fc2e54b..a6cf73d477ab2fc8d878689b0325a2ee5e1d6d40 100644
--- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/vde-frame.js
+++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/vde-frame.js
@@ -20,9 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     /**
      * Widget vde frame
      */
@@ -79,4 +82,5 @@
             this._resizeFrame();
         }
     });
-})( jQuery );
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml b/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml
index b0f9bbcbbdbb5daf32eaa4fa25a54d5922ca9e24..1f250a9966a6a0b8ad07c2faf93b992cf7d69e5e 100644
--- a/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml
+++ b/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml
@@ -24,13 +24,7 @@
 ?>
 
 <?php /** @var $this \Magento\Framework\View\Element\Template */ ?>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/loader_old.js') ?>"></script>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/bootstrap.js') ?>"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('prototype/windows/themes/default.css') ?>"/>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/edit-trigger.js') ?>"></script>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate-inline.js') ?>"></script>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate-inline-vde.js') ?>"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('mage/translate-inline-vde.css') ?>"/>
 
 <script id="translate-inline-dialog-form-template" type="text/x-jQuery-tmpl">
@@ -52,7 +46,15 @@
  </div>
 
 <script type="text/javascript">
-    (function($){
+require([
+    "jquery",
+    "mage/translate",
+    "mage/loader_old",
+    "mage/bootstrap",
+    "mage/edit-trigger",
+    "mage/translate-inline",
+    "mage/translate-inline-vde"
+], function($){
         $(window).load(function() {
             var $body = $('body');
             var $textTranslations = $('[data-translate-mode="text"]');
@@ -130,5 +132,5 @@
                 dialogWidgetElement: dialogVde
             });
         });
-    })(jQuery);
+});
 </script>
diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..b915d938c8bc78d897d917e62d5bd11cff111cde
--- /dev/null
+++ b/app/code/Magento/Dhl/composer.json
@@ -0,0 +1,29 @@
+{
+    "name": "magento/module-dhl",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Dhl"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Dhl/sql/dhl_setup/install-2.0.0.0.php b/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.0.php
similarity index 100%
rename from app/code/Magento/Dhl/sql/dhl_setup/install-2.0.0.0.php
rename to app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.0.php
diff --git a/app/code/Magento/Dhl/view/adminhtml/templates/unitofmeasure.phtml b/app/code/Magento/Dhl/view/adminhtml/templates/unitofmeasure.phtml
index c8869e7615e0ec5bc695041b6c783a642f7f03cf..e876f2d7610d542859130fad1188bfa1412bcfa8 100644
--- a/app/code/Magento/Dhl/view/adminhtml/templates/unitofmeasure.phtml
+++ b/app/code/Magento/Dhl/view/adminhtml/templates/unitofmeasure.phtml
@@ -28,6 +28,8 @@
  */
 ?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
     //<![CDATA[
     function changeDimensions()
     {
@@ -43,9 +45,14 @@
 
         $('carriers_dhl_divide_order_weight').next().down().innerHTML = dhlUnitOfMeasureNote;
     }
+
+    window.changeDimensions = changeDimensions;
+
     document.observe("dom:loaded", function() {
         $("carriers_dhl_unit_of_measure").observe("change", changeDimensions);
         changeDimensions();
     });
     //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1ad64b018d66dcac48931a1eb832b8a1c2aa7b9f
--- /dev/null
+++ b/app/code/Magento/Directory/composer.json
@@ -0,0 +1,23 @@
+{
+    "name": "magento/module-directory",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Directory"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php b/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php
index 8ac471bd8c01ed5219007aa4d0d58098ad6f6516..8bea0d12dc42e9306adb794764ca15b57a00fce6 100644
--- a/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php
@@ -36,7 +36,7 @@ $table = $installer->getConnection()->newTable(
     'country_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     2,
-    array('nullable' => false, 'primary' => true, 'default' => ''),
+    array('nullable' => false, 'primary' => true, 'default' => false),
     'Country Id in ISO-2'
 )->addColumn(
     'iso2_code',
@@ -143,7 +143,7 @@ $table = $installer->getConnection()->newTable(
     'locale',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     8,
-    array('nullable' => false, 'primary' => true, 'default' => ''),
+    array('nullable' => false, 'primary' => true, 'default' => false),
     'Locale'
 )->addColumn(
     'region_id',
@@ -181,13 +181,13 @@ $table = $installer->getConnection()->newTable(
     'currency_from',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     3,
-    array('nullable' => false, 'primary' => true, 'default' => ''),
+    array('nullable' => false, 'primary' => true, 'default' => false),
     'Currency Code Convert From'
 )->addColumn(
     'currency_to',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     3,
-    array('nullable' => false, 'primary' => true, 'default' => ''),
+    array('nullable' => false, 'primary' => true, 'default' => false),
     'Currency Code Convert To'
 )->addColumn(
     'rate',
diff --git a/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml b/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml
index abe36fc2edcfb26529468e9f6608666ce355ebc4..37a8ce04881da1e46bc977a009d46f485c0349d3 100644
--- a/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml
+++ b/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml
@@ -31,6 +31,11 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    "prototype",
+    "mage/adminhtml/events"
+], function(){
+
 //<![CDATA[
 optionalZipCountries = <?php echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>;
 
@@ -60,5 +65,11 @@ function setPostcodeOptional(zipElement, country) {
 }
 
 varienGlobalEvents.attachEventHandler("address_country_changed", onAddressCountryChanged);
+
+window.setPostcodeOptional = setPostcodeOptional;
+window.onAddressCountryChanged = onAddressCountryChanged;
+window.optionalZipCountries = optionalZipCountries;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd70a1987014a515326a35f70bfd0e9580a3a520
--- /dev/null
+++ b/app/code/Magento/Downloadable/composer.json
@@ -0,0 +1,34 @@
+{
+    "name": "magento/module-downloadable",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-gift-message": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Downloadable"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Downloadable/data/downloadable_setup/data-install-1.6.0.0.php b/app/code/Magento/Downloadable/data/downloadable_setup/data-install-1.6.0.0.php
index e41cce3287848a665e5bceb8555e9ebce745531b..d0711c439413752402abe1ea2f2cebf4a70bf422 100644
--- a/app/code/Magento/Downloadable/data/downloadable_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Downloadable/data/downloadable_setup/data-install-1.6.0.0.php
@@ -23,6 +23,110 @@
  */
 /** @var $installer \Magento\Downloadable\Model\Resource\Setup */
 $installer = $this;
+/**
+ * Add attributes to the eav/attribute table
+ */
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'links_purchased_separately',
+    array(
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => 'Links can be purchased separately',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'unique' => false,
+        'apply_to' => 'downloadable',
+        'used_in_product_listing' => true
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'samples_title',
+    array(
+        'type' => 'varchar',
+        'backend' => '',
+        'frontend' => '',
+        'label' => 'Samples title',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'unique' => false,
+        'apply_to' => 'downloadable'
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'links_title',
+    array(
+        'type' => 'varchar',
+        'backend' => '',
+        'frontend' => '',
+        'label' => 'Links title',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
+        'visible' => false,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'unique' => false,
+        'apply_to' => 'downloadable'
+    )
+);
+
+$installer->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'links_exist',
+    array(
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => '',
+        'input' => '',
+        'class' => '',
+        'source' => '',
+        'global' => true,
+        'visible' => false,
+        'required' => false,
+        'user_defined' => false,
+        'default' => '0',
+        'searchable' => false,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'unique' => false,
+        'apply_to' => 'downloadable',
+        'used_in_product_listing' => 1
+    )
+);
 
 $fieldList = array(
     'price',
diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
similarity index 100%
rename from app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0-1.6.0.0.1.php
rename to app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php
diff --git a/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
new file mode 100644
index 0000000000000000000000000000000000000000..e4b285ec4adc21810d3b4d79375cee2ab13dc7d4
--- /dev/null
+++ b/app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var $installer \Magento\Catalog\Model\Resource\Setup */
+$installer = $this;
+
+$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price', 'apply_to'));
+if (!in_array(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, $applyTo)) {
+    $applyTo[] = \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE;
+    $installer->updateAttribute(
+        \Magento\Catalog\Model\Product::ENTITY,
+        'group_price',
+        'apply_to',
+        implode(',', $applyTo)
+    );
+}
diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
index 8f1a552ea96d35375d350f64f4a1b9431e929cf6..d798125fcca100e888b025f6b7480e1887921eab 100644
--- a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
@@ -651,110 +651,4 @@ $table = $installer->getConnection()->newTable(
 );
 $installer->getConnection()->createTable($table);
 
-
-/**
- * Add attributes to the eav/attribute table
- */
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'links_purchased_separately',
-    array(
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => 'Links can be purchased separately',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'unique' => false,
-        'apply_to' => 'downloadable',
-        'used_in_product_listing' => true
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'samples_title',
-    array(
-        'type' => 'varchar',
-        'backend' => '',
-        'frontend' => '',
-        'label' => 'Samples title',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'unique' => false,
-        'apply_to' => 'downloadable'
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'links_title',
-    array(
-        'type' => 'varchar',
-        'backend' => '',
-        'frontend' => '',
-        'label' => 'Links title',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
-        'visible' => false,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'unique' => false,
-        'apply_to' => 'downloadable'
-    )
-);
-
-$installer->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'links_exist',
-    array(
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => '',
-        'input' => '',
-        'class' => '',
-        'source' => '',
-        'global' => true,
-        'visible' => false,
-        'required' => false,
-        'user_defined' => false,
-        'default' => '0',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'unique' => false,
-        'apply_to' => 'downloadable',
-        'used_in_product_listing' => 1
-    )
-);
-
 $installer->endSetup();
diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php
deleted file mode 100644
index 23e387cbaa4616f3cde4afc75df65b686692f5bd..0000000000000000000000000000000000000000
--- a/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-
-/** @var $this \Magento\Catalog\Model\Resource\Setup */
-$installFile = __DIR__ . '/upgrade-1.6.0.0.1-1.6.0.0.2.php';
-
-/** @var \Magento\Framework\Filesystem\Directory\Read $moduleDirectory */
-$moduleDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Framework\App\Filesystem::MODULES_DIR);
-if ($moduleDirectory->isExist($moduleDirectory->getRelativePath($installFile))) {
-    include $installFile;
-}
-
-/** @var $connection \Magento\Framework\DB\Adapter\Pdo\Mysql */
-$connection = $this->getConnection();
-$connection->changeTableEngine(
-    $this->getTable('catalog_product_index_price_downlod_tmp'),
-    \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY
-);
diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
index e4b285ec4adc21810d3b4d79375cee2ab13dc7d4..ba34b27644e2f0229e55cdbab1e1a5c6618eb875 100644
--- a/app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
+++ b/app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
@@ -22,16 +22,11 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/** @var $installer \Magento\Catalog\Model\Resource\Setup */
-$installer = $this;
 
-$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price', 'apply_to'));
-if (!in_array(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, $applyTo)) {
-    $applyTo[] = \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE;
-    $installer->updateAttribute(
-        \Magento\Catalog\Model\Product::ENTITY,
-        'group_price',
-        'apply_to',
-        implode(',', $applyTo)
-    );
-}
+/** @var $this \Magento\Catalog\Model\Resource\Setup */
+/** @var $connection \Magento\Framework\DB\Adapter\Pdo\Mysql */
+$connection = $this->getConnection();
+$connection->changeTableEngine(
+    $this->getTable('catalog_product_index_price_downlod_tmp'),
+    \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY
+);
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml
index 7738016e31fd600e06b7157d5ef9381e84a5436a..edf198d7fd4a3c02597628ce478a80b9072fa0cd 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml
@@ -52,11 +52,15 @@
                     </label>
                 <?php if ($_isRequired): ?>
                     <script type="text/javascript">
-                        //<![CDATA[
-                        $('links_<?php echo $_link->getId() ?>').advaiceContainer = 'links-advice-container';
-                        $('links_<?php echo $_link->getId() ?>').callbackFunction = 'validateDownloadableCallback';
-                        //]]>
-                    </script>
+require(['prototype'], function(){
+
+    //<![CDATA[
+    $('links_<?php echo $_link->getId() ?>').advaiceContainer = 'links-advice-container';
+    $('links_<?php echo $_link->getId() ?>').callbackFunction = 'validateDownloadableCallback';
+    //]]>
+                    
+});
+</script>
                 <?php endif; ?>
             </div>
             <?php endforeach; ?>
@@ -68,17 +72,21 @@
 </fieldset>
 
     <script type="text/javascript">
-    //<![CDATA[
-        validateDownloadableCallback = function (elmId, result) {
-            var container = $('downloadable-links-list');
-            if (result == 'failed') {
-                container.removeClassName('validation-passed');
-                container.addClassName('validation-failed');
-            } else {
-                container.removeClassName('validation-failed');
-                container.addClassName('validation-passed');
-            }
+require(['prototype'], function(){
+
+//<![CDATA[
+    validateDownloadableCallback = function (elmId, result) {
+        var container = $('downloadable-links-list');
+        if (result == 'failed') {
+            container.removeClassName('validation-passed');
+            container.addClassName('validation-failed');
+        } else {
+            container.removeClassName('validation-failed');
+            container.addClassName('validation-passed');
         }
-    //]]>
-    </script>
+    }
+//]]>
+    
+});
+</script>
 <?php endif;?>
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml
index 1f9cb2f8bdf628db1715a40d8672df3a6af7647c..40923be1172a59bfc385eab95d09761e7fae607a 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml
@@ -29,185 +29,197 @@
  */
 ?>
 <script type="text/javascript">
-//<![CDATA[>
+require([
+    'jquery',
+    'mage/mage',
+    'prototype'
+], function(jQuery){
 
+//<![CDATA[>
 var uploaderTemplate = '<div class="no-display" id="[[idName]]-template">' +
-                            '<div id="{{id}}" class="file-row file-row-narrow">' +
-                                '<span class="file-info">' +
-                                    '<span class="file-info-name">{{name}}</span>' +
-                                    ' ' +
-                                    '<span class="file-info-size">({{size}})</span>' +
-                                '</span>' +
-                                '<div class="progressbar-container">' +
-                                    '<div class="progressbar upload-progress" style="width: 0%;"></div>' +
+                                '<div id="{{id}}" class="file-row file-row-narrow">' +
+                                    '<span class="file-info">' +
+                                        '<span class="file-info-name">{{name}}</span>' +
+                                        ' ' +
+                                        '<span class="file-info-size">({{size}})</span>' +
+                                    '</span>' +
+                                    '<div class="progressbar-container">' +
+                                        '<div class="progressbar upload-progress" style="width: 0%;"></div>' +
+                                    '</div>' +
+                                    '<div class="clear"></div>' +
                                 '</div>' +
-                                '<div class="clear"></div>' +
                             '</div>' +
-                        '</div>' +
-                            '<div class="no-display" id="[[idName]]-template-progress">' +
-                            '{{percent}}% {{uploaded}} / {{total}}' +
-                            '</div>';
-
-var fileListTemplate = '<span class="file-info">' +
-                            '<span class="file-info-name">{{name}}</span>' +
-                            ' ' +
-                            '<span class="file-info-size">({{size}})</span>' +
-                        '</span>';
-
-var Downloadable = {
-    uploaderObj : $H({}),
-    objCount : 0,
-    setUploaderObj : function(type, key, obj){
-        if (!this.uploaderObj.get(type)) {
-            this.uploaderObj.set(type, $H({}));
-        }
-        this.uploaderObj.get(type).set(key, obj);
-    },
-    getUploaderObj : function(type, key){
-        try {
-            return this.uploaderObj.get(type).get(key);
-        } catch (e) {
+                                '<div class="no-display" id="[[idName]]-template-progress">' +
+                                '{{percent}}% {{uploaded}} / {{total}}' +
+                                '</div>';
+
+    var fileListTemplate = '<span class="file-info">' +
+                                '<span class="file-info-name">{{name}}</span>' +
+                                ' ' +
+                                '<span class="file-info-size">({{size}})</span>' +
+                            '</span>';
+
+    window.Downloadable = {
+        uploaderObj : $H({}),
+        objCount : 0,
+        setUploaderObj : function(type, key, obj){
+            if (!this.uploaderObj.get(type)) {
+                this.uploaderObj.set(type, $H({}));
+            }
+            this.uploaderObj.get(type).set(key, obj);
+        },
+        getUploaderObj : function(type, key){
             try {
-                console.log(e);
-            } catch (e2) {
-                alert(e.name + '\n' + e.message);
+                return this.uploaderObj.get(type).get(key);
+            } catch (e) {
+                try {
+                    console.log(e);
+                } catch (e2) {
+                    alert(e.name + '\n' + e.message);
+                }
             }
-        }
-    },
-    unsetUploaderObj : function(type, key){
-        try {
-            this.uploaderObj.get(type).unset(key);
-        } catch (e) {
+        },
+        unsetUploaderObj : function(type, key){
+            try {
+                this.uploaderObj.get(type).unset(key);
+            } catch (e) {
+                try {
+                    console.log(e);
+                } catch (e2) {
+                    alert(e.name + '\n' + e.message);
+                }
+            }
+        },
+        massUploadByType : function(type){
             try {
-                console.log(e);
-            } catch (e2) {
-                alert(e.name + '\n' + e.message);
+                this.uploaderObj.get(type).each(function(item){
+                    container = item.value.container.up('tr');
+                    if (container.visible() && !container.hasClassName('no-display')) {
+                        item.value.upload();
+                    } else {
+                        Downloadable.unsetUploaderObj(type, item.key);
+                    }
+                });
+            } catch (e) {
+                try {
+                    console.log(e);
+                } catch (e2) {
+                    alert(e.name + '\n' + e.message);
+                }
             }
         }
-    },
-    massUploadByType : function(type){
-        try {
-            this.uploaderObj.get(type).each(function(item){
-                container = item.value.container.up('tr');
-                if (container.visible() && !container.hasClassName('no-display')) {
-                    item.value.upload();
-                } else {
-                    Downloadable.unsetUploaderObj(type, item.key);
+    };
+
+    Downloadable.FileUploader = Class.create();
+    Downloadable.FileUploader.prototype = {
+        type : null,
+        key : null, //key, identifier of uploader obj
+        elmContainer : null, //insert Flex object and templates to elmContainer
+        fileValueName : null, //name of field of JSON data of saved file
+        fileValue : null,
+        idName : null, //id name of elements for unique uploader
+        uploaderText: uploaderTemplate,
+        uploaderSyntax : /(^|.|\r|\n)(\[\[(\w+)\]\])/,
+        uploaderObj : $H({}),
+        config : null,
+        initialize: function (type, key, elmContainer, fileValueName, fileValue ,idName, config) {
+            this.type = type;
+            this.key = key;
+            this.elmContainer = elmContainer;
+            this.fileValueName = fileValueName;
+            this.fileValue = fileValue;
+            this.idName = idName;
+            this.config = config;
+            uploaderTemplate = new Template(this.uploaderText, this.uploaderSyntax);
+            <?php if (!$this->isReadonly()):?>
+            Element.insert(
+                elmContainer,
+                {'top' : uploaderTemplate.evaluate({
+                        'idName' : this.idName,
+                        'fileValueName' : this.fileValueName,
+                        'uploaderObj' : 'Downloadable.getUploaderObj(\''+this.type+'\', \''+this.key+'\')'
+                    })
                 }
-            });
-        } catch (e) {
-            try {
-                console.log(e);
-            } catch (e2) {
-                alert(e.name + '\n' + e.message);
+            );
+            if ($(this.idName+'_save')) {
+                $(this.idName+'_save').value = this.fileValue.toJSON
+                   ? this.fileValue.toJSON()
+                   : Object.toJSON(this.fileValue);
             }
+            Downloadable.setUploaderObj(
+                this.type,
+                this.key,
+                null
+            );
+            new Downloadable.FileList(this.idName, null);
+            <?php endif;?>
         }
     }
-};
-
-Downloadable.FileUploader = Class.create();
-Downloadable.FileUploader.prototype = {
-    type : null,
-    key : null, //key, identifier of uploader obj
-    elmContainer : null, //insert Flex object and templates to elmContainer
-    fileValueName : null, //name of field of JSON data of saved file
-    fileValue : null,
-    idName : null, //id name of elements for unique uploader
-    uploaderText: uploaderTemplate,
-    uploaderSyntax : /(^|.|\r|\n)(\[\[(\w+)\]\])/,
-    uploaderObj : $H({}),
-    config : null,
-    initialize: function (type, key, elmContainer, fileValueName, fileValue ,idName, config) {
-        this.type = type;
-        this.key = key;
-        this.elmContainer = elmContainer;
-        this.fileValueName = fileValueName;
-        this.fileValue = fileValue;
-        this.idName = idName;
-        this.config = config;
-        uploaderTemplate = new Template(this.uploaderText, this.uploaderSyntax);
-        <?php if (!$this->isReadonly()):?>
-        Element.insert(
-            elmContainer,
-            {'top' : uploaderTemplate.evaluate({
-                    'idName' : this.idName,
-                    'fileValueName' : this.fileValueName,
-                    'uploaderObj' : 'Downloadable.getUploaderObj(\''+this.type+'\', \''+this.key+'\')'
-                })
+
+    Downloadable.FileList = Class.create();
+    Downloadable.FileList.prototype = {
+        file: [],
+        containerId: '',
+        container: null,
+        uploader: null,
+        fileListTemplate: fileListTemplate,
+        templatePattern : /(^|.|\r|\n)({{(\w+)}})/,
+        listTemplate : null,
+        initialize: function (containerId, uploader) {
+            this.containerId  = containerId,
+            this.container = $(this.containerId);
+            this.uploader = uploader;
+            this.file = this.getElement('save').value.evalJSON();
+            this.listTemplate = new Template(this.fileListTemplate, this.templatePattern);
+            this.updateFiles();
+        },
+        handleFileRemoveAll: function(fileId) {
+            $(this.containerId+'-new').hide();
+            $(this.containerId+'-old').show();
+        },
+        handleFileSelect: function() {
+            $(this.containerId+'_type').checked = true;
+        },
+        getElement: function (name) {
+            return $(this.containerId + '_' + name);
+        },
+        handleUploadComplete: function (file) {
+            if (file.error) {
+                return;
             }
-        );
-        if ($(this.idName+'_save')) {
-            $(this.idName+'_save').value = this.fileValue.toJSON
-               ? this.fileValue.toJSON()
-               : Object.toJSON(this.fileValue);
+
+            var newFile = {};
+            newFile.file = file.file;
+            newFile.name = file.name;
+            newFile.size = file.size;
+            newFile.status = 'new';
+            this.file[0] = newFile;
+            this.updateFiles();
+        },
+        updateFiles: function() {
+            this.getElement('save').value = this.file.toJSON
+                ? this.file.toJSON()
+                : Object.toJSON(this.file);
+            this.file.each(function(row){
+                row.size = byteConvert(row.size);
+                $(this.containerId + '-old').innerHTML = this.listTemplate.evaluate(row);
+                $(this.containerId + '-new').hide();
+                $(this.containerId + '-old').show();
+            }.bind(this));
         }
-        Downloadable.setUploaderObj(
-            this.type,
-            this.key,
-            null
-        );
-        new Downloadable.FileList(this.idName, null);
-        <?php endif;?>
     }
-}
-
-Downloadable.FileList = Class.create();
-Downloadable.FileList.prototype = {
-    file: [],
-    containerId: '',
-    container: null,
-    uploader: null,
-    fileListTemplate: fileListTemplate,
-    templatePattern : /(^|.|\r|\n)({{(\w+)}})/,
-    listTemplate : null,
-    initialize: function (containerId, uploader) {
-        this.containerId  = containerId,
-        this.container = $(this.containerId);
-        this.uploader = uploader;
-        this.file = this.getElement('save').value.evalJSON();
-        this.listTemplate = new Template(this.fileListTemplate, this.templatePattern);
-        this.updateFiles();
-    },
-    handleFileRemoveAll: function(fileId) {
-        $(this.containerId+'-new').hide();
-        $(this.containerId+'-old').show();
-    },
-    handleFileSelect: function() {
-        $(this.containerId+'_type').checked = true;
-    },
-    getElement: function (name) {
-        return $(this.containerId + '_' + name);
-    },
-    handleUploadComplete: function (file) {
-        if (file.error) {
-            return;
-        }
 
-        var newFile = {};
-        newFile.file = file.file;
-        newFile.name = file.name;
-        newFile.size = file.size;
-        newFile.status = 'new';
-        this.file[0] = newFile;
-        this.updateFiles();
-    },
-    updateFiles: function() {
-        this.getElement('save').value = this.file.toJSON
-            ? this.file.toJSON()
-            : Object.toJSON(this.file);
-        this.file.each(function(row){
-            row.size = byteConvert(row.size);
-            $(this.containerId + '-old').innerHTML = this.listTemplate.evaluate(row);
-            $(this.containerId + '-new').hide();
-            $(this.containerId + '-old').show();
-        }.bind(this));
-    }
-}
+    var alertAlreadyDisplayed = false;
+
+    window.fileListTemplate = fileListTemplate;
+    window.uploaderTemplate = uploaderTemplate;
 
-var alertAlreadyDisplayed = false;
-jQuery.mage.extend('validation', 'validation',
-    '<?php echo $this->getViewFileUrl('Magento_Downloadable::product/validation-rules.js'); ?>');
+    window.alertAlreadyDisplayed = alertAlreadyDisplayed;
+
+	jQuery.mage.extend('validation', 'validation', 'Magento_Downloadable/product/validation-rules');
 //]]>
+
+});
 </script>
 
 <div id="alert_messages_block"><?php echo $this->getMessageHtml() ?></div>
@@ -220,11 +232,15 @@ jQuery.mage.extend('validation', 'validation',
 </div>
 <?php if ($this->isReadonly()): ?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 $(<?= $this->getContentTabId(); ?>).select('input', 'select', 'textarea', 'button').each(function (item){
     item.disabled = true;
     if (item.tagName.toLowerCase() == 'button') {
         item.addClassName('disabled');
     }
 });
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml
index f68b388ba10cd138192309f8706d05793db4fbea..69db92278484c06b55322f74864e4481eb574b5b 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml
@@ -84,6 +84,13 @@
 
 </div>
 <script type="text/javascript">
+require([
+    'jquery',
+    'jquery/file-uploader',
+    'mage/mage',
+    'prototype'
+], function(jQuery){
+
 //<![CDATA[
 var linkTemplate = '<tr>'+
     '<td>'+
@@ -408,7 +415,8 @@ if($('add_link_item')) {
 <?php foreach ($this->getLinkData() as $item): ?>
     linkItems.add(<?php echo $item->toJson()?>);
 <?php endforeach; ?>
-jQuery.mage.extend('validation', 'validation',
-    '<?php echo $this->getViewFileUrl('Magento_Downloadable::product/validation-rules.js'); ?>');
+jQuery.mage.extend('validation', 'validation', 'Magento_Downloadable/product/validation-rules');
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml
index 2b48770063207d8816273f1b0f349c0fbf62066b..41b453a9236d30fb2f85eab109a39fa1e88fadb4 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml
@@ -66,6 +66,12 @@ $this->getConfigJson();
     <div><small><?php echo __('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.')?></small></div>
 </div>
 <script type="text/javascript">
+require([
+    'jquery',
+    'jquery/file-uploader',
+    'prototype'
+], function(jQuery){
+
 //<![CDATA[>
 var sampleTemplate = '<tr>'+
                         '<td>'+
@@ -108,7 +114,7 @@ var sampleTemplate = '<tr>'+
                             '<button type="button" class="action- scalable delete icon-btn delete-sample-item"><span>Delete</span></button>'+
                         '</td>'+
                     '</tr>';
-var sampleItems = {
+sampleItems = {
     tbody: $('sample_items_body'),
     templateSyntax: /(^|.|\r|\n)({{(\w+)}})/,
     templateText: sampleTemplate,
@@ -245,15 +251,6 @@ sampleUploader = function (id) {
     })(jQuery, id);
 };
 
-
-if($('add_sample_item')){
-    Event.observe('add_sample_item', 'click', sampleItems.add.bind(sampleItems));
-}
-
-<?php foreach ($this->getSampleData() as $item): ?>
-    sampleItems.add(<?php echo $item->toJson() ?>);
-<?php endforeach; ?>
-
-//]]>
+});
 </script>
 
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/creditmemo/name.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/creditmemo/name.phtml
index 6ac7bdb9030edeac8c6ee12d9ce12c1889720403..aca9ebb48ae271c126dad4727e1bb8d1aeae1db1 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/creditmemo/name.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/creditmemo/name.phtml
@@ -38,10 +38,14 @@
                 <?php if ($_remainder):?>
                     ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                     <script type="text/javascript">
-                    $('<?php echo $_id ?>').hide();
-                    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                    </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                    
+});
+</script>
                 <?php endif;?>
             <?php endif;?>
             </dd>
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/invoice/name.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/invoice/name.phtml
index 5f4a8a95959528a6a31c4a611cdaaf3fa237409c..b24093b2c02ef0de668f4cd3df76b465b31d37c6 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/invoice/name.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/invoice/name.phtml
@@ -38,10 +38,14 @@
                 <?php if ($_remainder):?>
                     ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                     <script type="text/javascript">
-                    $('<?php echo $_id ?>').hide();
-                    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                    </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                    
+});
+</script>
                 <?php endif;?>
             <?php endif;?>
             </dd>
diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/name.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/name.phtml
index 774ac0f977c67064816cab46e08b637ce49c36a2..6fed126983e1610384fae154bf8df39fe00a743e 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/name.phtml
+++ b/app/code/Magento/Downloadable/view/adminhtml/templates/sales/items/column/downloadable/name.phtml
@@ -38,10 +38,14 @@
                 <?php if ($_remainder):?>
                     ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span>
                     <script type="text/javascript">
-                    $('<?php echo $_id ?>').hide();
-                    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                    </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+                    
+});
+</script>
                 <?php endif;?>
             <?php endif;?>
             </dd>
diff --git a/app/code/Magento/Downloadable/view/adminhtml/web/product/validation-rules.js b/app/code/Magento/Downloadable/view/adminhtml/web/product/validation-rules.js
index 94775b7207cd0374b5165a162205d27dfe3fe3e3..928e2f8bcad48b893f0f924bdbb7708637386546 100644
--- a/app/code/Magento/Downloadable/view/adminhtml/web/product/validation-rules.js
+++ b/app/code/Magento/Downloadable/view/adminhtml/web/product/validation-rules.js
@@ -23,7 +23,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*global newFileContainer:true, alertAlreadyDisplayed:true, alert:true, linkType:true*/
-(function ($) {
+define([
+    "jquery",
+    "mage/validation",
+    "mage/translate"
+], function($){
+
     $.validator.addMethod('validate-downloadable-file', function (v, element) {
         var elmParent = $(element).parent(),
             linkType = elmParent.find('input[value="file"]');
@@ -46,4 +51,5 @@
         }
         return true;
     }, 'Please specify Url.');
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml b/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml
index 23e86d8f57de95ea67a222748a55972cf9ce8bcf..aae54e11456959c24faef1b7dda550e52bf94a61 100644
--- a/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml
+++ b/app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml
@@ -84,8 +84,12 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite
                 <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
                 <a id="<?php echo $helpLinkId ?>" href="#" class="action help map"><?php echo __("What's this?"); ?></a>
                 <script type="text/javascript">
-                    Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo __("What's this?") ?>");
-                </script>
+require(['prototype'], function(){
+
+    Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo __("What's this?") ?>");
+                
+});
+</script>
             </span>
             <?php $cols++; ?>
         </td>
@@ -299,7 +303,11 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite
                 <?php if ($isVisibleProduct): ?>
                     <a class="action edit" href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo __('Edit item parameters') ?>"><span><?php echo __('Edit') ?></span></a>
                 <?php endif ?>
-                <a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo __('Remove item')?>" class="action delete"><span><?php echo __('Remove item')?></span></a>
+                <button title="<?php echo __('Remove item') ?>"
+                        class="action delete"
+                        data-post='<?php echo $this->helper('Magento\Checkout\Helper\Cart')->getDeletePostJson($_item); ?>'>
+                    <span><?php echo __('Remove item')?></span>
+                </button>
             </div>
         </td>
     </tr>
diff --git a/app/code/Magento/Downloadable/view/frontend/templates/js/components.phtml b/app/code/Magento/Downloadable/view/frontend/templates/js/components.phtml
index f75d54b1a89fa3f749ec741a4594133cf8c49c99..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Downloadable/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Downloadable/view/frontend/templates/js/components.phtml
@@ -22,17 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            downloadable: [
-                '<?php echo $this->getViewFileUrl('Magento_Downloadable::downloadable.js')?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Downloadable/view/frontend/web/downloadable.js b/app/code/Magento/Downloadable/view/frontend/web/downloadable.js
index 317a1af922e80abffe94ebf4599e755c3b5185a9..86931ae8cac470d0ceb9e97c149c2c4059957f82 100644
--- a/app/code/Magento/Downloadable/view/frontend/web/downloadable.js
+++ b/app/code/Magento/Downloadable/view/frontend/web/downloadable.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.downloadable', {
         _create: function() {
             this.element.find(this.options.linkElement).on('change', $.proxy(function() {
@@ -55,4 +59,4 @@
             }).trigger('reloadPrice');
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..650b3fa8db6bda86d4f192418aa65958a038a4b7
--- /dev/null
+++ b/app/code/Magento/Eav/composer.json
@@ -0,0 +1,23 @@
+{
+    "name": "magento/module-eav",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Eav"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.1-1.6.0.2.php
new file mode 100644
index 0000000000000000000000000000000000000000..cd8318b2526c14d2a74f847049f450d9fb033158
--- /dev/null
+++ b/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.1-1.6.0.2.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var $installer \Magento\Framework\Module\Setup\Migration */
+$installer = $this;
+$installer->startSetup();
+/** @var $groups \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection*/
+$groups = $installer->getAttributeGroupCollectionFactory();
+foreach ($groups as $group) {
+    /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/
+    $group->save();
+}
+
+$installer->endSetup();
diff --git a/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php b/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php
index b903a3ccab36a9f051ac3921490a5b2a20ec262e..481dd5f0f34e27d149f8dd41bea4befe85cdf902 100644
--- a/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php
@@ -96,7 +96,7 @@ $table = $installer->getConnection()->newTable(
     'increment_model',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     255,
-    array('nullable' => true, 'default' => ''),
+    array('nullable' => true, 'default' => false),
     'Increment Model'
 )->addColumn(
     'increment_per_store',
@@ -120,7 +120,7 @@ $table = $installer->getConnection()->newTable(
     'additional_attribute_table',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     255,
-    array('nullable' => true, 'default' => ''),
+    array('nullable' => true, 'default' => false),
     'Additional Attribute Table'
 )->addColumn(
     'entity_attribute_collection',
diff --git a/app/code/Magento/Eav/sql/eav_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Eav/sql/eav_setup/upgrade-1.6.0.1-1.6.0.2.php
index 220b837e7f304147cbb1670b9193af2503cb9bec..b9fa3c87aeac0793aeea97006496f946309fc758 100644
--- a/app/code/Magento/Eav/sql/eav_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/Eav/sql/eav_setup/upgrade-1.6.0.1-1.6.0.2.php
@@ -42,11 +42,4 @@ $connection->addColumn(
     array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '255', 'comment' => 'Tab Group Code')
 );
 
-/** @var $groups \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection*/
-$groups = $installer->getAttributeGroupCollectionFactory();
-foreach ($groups as $group) {
-    /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/
-    $group->save();
-}
-
 $installer->endSetup();
diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php
index 2ab8c84c793f970f0ec7858feefc3885970077de..ec40d0fbe7829345d55fe35aeaa6e3da36f12c53 100644
--- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php
+++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php
@@ -84,11 +84,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
                 'Magento\Theme\Block\Html\Head\Css',
                 array('file' => 'Magento_Core::prototype/magento.css')
             );
-            $head->addChild(
-                'magento-adminhtml-variables-js',
-                'Magento\Theme\Block\Html\Head\Script',
-                array('file' => 'Magento_Backend::variables.js')
-            );
         }
         return parent::_prepareLayout();
     }
diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..3f8c783a0bf510156a44a6ca7992b34a728c6336
--- /dev/null
+++ b/app/code/Magento/Email/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-email",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Email"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml
index ccaf0fae4a1c2e74cb4f90c3a3383bd5c6307ca3..79775302cf02c0569c11db885ffb31b4548f6561 100644
--- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml
+++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_edit.xml
@@ -25,9 +25,9 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
      <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-backend-variables-js" after="jquery-jquery-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-email-js-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_Backend::variables.js</argument>
+                <argument name="file" xsi:type="string">Magento_Email::js/bootstrap.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml
index 6672d3a75a7f8ee5586a942cd4cad4d23f829247..86b743a28842bf21b9436dc6b4621a3e023be4d5 100644
--- a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml
+++ b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml
@@ -68,11 +68,17 @@
     </div>
 </form>
 <script type="text/javascript">
+require([
+    "jquery",
+    "mage/mage",
+    "Magento_Backend/variables"
+], function(jQuery){
+
 //<![CDATA[
     jQuery('#email_template_edit_form').mage('form').mage('validation');
     jQuery('#email_template_preview_form').mage('form').mage('validation');
     jQuery('#email_template_load_form').mage('validation');
-    var templateControl = {
+    templateControl = {
         unconvertedText: '',
         typeChange: false,
         variables: null,
@@ -230,4 +236,6 @@
 
     templateControl.init();
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Email/view/adminhtml/web/js/bootstrap.js b/app/code/Magento/Email/view/adminhtml/web/js/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..8e1c10a62c61efde7cdd64517d908900080ca927
--- /dev/null
+++ b/app/code/Magento/Email/view/adminhtml/web/js/bootstrap.js
@@ -0,0 +1,26 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+require([
+    'Magento_Backend/variables'
+]);
\ No newline at end of file
diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..9c13f7eb7d88a0bfae382f598069b6c43165ab20
--- /dev/null
+++ b/app/code/Magento/Fedex/composer.json
@@ -0,0 +1,27 @@
+{
+    "name": "magento/module-fedex",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Fedex"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Fedex/sql/fedex_setup/install-2.0.0.0.php b/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.0.php
similarity index 100%
rename from app/code/Magento/Fedex/sql/fedex_setup/install-2.0.0.0.php
rename to app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.0.php
diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..d48fce67defd6480e8b01a59f9a42c6b1ac061d4
--- /dev/null
+++ b/app/code/Magento/GiftMessage/composer.json
@@ -0,0 +1,28 @@
+{
+    "name": "magento/module-gift-message",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-multishipping": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/GiftMessage"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.17-1.6.0.0.18.php b/app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-1.6.0.0.php
similarity index 52%
rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.17-1.6.0.0.18.php
rename to app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-1.6.0.0.php
index 03aad2669c0a4d5eba04388e9d1dbf6083ab560a..4d98375ca25cdbf91db8d35ee6b57a6b96221cf3 100644
--- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.17-1.6.0.0.18.php
+++ b/app/code/Magento/GiftMessage/data/giftmessage_setup/data-install-1.6.0.0.php
@@ -22,28 +22,41 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/** @var $this \Magento\Catalog\Model\Resource\Setup */
-$this->addAttribute(
+/** @var $installer \Magento\GiftMessage\Model\Resource\Setup */
+$installer = $this;
+/**
+ * Add 'gift_message_id' attributes for entities
+ */
+$entities = array('quote', 'quote_address', 'quote_item', 'quote_address_item', 'order', 'order_item');
+$options = array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'visible' => false, 'required' => false);
+foreach ($entities as $entity) {
+    $installer->addAttribute($entity, 'gift_message_id', $options);
+}
+
+/**
+ * Add 'gift_message_available' attributes for entities
+ */
+$installer->addAttribute('order_item', 'gift_message_available', $options);
+$installer->createGiftMessageSetup(
+    array('resourceName' => 'catalog_setup')
+)->addAttribute(
     \Magento\Catalog\Model\Product::ENTITY,
-    'quantity_and_stock_status',
+    'gift_message_available',
     array(
-        'group' => 'General',
-        'type' => 'int',
-        'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Stock',
+        'group' => 'Gift Options',
+        'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean',
         'frontend' => '',
-        'label' => 'Quantity',
+        'label' => 'Allow Gift Message',
         'input' => 'select',
         'class' => '',
-        'input_renderer' => 'Magento\CatalogInventory\Block\Adminhtml\Form\Field\Stock',
-        'source' => 'Magento\CatalogInventory\Model\Stock\Status',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
-        'default' => \Magento\CatalogInventory\Model\Stock::STOCK_IN_STOCK,
-        'user_defined' => false,
+        'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
+        'global' => true,
         'visible' => true,
         'required' => false,
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'unique' => false
+        'user_defined' => false,
+        'default' => '',
+        'apply_to' => '',
+        'input_renderer' => 'Magento\GiftMessage\Block\Adminhtml\Product\Helper\Form\Config',
+        'visible_on_front' => false
     )
 );
diff --git a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-1.6.0.0.php b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-1.6.0.0.php
index 4e67d24632cc75579aa1360f1368b98f4c2f44d0..250c7bba506afad9757f2b2e0c7a61f1a1b1a541 100644
--- a/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-1.6.0.0.php
+++ b/app/code/Magento/GiftMessage/sql/giftmessage_setup/install-1.6.0.0.php
@@ -24,7 +24,6 @@
 
 
 /** @var $installer \Magento\GiftMessage\Model\Resource\Setup */
-
 $installer = $this;
 $installer->startSetup();
 
@@ -69,41 +68,4 @@ $table = $installer->getConnection()->newTable(
 
 $installer->getConnection()->createTable($table);
 
-/**
- * Add 'gift_message_id' attributes for entities
- */
-$entities = array('quote', 'quote_address', 'quote_item', 'quote_address_item', 'order', 'order_item');
-$options = array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'visible' => false, 'required' => false);
-foreach ($entities as $entity) {
-    $installer->addAttribute($entity, 'gift_message_id', $options);
-}
-
-/**
- * Add 'gift_message_available' attributes for entities
- */
-$installer->addAttribute('order_item', 'gift_message_available', $options);
-$installer->createGiftMessageSetup(
-    array('resourceName' => 'catalog_setup')
-)->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'gift_message_available',
-    array(
-        'group' => 'Gift Options',
-        'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean',
-        'frontend' => '',
-        'label' => 'Allow Gift Message',
-        'input' => 'select',
-        'class' => '',
-        'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
-        'global' => true,
-        'visible' => true,
-        'required' => false,
-        'user_defined' => false,
-        'default' => '',
-        'apply_to' => '',
-        'input_renderer' => 'Magento\GiftMessage\Block\Adminhtml\Product\Helper\Form\Config',
-        'visible_on_front' => false
-    )
-);
-
 $installer->endSetup();
diff --git a/app/code/Magento/GiftMessage/view/adminhtml/templates/popup.phtml b/app/code/Magento/GiftMessage/view/adminhtml/templates/popup.phtml
index 3e071b5ea873062e10fca4b3875b2a80cc783614..8c28f510fa27c39429fac59182ef3e8498d6376f 100644
--- a/app/code/Magento/GiftMessage/view/adminhtml/templates/popup.phtml
+++ b/app/code/Magento/GiftMessage/view/adminhtml/templates/popup.phtml
@@ -40,11 +40,18 @@
 </div>
 
 <script type="text/javascript">
+require([
+    "Magento_Sales/order/create/giftmessage",
+    "Magento_Sales/order/giftoptions_tooltip"
+], function(){
+
 //<![CDATA[
 var giftMessageSet = new GiftMessageSet();
 
 _giftOptions = new GiftOptionsPopup();
 giftOptionsTooltip.setTooltipWindow('giftoptions_tooltip_window','giftoptions_tooltip_window_content');
 //]]>
+window.giftMessageSet = giftMessageSet;
+});
 </script>
 <?php endif;?>
diff --git a/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/create/giftoptions.phtml b/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/create/giftoptions.phtml
index 965841857b5d057cb52dd6ae8577dda2b8265838..be0137b70477c4817ba6feb40f4c10db07a14d21 100644
--- a/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/create/giftoptions.phtml
+++ b/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/create/giftoptions.phtml
@@ -31,8 +31,14 @@
             <td colspan="8">
                 <a class="action-link" href="#" id="gift_options_link_<?php echo $_item->getId() ?>"><?php echo __('Gift Options') ?></a>
                 <script type="text/javascript">
-                    giftOptionsTooltip.addTargetLink('gift_options_link_<?php echo $_item->getId() ?>', <?php echo $_item->getId() ?>);
-                </script>
+require([
+    "Magento_Sales/order/giftoptions_tooltip"
+], function(){
+
+    giftOptionsTooltip.addTargetLink('gift_options_link_<?php echo $_item->getId() ?>', <?php echo $_item->getId() ?>);
+                
+});
+</script>
                 <div id="gift_options_data_<?php echo $_item->getId() ?>">
                     <?php echo $_childHtml ?>
                 </div>
diff --git a/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/view/giftoptions.phtml b/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/view/giftoptions.phtml
index d3b3272d4cda77d5abe8210af0acda2a0a3203b1..4cd2a9b92beb7abcfbba3a5b2844f50b137fe150 100644
--- a/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/view/giftoptions.phtml
+++ b/app/code/Magento/GiftMessage/view/adminhtml/templates/sales/order/view/giftoptions.phtml
@@ -30,8 +30,14 @@
     <td colspan="10" class="last">
         <a class="action-link" href="#" id="gift_options_link_<?php echo $_item->getId() ?>"><?php echo __('Gift Options') ?></a>
         <script type="text/javascript">
-            giftOptionsTooltip.addTargetLink('gift_options_link_<?php echo $_item->getId() ?>', <?php echo $_item->getId() ?>);
-        </script>
+require([
+	"Magento_Sales/order/giftoptions_tooltip"
+], function(){
+
+	giftOptionsTooltip.addTargetLink('gift_options_link_<?php echo $_item->getId() ?>', <?php echo $_item->getId() ?>);
+        
+});
+</script>
         <div id="gift_options_data_<?php echo $_item->getId() ?>">
             <?php echo $_childHtml ?>
         </div>
diff --git a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
index a313569ac833bf95804e3467b4867ff9bf87fa78..8c19cffdf49867f7e1eb7b0e126ff26ab9d15f5b 100644
--- a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
+++ b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
@@ -25,7 +25,11 @@
 <?php $_giftMessage = false; ?>
 <?php if(!$this->getDontDisplayContainer()): ?>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#checkoutSteps').mage('extraOptions', {additionalUrl: '<?php echo $this->getAdditionalUrl(); ?>'});
+
+});
 </script>
 <?php endif ?>
 
@@ -74,9 +78,13 @@
                             </div>
                         </fieldset>
                         <script type="text/javascript">
-                            jQuery('#add-gift-options-<?php echo $this->getEntity()->getId() ?>')
-                                .add('#add-gift-options-for-order-<?php echo $this->getEntity()->getId() ?>').removeClass('hidden');
-                        </script>
+require(['jquery'], function(jQuery){
+
+    jQuery('#add-gift-options-<?php echo $this->getEntity()->getId() ?>')
+        .add('#add-gift-options-for-order-<?php echo $this->getEntity()->getId() ?>').removeClass('hidden');
+                        
+});
+</script>
                     </div>
             </dd>
             <?php endif ?>
@@ -137,16 +145,27 @@
                 </ol>
             </dd>
             <script type="text/javascript">
-                jQuery('#add-gift-options-<?php echo $this->getEntity()->getId() ?>')
-                    .add('#add-gift-options-for-items-<?php echo $this->getEntity()->getId() ?>').removeClass('hidden');
-            </script>
+require(['jquery'], function(jQuery){
+
+    jQuery('#add-gift-options-<?php echo $this->getEntity()->getId() ?>')
+        .add('#add-gift-options-for-items-<?php echo $this->getEntity()->getId() ?>').removeClass('hidden');
+            
+});
+</script>
             <?php endif; ?>
             <dt class="extra-options-container" id="extra-options-container-<?php echo $this->getEntity()->getId() ?>"></dt>
         </dl>
     </fieldset>
     <script type="text/javascript">
+require([
+    'jquery',
+    'mage/mage'
+], function(jQuery){
+
         jQuery('#allow_gift_options').add('#allow_gift_options_for_order').add('#allow_gift_options_for_items').mage('giftOptions');
-    </script>
+    
+});
+</script>
 <?php break; ?>
 
 <?php case 'multishipping_address': ?>
@@ -262,15 +281,23 @@
         </dl>
     </fieldset>
         <script type="text/javascript">
+require(['jquery', 'mage/mage'], function(jQuery){
+
             jQuery('#allow_gift_options_<?php echo $this->getEntity()->getId() ?>')
                 .add('#allow_gift_options_for_order_<?php echo $this->getEntity()->getId() ?>')
                 .add('#allow_gift_options_for_items_<?php echo $this->getEntity()->getId() ?>')
                 .mage('giftOptions');
-        </script>
+        
+});
+</script>
     <?php break; ?>
 <?php endswitch ?>
 <?php if ($_giftMessage): ?>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#shipping_method_form').mage('validation');
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/GiftMessage/view/frontend/web/extra-options.js b/app/code/Magento/GiftMessage/view/frontend/web/extra-options.js
index 5e32b5cc2e12b392d87abec6c1787ff3e682fba0..1f1409f659471422cf5a15b1812d8680331011aa 100644
--- a/app/code/Magento/GiftMessage/view/frontend/web/extra-options.js
+++ b/app/code/Magento/GiftMessage/view/frontend/web/extra-options.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.extraOptions', {
         options: {
             events: 'billingSave shippingSave',
@@ -54,4 +58,5 @@
             });
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/GiftMessage/view/frontend/web/gift-options.js b/app/code/Magento/GiftMessage/view/frontend/web/gift-options.js
index 4833a3e45210e99ab6efe1c61a8aa97430c9ef61..0c71653fdab8c6204c4c3fffd95a8c79d35a826e 100644
--- a/app/code/Magento/GiftMessage/view/frontend/web/gift-options.js
+++ b/app/code/Magento/GiftMessage/view/frontend/web/gift-options.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+    
     $.widget('mage.giftOptions', {
         options: {
             mageError: 'mage-error',
@@ -90,4 +94,5 @@
                 .find('.input-text').toggleClass(this.options.requiredEntry, length > 0);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..5fc47874f0d9f039b31ff4e635499a90176b44bf
--- /dev/null
+++ b/app/code/Magento/GoogleAdwords/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-google-adwords",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/GoogleAdwords"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..5cb9bc78c2587ecc270899386c768456e190f5f8
--- /dev/null
+++ b/app/code/Magento/GoogleAnalytics/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-google-analytics",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/GoogleAnalytics"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..094f6b1f9dcd6c42190f86f0f77829a60f6b3ac9
--- /dev/null
+++ b/app/code/Magento/GoogleOptimizer/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-google-optimizer",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-google-analytics": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/GoogleOptimizer"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1714fabb5098ecb52cde41a3f6272efc58678c6c
--- /dev/null
+++ b/app/code/Magento/GoogleShopping/composer.json
@@ -0,0 +1,29 @@
+{
+    "name": "magento/module-google-shopping",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-admin-notification": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/GoogleShopping"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml b/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml
index 92f40ef1663af65cb782087380597effb0dfc03c..db02d1fa6995c8e461e99a3a0ab7a90157dd1bfc 100644
--- a/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml
+++ b/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml
@@ -25,9 +25,9 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-googleshopping-googleshopping-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-googleshopping-js-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_GoogleShopping::googleshopping.js</argument>
+                <argument name="file" xsi:type="string">Magento_GoogleShopping::js/bootstrap.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/templates/items.phtml b/app/code/Magento/GoogleShopping/view/adminhtml/templates/items.phtml
index c189eac74b3e68ea7dd645fcd1a6c1a1a30f9e58..2a9a34c1b0b0372a2b34f5230c95e1be0aff61aa 100644
--- a/app/code/Magento/GoogleShopping/view/adminhtml/templates/items.phtml
+++ b/app/code/Magento/GoogleShopping/view/adminhtml/templates/items.phtml
@@ -41,9 +41,15 @@
 </div>
 
 <script type="text/javascript">
+require([
+	'Magento_GoogleShopping/googleshopping'
+], function(){
+
 //<![CDATA[
 Mage.GoogleShopping.isProcessRunning = <?php echo $this->isProcessRunning() ? 'true' : 'false'; ?>;
 Mage.GoogleShopping.statusUrl = '<?php echo $this->getStatusUrl(); ?>';
 Mage.GoogleShopping.runningMessage = '<?php echo __('Google Shopping synchronization process is running');?>';
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit.phtml b/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit.phtml
index 9d433c653d8b49eaee9711b9c2494f35bb1f31be..41a8edfd452842b4540f5ea982fe090c65f3e21e 100644
--- a/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit.phtml
+++ b/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit.phtml
@@ -24,6 +24,8 @@
 ?>
 
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 var itemType = function() {
     return {
@@ -77,5 +79,9 @@ var itemType = function() {
          Event.observe($("select_target_country"), 'change', itemType.reloadItemTypes);
      }
 });
+
+window.itemType = itemType;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml b/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml
index 6206575dad08b593555364002066457cfd52a401..1f2816a9ba9e7ed834a947a0811b9419ad50ac5c 100644
--- a/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml
+++ b/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml
@@ -25,6 +25,8 @@
 
 <?php if ($this->getAttributeSetSelected()): ?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 Gcontent = {};
 Gcontent.Attribute = Class.create();
@@ -85,9 +87,11 @@ var attributesSelectTemplate = '<tr id="<?php echo $this->getFieldId() ?>_{{inde
                 '<td class="col-delete">' + <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getDeleteButtonHtml()) ?> + '</td>' +
             '</tr>';
 
-var optionIndex = 0;
+optionIndex = 0;
 gContentAttribute = new Gcontent.Attribute(attributesSelectTemplate);
 //]]>
+
+});
 </script>
 
 <div id="gcontent_attributes_container">
@@ -114,11 +118,15 @@ gContentAttribute = new Gcontent.Attribute(attributesSelectTemplate);
 
 <?php if ($this->getAttributesData()): ?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
     <?php foreach ($this->getAttributesData() as $data): ?>
         gContentAttribute.add(<?php echo $this->jsonFormat($data) ?>);
     <?php endforeach; ?>
 //]]>
+
+});
 </script>
 <?php endif; ?>
 
diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/web/googleshopping.js b/app/code/Magento/GoogleShopping/view/adminhtml/web/googleshopping.js
index 353e20b7187e14a04da320b3c6d8509585779398..d4f7bf9d2597c522d277488f59f7fb54bd4354b0 100644
--- a/app/code/Magento/GoogleShopping/view/adminhtml/web/googleshopping.js
+++ b/app/code/Magento/GoogleShopping/view/adminhtml/web/googleshopping.js
@@ -20,8 +20,13 @@
  * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "prototype"
+], function(jQuery){
+
 if (typeof Mage == 'undefined') {
-    Mage = {};
+    window.Mage = {};
 }
 if (typeof Mage.GoogleShopping == 'undefined') {
     Mage.GoogleShopping = {
@@ -135,3 +140,5 @@ Event.observe(document, 'dom:loaded', function() {
         Mage.GoogleShopping.poller.start(Mage.GoogleShopping.statusUrl);
     }
 });
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/web/js/bootstrap.js b/app/code/Magento/GoogleShopping/view/adminhtml/web/js/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..90ce61829467c07d6e0c711f4249edd680767f1f
--- /dev/null
+++ b/app/code/Magento/GoogleShopping/view/adminhtml/web/js/bootstrap.js
@@ -0,0 +1,25 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+ require([
+    "Magento_GoogleShopping/googleshopping"
+ ]);
\ No newline at end of file
diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..65984cf03f57c13813ed444f0007770b5a80ad06
--- /dev/null
+++ b/app/code/Magento/GroupedProduct/composer.json
@@ -0,0 +1,30 @@
+{
+    "name": "magento/module-grouped-product",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/GroupedProduct"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php b/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php
index 86a8357e35d93684eb7169d3e7413314f34a9e92..d8680d2b7b8601fc8231456f664160191db8bb1a 100644
--- a/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php
+++ b/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php
@@ -62,3 +62,10 @@ if (!$result) {
 
     $installer->getConnection()->insertMultiple($installer->getTable('catalog_product_link_attribute'), $data);
 }
+
+$field = 'country_of_manufacture';
+$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to'));
+if (!in_array('grouped', $applyTo)) {
+    $applyTo[] = 'grouped';
+    $installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
+}
diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml
index b28577b44461b2e6e569c59c2f42f7539ccef303..3d6fd862df613036b2c1e8e34918ab986b24dce5 100644
--- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml
+++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml
@@ -31,11 +31,6 @@
                 <argument name="file" xsi:type="string">Magento_GroupedProduct::css/grouped-product.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-grouped-product-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_GroupedProduct::js/grouped-product.js</argument>
-            </arguments>
-        </block>
     </referenceBlock>
     <referenceBlock name="product_tabs">
         <block class="Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts" name="catalog.product.edit.grouped.container" template="product/grouped/container.phtml">
diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/stock/disabler.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/stock/disabler.phtml
index e321e94bfa3a1bd16ce34ad56f81d4ae929f49d2..c79defd79eba87c22b6ef84bc1996ca2ed889727 100644
--- a/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/stock/disabler.phtml
+++ b/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/stock/disabler.phtml
@@ -23,11 +23,13 @@
  */
 ?>
 <script type="text/javascript">
-(function($) {
+require(['jquery'], function($){
+
     $('[data-tab-panel=product-details]').on('stockbeforedisable', function(e) {
         if (e.productType === 'grouped') {
             return false;
         }
     });
-})(jQuery);
+
+});
 </script>
diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js
index fb5593438531047e5947e4c4e939373cc1169351..ffeaa58a5d47df81255b7dc8c1e1a504204a2968 100644
--- a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js
+++ b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "jquery/template"
+], function($){
     'use strict';
     $.widget('mage.groupedProduct', {
         /**
@@ -196,4 +201,4 @@
             this.element.find('.no-products-message').toggle(!showGrid);
         }
     });
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..004eb3554d516ca72fb9c7b58aac4bf9984628d0
--- /dev/null
+++ b/app/code/Magento/ImportExport/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-import-export",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "ext-ctype": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/ImportExport"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php b/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php
index f3e4445712909276ae17330e35d7bd2b25c311e3..eeb0fdda1d691313e7223e1834fab0c02b0ba07b 100644
--- a/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php
+++ b/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php
@@ -47,13 +47,13 @@ $table = $installer->getConnection()->newTable(
     'behavior',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     10,
-    array('nullable' => false, 'default' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND),
+    array('nullable' => false, 'default' => 'append'),
     'Behavior'
 )->addColumn(
     'data',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     '64k',
-    array('default' => ''),
+    array('default' => false),
     'Data'
 )->setComment(
     'Import Data Table'
diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.1-1.6.0.2.php
similarity index 95%
rename from app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php
rename to app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.1-1.6.0.2.php
index a4a1391becdcfb316e7fba39b08c4ee8d0623266..e03f7dfeed86990f3789ab8a0759c2a2198c9c0a 100644
--- a/app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.1-1.6.0.2.php
@@ -28,5 +28,5 @@ $installer = $this;
 $installer->getConnection()->modifyColumn(
     $installer->getTable('importexport_importdata'),
     'data',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '4G', 'default' => '', 'comment' => 'Data')
+    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '4G', 'default' => false, 'comment' => 'Data')
 );
diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml
index 7c260c0465e81d493b974aef61f5fbd7b0ebd09e..dcbf2009b21055ee89fc131e6b5e79858a02779b 100644
--- a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml
+++ b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml
@@ -36,7 +36,11 @@
     ?></span></button>
 </fieldset>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
    $('entity').selectedIndex = 0; // forced resetting entity selector after page refresh
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/before.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/before.phtml
index d26b2757f608f4d42422bd380e45c57db8fd40a9..c649f3523e0cde4c7be659cbfc04eb9d65ad79ae 100644
--- a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/before.phtml
+++ b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/before.phtml
@@ -23,6 +23,8 @@
  */
 ?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
     // Temporary Class will be replaced after refactoring of import/export functionality
     VarienExport = Class.create();
@@ -86,7 +88,7 @@
      *
      * return void
      */
-    function getFile() {
+    getFile = function() {
         if ($('entity') && $F('entity')) {
             var form      = $('export_filter_form');
             var oldAction = form.action;
@@ -102,4 +104,6 @@
 
     varienExport = new VarienExport();
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml
index 35e9dfe92e7785aaba16f6c8279831f6f4feff7e..0a61fa0f8747ec74c0d0d42b5ad30ed85882bedc 100644
--- a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml
+++ b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml
@@ -32,5 +32,4 @@ if (window['export_filter_gridJsObject'] != undefined) {
         return varienGrid.prototype.doFilter.call(this, varienExport.modifyFilterGrid);
     };
 }
-//]]>
 </script>
diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml
index 5a42235b27c71faeb1087e472e28d079eb045439..8bb43461dce500b905026949d3fb46e8d9b3ec36 100644
--- a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml
+++ b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml
@@ -30,7 +30,10 @@
     <div id="import_validation_messages" class="fieldset "><!-- --></div>
 </div>
 <script type="text/javascript">
+require(['jquery', 'prototype'], function(jQuery){
 //<![CDATA[
     varienImport.resetSelectIndex('entity'); // forced resetting entity selector after page refresh
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml
index a814906bb93c16a7f521ee2c1017c16cb5b426ab..428a6efd62a0aee55f90a39615c2062803eaafa8 100644
--- a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml
+++ b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml
@@ -26,9 +26,11 @@
 /** @var $this \Magento\ImportExport\Block\Adminhtml\Import\Edit\Before */
 ?>
 <script type="text/javascript">
+require(['jquery', 'prototype'], function(jQuery){
+
 //<![CDATA[
     // Temporary Class will be replaced after refactoring of import/export functionality
-    var varienImport = {
+    varienImport = {
         /**
          * Name and ID for iframe for data POST-ing.
          * @type {string}
@@ -207,4 +209,6 @@
         }
     };
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Index/composer.json b/app/code/Magento/Index/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..4d5201a449caf97fb9b1475c9bc495cff32f1172
--- /dev/null
+++ b/app/code/Magento/Index/composer.json
@@ -0,0 +1,22 @@
+{
+    "name": "magento/module-index",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-admin-notification": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Index"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..71272f04ac08dbd58bdd1996d770d0eb01f08c4f
--- /dev/null
+++ b/app/code/Magento/Indexer/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-indexer",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-page-cache": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Indexer"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php
index 4d672cf9d50e189a96ac28dc8b0764ca128f0edd..661e333f20e5705e10fd74210f01dbc76e3f0481 100644
--- a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php
+++ b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php
@@ -48,7 +48,7 @@ $table = $installer->getConnection()->newTable(
     'status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     16,
-    array('default' => \Magento\Indexer\Model\Indexer\State::STATUS_INVALID),
+    array('default' => 'invalid'),
     'Indexer Status'
 )->addColumn(
     'updated',
@@ -91,13 +91,13 @@ $table = $installer->getConnection()
         'mode',
         \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
         16,
-        array('default' => \Magento\Framework\Mview\View\StateInterface::MODE_DISABLED,),
+        array('default' => 'disabled'),
         'View Mode'
     )->addColumn(
         'status',
         \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
         16,
-        array('default' => \Magento\Framework\Mview\View\StateInterface::STATUS_IDLE,),
+        array('default' => 'idle'),
         'View Status'
     )->addColumn(
         'updated',
diff --git a/app/code/Magento/Install/composer.json b/app/code/Magento/Install/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..fc8c08ee1d03b2d1cf148e7d0a235136d815873a
--- /dev/null
+++ b/app/code/Magento/Install/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-install",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-admin-notification": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-user": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Install"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Install/view/install/templates/begin.phtml b/app/code/Magento/Install/view/install/templates/begin.phtml
index e589bbb5de02deb16c479f29309457da0a937997..9ab46265ed829b0cab596dd72767b0c051a4154f 100644
--- a/app/code/Magento/Install/view/install/templates/begin.phtml
+++ b/app/code/Magento/Install/view/install/templates/begin.phtml
@@ -49,12 +49,15 @@
     </div>
 </form>
 <script type="text/javascript">
+require([
+    "jquery",
+    "Magento_Install/js/install"
+], function($){
+
 //<![CDATA[
-(function($) {
-    head.js("<?php echo $this->getViewFileUrl('Magento_Install::js/install.js') ?>", head.ready(function () {
-        $.mage.install.begin('#agree', '#submitButton');
-    }));
-})(jQuery);
+    $.mage.install.begin('#agree', '#submitButton');
 //]]>
+
+});
 </script>
 <?php endif ?>
diff --git a/app/code/Magento/Install/view/install/templates/config.phtml b/app/code/Magento/Install/view/install/templates/config.phtml
index 82d91d29b527ffebb264d0497134b89c4883e311..726cc7f2b13b77c44a39bf9309f3b41a5d321c8a 100644
--- a/app/code/Magento/Install/view/install/templates/config.phtml
+++ b/app/code/Magento/Install/view/install/templates/config.phtml
@@ -153,17 +153,14 @@
     </div>
 </form>
 <script type="text/javascript">
-    (function ($) {
-        head.js(
-            "<?php echo $this->getViewFileUrl('jquery/jquery.validate.js')?>",
-            "<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js')?>",
-            "<?php echo $this->getViewFileUrl('mage/validation.js')?>",
-            "<?php echo $this->getViewFileUrl('mage/validation/validation.js')?>",
-            "<?php echo $this->getViewFileUrl('Magento_Install::js/install.js') ?>",
-            head.ready(function () {
-                $.mage.install.configureForm('#form-validate', '#use_secure', '#use_secure_options');
-            }));
-    })(jQuery);
+require([
+    "jquery",
+    "Magento_Install/js/install"
+], function($){
+
+    $.mage.install.configureForm('#form-validate', '#use_secure', '#use_secure_options');
+
+});
 </script>
 <?php else: ?>
 <div><?php echo __('Please set all required settings before clicking "Continue".') ?></div>
@@ -171,13 +168,16 @@
     <button id="btn-continue" class="form-button" type="button">
         <span><?php echo __('Continue') ?></span></button>
     <script type="text/javascript">
-    (function($) {
-        head.js("<?php echo $this->getViewFileUrl('Magento_Install::js/install.js')?>", head.ready(function () {
-            $.mage.install.configureContinue(
-                '#btn-continue', '<?php echo $this->getUrl('*/*/*', array('_current' => true)) ?>'
-            );
-        }));
-    })(jQuery);
-    </script>
+require([
+    "jquery",
+    "Magento_Install/js/install"
+], function($){
+
+    $.mage.install.configureContinue(
+        '#btn-continue', '<?php echo $this->getUrl('*/*/*', array('_current' => true)) ?>'
+    );
+
+});
+</script>
 </div>
 <?php endif; ?>
diff --git a/app/code/Magento/Install/view/install/templates/create_admin.phtml b/app/code/Magento/Install/view/install/templates/create_admin.phtml
index 0da2088f917e3f985751668f30b1985cda260ff4..a5287dc11581868845026ca054cde7b999a1e99b 100644
--- a/app/code/Magento/Install/view/install/templates/create_admin.phtml
+++ b/app/code/Magento/Install/view/install/templates/create_admin.phtml
@@ -112,15 +112,12 @@
     </div>
 </form>
 <script type="text/javascript">
-    (function ($) {
-        head.js(
-            "<?php echo $this->getViewFileUrl('jquery/jquery.validate.js')?>",
-            "<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js')?>",
-            "<?php echo $this->getViewFileUrl('mage/validation.js')?>",
-            "<?php echo $this->getViewFileUrl('mage/validation/validation.js')?>",
-            "<?php echo $this->getViewFileUrl('Magento_Install::js/install.js') ?>",
-            head.ready(function () {
-                $.mage.install.createAdmin('#form-validate');
-            }));
-    })(jQuery);
+require([
+    'jquery',
+    "Magento_Install/js/install"
+], function($){
+
+    $.mage.install.createAdmin('#form-validate');
+
+});
 </script>
diff --git a/app/code/Magento/Install/view/install/templates/db/main.phtml b/app/code/Magento/Install/view/install/templates/db/main.phtml
index 0ca7f4ee423468616ebb77f942882a3ea151d005..5bd339bf5b9e2230ba00dc24cc7f607d9759b666 100644
--- a/app/code/Magento/Install/view/install/templates/db/main.phtml
+++ b/app/code/Magento/Install/view/install/templates/db/main.phtml
@@ -30,9 +30,13 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    'prototype'
+], function(){
+
 //<![CDATA[
-var dbTypeIds = [];
-function showContent(select)
+dbTypeIds = [];
+showContent = function(select)
 {
     dbTypeIds.each(function (name) {
         $(name + '_conn_form').hide()
@@ -40,6 +44,8 @@ function showContent(select)
     $(select.value + '_conn_form').show();
 }
 //]]>
+
+});
 </script>
 
 <fieldset class="group-select">
@@ -62,10 +68,16 @@ function showContent(select)
 
         <?php foreach ($dbTypeOptions as $block): ?>
             <script type="text/javascript">
-            //<![CDATA[
-                dbTypeIds[dbTypeIds.length] = "<?php echo $block->getIdPrefix(); ?>";
-            //]]>
-            </script>
+require([
+    'prototype'
+], function(){
+
+    //<![CDATA[
+        dbTypeIds[dbTypeIds.length] = "<?php echo $block->getIdPrefix(); ?>";
+    //]]>
+            
+});
+</script>
             <?php $block = $this->getDatabaseBlock($block->getIdPrefix()) ?>
 
             <div id="<?php echo $block->getIdPrefix() ?>_conn_form" <?php if($this->getFormData()->getDbModel() != $block->getIdPrefix()):?>style="display:none;"<?php endif;?>>
diff --git a/app/code/Magento/Install/view/install/templates/download.phtml b/app/code/Magento/Install/view/install/templates/download.phtml
index 93274864f892bfa8076c97b6950cd6faebf7947d..4a978fd46d4cc3e25a6e4582144e670a67955d29 100644
--- a/app/code/Magento/Install/view/install/templates/download.phtml
+++ b/app/code/Magento/Install/view/install/templates/download.phtml
@@ -29,36 +29,42 @@
  */
 ?>
 <script type="text/javascript">
-function startInstall(state)
-{
-    $$('button').each(function(el) {
-        el.disabled = true;
-        el.addClassName('disabled');
-    });
-    var install = $('install_iframe');
-    install.setStyle({'display':'block', 'width':'100%', 'height':'300px'});
-    install.src = '<?php echo $this->getUrl('*/*/install') ?>do/start/state/'+state;
-}
-
-function installSuccess()
-{
-    alert("<?php echo __("All packages were installed. Click 'OK' to continue with installation.") ?>");
-    location.href = "<?php echo $this->getNextUrl() ?>";
-    $$('button').each(function(el) {
-        el.disabled = true;
-        el.removeClassName('disabled');
-    });
-}
-
-function installFailure()
-{
-    alert("<?php echo __("Something went wrong installing the Magento packages. Please read the log, correct any errors and try again.") ?>\n<?php echo __('As another option, you could try the "Manual Downloads and Upgrades" method.') ?>");
-    $$('button').each(function(el) {
-        el.disabled = true;
-        el.removeClassName('disabled');
-    });
-}
-
+require([
+    'prototype'
+], function(){
+
+    startInstall = function(state)
+    {
+        $$('button').each(function(el) {
+            el.disabled = true;
+            el.addClassName('disabled');
+        });
+        var install = $('install_iframe');
+        install.setStyle({'display':'block', 'width':'100%', 'height':'300px'});
+        install.src = '<?php echo $this->getUrl('*/*/install') ?>do/start/state/'+state;
+    }
+
+    installSuccess = function()
+    {
+        alert("<?php echo __("All packages were installed. Click 'OK' to continue with installation.") ?>");
+        location.href = "<?php echo $this->getNextUrl() ?>";
+        $$('button').each(function(el) {
+            el.disabled = true;
+            el.removeClassName('disabled');
+        });
+    }
+
+    installFailure = function()
+    {
+        alert("<?php echo __("Something went wrong installing the Magento packages. Please read the log, correct any errors and try again.") ?>\n<?php echo __('As another option, you could try the "Manual Downloads and Upgrades" method.') ?>");
+        $$('button').each(function(el) {
+            el.disabled = true;
+            el.removeClassName('disabled');
+        });
+    }
+
+
+});
 </script>
 <div class="page-head">
     <h3><?php echo __('Download Magento Core Modules and Updates') ?></h3>
@@ -121,5 +127,9 @@ function installFailure()
 </form>
 
 <script type="text/javascript">
-var tabs = new Varien.Tabs('.tabs');
+require(['prototype'], function(){
+
+    tabs = new Varien.Tabs('.tabs');
+
+});
 </script>
diff --git a/app/code/Magento/Install/view/install/templates/locale.phtml b/app/code/Magento/Install/view/install/templates/locale.phtml
index c58f9de1db475e940c5d50a040fbff245c607e9b..8863efafd712fb016e7fb42d50bc9130df896557 100644
--- a/app/code/Magento/Install/view/install/templates/locale.phtml
+++ b/app/code/Magento/Install/view/install/templates/locale.phtml
@@ -62,9 +62,12 @@
 </div>
 </form>
 <script type="text/javascript">
-    (function($) {
-        head.js("<?php echo $this->getViewFileUrl('Magento_Install::js/install.js') ?>", head.ready(function () {
-            $.mage.install.changeLocale('#locale', '<?php echo $this->getChangeUrl();?>');
-        }));
-    })(jQuery);
+require([
+    "jquery",
+    "Magento_Install/js/install"
+], function($){
+
+    $.mage.install.changeLocale('#locale', '<?php echo $this->getChangeUrl();?>');
+
+});
 </script>
diff --git a/app/code/Magento/Install/view/install/templates/page.phtml b/app/code/Magento/Install/view/install/templates/page.phtml
index 76c22e7c75a9130d364b918bb432cbe8d392e948..20c623ff9ae7b38749f799463b049f7dc285998c 100644
--- a/app/code/Magento/Install/view/install/templates/page.phtml
+++ b/app/code/Magento/Install/view/install/templates/page.phtml
@@ -35,13 +35,19 @@
 
     <link rel="icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico') ?>" type="image/x-icon"/>
     <link rel="shortcut icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico') ?>" type="image/x-icon"/>
+    <script type="text/javascript">
+        var require = {
+            "baseUrl": "<?php echo $this->getViewFileUrl('/') ?>",
+            "paths": {
+                "jquery/ui": "jquery/jquery-ui"
+            }
+        };
+    </script>
 
-    <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script>
-    <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script>
-    <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-ui.js') ?>"></script>
-    <script type="text/javascript" src="<?php echo $this->getViewFileUrl('headjs/head.min.js') ?>"></script>
-    <script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/mage.js') ?>"></script>
-    <script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script>
+
+    <script src="<?php echo $this->getViewFileUrl('requirejs/require.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('app-config.js') ?>"></script>
 
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('Magento_Install::css/mage-js-style.css') ?>" type="text/css"
           media="all"/>
diff --git a/app/code/Magento/Install/view/install/web/js/install.js b/app/code/Magento/Install/view/install/web/js/install.js
index 731e383aab8ea7f5532c50ed84730b01ae6f76fa..dd0a3dc1ba7088fd383b487daa7ee40b818d0089 100644
--- a/app/code/Magento/Install/view/install/web/js/install.js
+++ b/app/code/Magento/Install/view/install/web/js/install.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function($) {
+define([
+    "jquery",
+    "mage/mage",
+    "mage/validation/validation"
+], function($) {
+
     $.extend(true, $.mage, {
         install: {
             /**
@@ -93,4 +98,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..0125d6d2c462e0f26a3fdfc8e7673f9d6e027d9b
--- /dev/null
+++ b/app/code/Magento/Integration/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-integration",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Integration"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php
index 559dcbb1db89eb0f35de619c11215fecf5b2b906..bc364bcda9907222a088b82e7f3df98b4ab34daf 100644
--- a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php
+++ b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php
@@ -60,13 +60,13 @@ $table = $installer->getConnection()->newTable(
 )->addColumn(
     'key',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    \Magento\Framework\Oauth\Helper\Oauth::LENGTH_CONSUMER_KEY,
+    32,
     array('nullable' => false),
     'Key code'
 )->addColumn(
     'secret',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    \Magento\Framework\Oauth\Helper\Oauth::LENGTH_CONSUMER_SECRET,
+    32,
     array('nullable' => false),
     'Secret code'
 )->addColumn(
@@ -146,19 +146,19 @@ $table = $installer->getConnection()->newTable(
 )->addColumn(
     'token',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    \Magento\Framework\Oauth\Helper\Oauth::LENGTH_TOKEN,
+    32,
     array('nullable' => false),
     'Token'
 )->addColumn(
     'secret',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    \Magento\Framework\Oauth\Helper\Oauth::LENGTH_TOKEN_SECRET,
+    32,
     array('nullable' => false),
     'Token Secret'
 )->addColumn(
     'verifier',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    \Magento\Framework\Oauth\Helper\Oauth::LENGTH_TOKEN_VERIFIER,
+    32,
     array('nullable' => true),
     'Token Verifier'
 )->addColumn(
diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml
index cad7c08d5334c665d7b23ea4e806d35f6a8d673c..1392c6e5bf3d4ae12762aa362826fe29b1b7e555 100644
--- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml
+++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml
@@ -32,11 +32,6 @@
                 <argument name="file" xsi:type="string">Magento_Integration::integration.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-integration-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Integration::js/integration.js</argument>
-            </arguments>
-        </block>
     </referenceBlock>
     <update handle="adminhtml_integration_grid_block"/>
     <referenceBlock name="content">
diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml
index f39dec204396d97188112aebc3728344f271ab97..35793138899dc8d17abe01e9d17e91a99164e325 100644
--- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml
+++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml
@@ -30,11 +30,6 @@
                 <argument name="file" xsi:type="string">Magento_Integration::integration.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="integration-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Integration::js/integration.js</argument>
-            </arguments>
-        </block>
     </referenceBlock>
     <update handle="adminhtml_integration_edit"/>
     <referenceBlock name="content">
diff --git a/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml b/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml
index 3601de5d7b999038a7f01fcc645b9fb719706bf1..0c57fe56d625872afff14e1f5625830267a5218e 100644
--- a/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml
+++ b/app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml
@@ -27,6 +27,12 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    "jquery",
+    "jquery/ui",
+	"Magento_Integration/js/integration"
+], function($){
+
     window.integration = new Integration(
         '<?php echo $this->getUrl('*/*/permissionsDialog', ['id' => ':id', 'reauthorize' => ':isReauthorize']); ?>',
         '<?php echo $this->getUrl('*/*/tokensDialog', ['id' => ':id', 'reauthorize' => ':isReauthorize']); ?>',
@@ -34,6 +40,35 @@
         '<?php echo $this->getUrl('*/*'); ?>',
         '<?php echo $this->getUrl('*/*/loginSuccessCallback'); ?>'
     );
+
+    /**
+     * Confirm dialog for delete integration action
+     */
+    $(function () {
+        $('#integrationGrid_table').on('click', 'button#delete', function (e) {
+            $('#integration-delete-container').dialog({
+                modal: true,
+                autoOpen: true,
+                resizable: false,
+                minHeight: 200,
+                minWidth: 300,
+                dialogClass: "no-close",
+                position: {at: 'top'},
+                buttons: {
+                    Cancel: function () {
+                        $(this).dialog("close");
+                    },
+                    Delete: function () {
+                        $(this).dialog("close");
+                        window.location.href = $(e.target).data('url');
+                    }
+                }
+            });
+            e.stopPropagation();
+        });
+    });
+
+});
 </script>
 <div id="integration-popup-container" style="display:none;"></div>
 <div id="integration-delete-container" style="display:none;" title="<?php echo __('Are you sure ?'); ?>">
diff --git a/app/code/Magento/Integration/view/adminhtml/web/js/integration.js b/app/code/Magento/Integration/view/adminhtml/web/js/integration.js
index e65a16b13857ab98d802e8cd50b6fd3849585cf8..1442f4ba0d46028ebc53af34738a14ce7a2790e3 100644
--- a/app/code/Magento/Integration/view/adminhtml/web/js/integration.js
+++ b/app/code/Magento/Integration/view/adminhtml/web/js/integration.js
@@ -23,8 +23,13 @@
 /*jshint jquery:true*/
 /*global FORM_KEY*/
 /*global integration*/
-(function ($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     "use strict";
+
     $.widget('mage.integration', {
         /**
          * Options common to all instances of this widget.
@@ -97,7 +102,7 @@
                     window.console && console.log(status + ': ' + error + "\nResponse text:\n" + jqXHR.responseText);
                 },
                 complete: function () {
-                    jQuery('body').trigger('processStop');
+                    $('body').trigger('processStop');
                 }
             });
 
@@ -343,31 +348,4 @@
         };
     };
 
-    /**
-     * Confirm dialog for delete integration action
-     */
-    $(function () {
-        $('#integrationGrid_table').on('click', 'button#delete', function (e) {
-            $('#integration-delete-container').dialog({
-                modal: true,
-                autoOpen: true,
-                resizable: false,
-                minHeight: 200,
-                minWidth: 300,
-                dialogClass: "no-close",
-                position: {at: 'top'},
-                buttons: {
-                    Cancel: function () {
-                        $(this).dialog("close");
-                    },
-                    Delete: function () {
-                        $(this).dialog("close");
-                        window.location.href = $(e.target).data('url');
-                    }
-                }
-            });
-            e.stopPropagation();
-        });
-    });
-
-})(jQuery, window);
+});
diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..be9d3df13b41908fa9077af82c6a9d6ce02e3e21
--- /dev/null
+++ b/app/code/Magento/LayeredNavigation/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-layered-navigation",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/LayeredNavigation"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..a61e95929ee8885228d1d58535c9999d575aa7a6
--- /dev/null
+++ b/app/code/Magento/Log/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-log",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Log"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..6dee20220838b2ed0a8473b5d3cd915d49591851
--- /dev/null
+++ b/app/code/Magento/Multishipping/composer.json
@@ -0,0 +1,28 @@
+{
+    "name": "magento/module-multishipping",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Multishipping"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml
index dba725d685470ef6b6f1639d61fff8f0df194d9d..53bdd2b212f18bb9384ef9e28e512878352ffd7f 100644
--- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml
+++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml
@@ -54,8 +54,12 @@
     </div>
 </div>
 <script type="text/javascript">
+require(['jquery', 'mage/mage'], function(jQuery){
+
     jQuery('.actions').mage('address', {
         addAddress: "button[role='add-address']",
         addAddressLocation: '<?php echo $this->getAddNewUrl() ?>'
     });
+
+});
 </script>
diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml
index a30fb3bd376071be4b6f16a5f17f44c1fe0947cb..792b47b1ece4552b843ad803f696b08e98cb7061 100644
--- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml
+++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml
@@ -78,6 +78,8 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery', 'mage/mage'], function(jQuery){
+
     var addtocartForm = jQuery('#multishipping-billing-form');
     addtocartForm.mage('payment', {
         checkoutPrice: <?php echo (float)$this->getQuoteBaseGrandTotal(); ?>
@@ -91,4 +93,6 @@
             }
         }
     });
+
+});
 </script>
diff --git a/app/code/Magento/Multishipping/view/frontend/templates/js/components.phtml b/app/code/Magento/Multishipping/view/frontend/templates/js/components.phtml
index e77ff6ba94e86cab7fc861a39d98e4bd112ff273..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Multishipping/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Multishipping/view/frontend/templates/js/components.phtml
@@ -22,17 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            multiShipping: [
-                '<?php echo $this->getViewFileUrl('Magento_Multishipping::js/multi-shipping.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Multishipping/view/frontend/web/js/multi-shipping.js b/app/code/Magento/Multishipping/view/frontend/web/js/multi-shipping.js
index a85e8a02f49c2c9fe45519c2ea569dd989fe71a4..3f0a1ed79137bb7789d35ce2d0e779ec7711e9a0 100644
--- a/app/code/Magento/Multishipping/view/frontend/web/js/multi-shipping.js
+++ b/app/code/Magento/Multishipping/view/frontend/web/js/multi-shipping.js
@@ -22,8 +22,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+    
     $.widget('mage.multiShipping', {
         options: {
             addNewAddressBtn: 'button[data-role="add-new-address"]', // Add a new multishipping address.
@@ -59,4 +63,5 @@
             $(this.options.canContinueFlag).val(parseInt($(event.currentTarget).data('flag'), 10));
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1850aa528a4432e7029dd05719054c64bca9d647
--- /dev/null
+++ b/app/code/Magento/Newsletter/composer.json
@@ -0,0 +1,29 @@
+{
+    "name": "magento/module-newsletter",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-email": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-cron": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Newsletter"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml
index 15ced67469b3376aaac84912769eef3105f70950..251ff8a709ab5bb3494e8e16ce550a42787e49e8 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml
+++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_edit.xml
@@ -31,19 +31,9 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
+                <argument name="file" xsi:type="string">jquery/fileUploader/bootstrap.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml
index 257ecf67b0e90a8994bafc65dd1410299a5d7cf5..6310713705d745aa7a8e4c10279ed0fcf3648777 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml
+++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_edit.xml
@@ -31,29 +31,9 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-canvas-to-blob-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/canvas-to-blob.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
+                <argument name="file" xsi:type="string">jquery/fileUploader/bootstrap.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml
index 3509f4511ad330cdd64601e9c94536996545dc7f..af988e13cc27f60d02fcec44e3a1f4351f58d3b8 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml
+++ b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml
@@ -44,6 +44,8 @@
 </div>
 
 <script type="text/javascript">
+require(['jquery', 'js/theme', 'prototype'], function(jQuery){
+
 //<![CDATA[
 var previewForm = $('preview_form');
 var previewIframe = $('preview_iframe');
@@ -72,6 +74,8 @@ jQuery("#preview_iframe").load(function() {
 });
 
 //]]>
+
+});
 </script>
 </body>
 </html>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml
index 52c634ebf079b62c5abfb737e3c495b8d828bbdf..f0ab018dce02d4238696388ddd73fad2201e6c79 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml
+++ b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml
@@ -53,11 +53,15 @@
     <?php echo $this->getHintHtml() ?>
 </div>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 Event.observe($('store_switcher'), 'change', function(event) {
     var element = Event.element(event);
     $('preview_store_id').value = element.value;
 });
 //]]>
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/problem/list.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/problem/list.phtml
index db8993aa2f6d31a5afd779cb4c2684e9d8bec705..8d4e2fcaf3db5d8ec984c06314c3a40e1a2d4ab4 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/templates/problem/list.phtml
+++ b/app/code/Magento/Newsletter/view/adminhtml/templates/problem/list.phtml
@@ -31,8 +31,10 @@
 </div>
 <?php endif ?>
 <script type="text/javascript">
+require(["prototype", "mage/adminhtml/events"], function(){
+
     <!--
-    var problemController = {
+    problemController = {
         checkCheckboxes:function (controlCheckbox) {
             var elements = $('problemGrid').getElementsByClassName('problemCheckbox');
             elements.each(function (obj) {
@@ -78,4 +80,6 @@
 
     varienGlobalEvents.attachEventHandler('gridRowClick', problemController.rowClick.bind(problemController));
     //-->
+
+});
 </script>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/queue/edit.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/queue/edit.phtml
index 9ad6c53e05e398417edbfb3f8bf0fdf74a1cabe6..bc73f437e7619409a33062ed15d4affcc73b19e7 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/templates/queue/edit.phtml
+++ b/app/code/Magento/Newsletter/view/adminhtml/templates/queue/edit.phtml
@@ -49,11 +49,13 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery', 'mage/mage', 'prototype'], function(jQuery){
+
 //<![CDATA[
 jQuery('#queue_edit_form').mage('form').mage('validation');
 jQuery('#newsletter_queue_preview_form').mage('form').mage('validation');
 
-var queueControl = {
+queueControl = {
     id: 'text',
     preview: function() {
         if (this.isEditor() && tinyMCE.get(this.id)) {
@@ -78,4 +80,6 @@ var queueControl = {
     }
 };
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/subscriber/list.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/subscriber/list.phtml
index 06dee2b5b27d71bba13e85abf76c3a24e2c2317f..f1bed48fd947e4b3af3b84b6a5aca0127e5d3869 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/templates/subscriber/list.phtml
+++ b/app/code/Magento/Newsletter/view/adminhtml/templates/subscriber/list.phtml
@@ -34,8 +34,10 @@
 </div>
 <?php endif ?>
 <script type="text/javascript">
+require(["prototype", "mage/adminhtml/events"], function(){
+
 <!--
-    var subscriberController = {
+    subscriberController = {
         checkCheckboxes: function(controlCheckbox) {
             var elements = $('subscriberGrid').getElementsByClassName('subscriberCheckbox');
             elements.each(function(obj){
@@ -68,4 +70,6 @@
 
     varienGlobalEvents.attachEventHandler('gridRowClick', subscriberController.rowClick.bind(subscriberController));
 //-->
+
+});
 </script>
diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/template/edit.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/template/edit.phtml
index c75b97f91d4a8ba89e403b97e2517fc9fab298c9..ed7b8e85023a4e3b5fd0071ff4dc189337e7e314 100644
--- a/app/code/Magento/Newsletter/view/adminhtml/templates/template/edit.phtml
+++ b/app/code/Magento/Newsletter/view/adminhtml/templates/template/edit.phtml
@@ -41,10 +41,12 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery', 'mage/mage', 'prototype'], function(jQuery){
+
 //<![CDATA[
     jQuery('#newsletter_template_edit_form').mage('form').mage('validation');
     jQuery('#newsletter_template_preview_form').mage('form').mage('validation');
-    var templateControl = {
+    templateControl = {
 
         unconvertedText: '',
         typeChange: false,
@@ -170,4 +172,6 @@
     templateControl.init();
     templateControl.templateName = "<?php echo $this->getJsTemplateName() ?>";
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Newsletter/view/frontend/templates/js/components.phtml b/app/code/Magento/Newsletter/view/frontend/templates/js/components.phtml
index b8e42a35ef71ae56c3576fab406ef6e6be9f53ac..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Newsletter/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Newsletter/view/frontend/templates/js/components.phtml
@@ -22,21 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-    <script type="text/javascript">
-        (function($) {
-            "use strict";
-            /**
-             * Declaration of resources needed for defined components
-             */
-            $.mage.component({
-                newsletter: [
-                    '<?php echo $this->getViewFileUrl('Magento_Newsletter::newsletter.js')?>',
-                    '<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>',
-                    '<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js') ?>',
-                    '<?php echo $this->getViewFileUrl('mage/validation.js')?>',
-                    '<?php echo $this->getViewFileUrl('mage/validation/validation.js') ?>'
-                ]
-            });
-        })(jQuery);
-    </script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Newsletter/view/frontend/web/newsletter.js b/app/code/Magento/Newsletter/view/frontend/web/newsletter.js
index 81e65e35d7e370984378518fec28a54ea2160755..751449fa314124bf0840d582d2a5e88e4c660c47 100644
--- a/app/code/Magento/Newsletter/view/frontend/web/newsletter.js
+++ b/app/code/Magento/Newsletter/view/frontend/web/newsletter.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/validation/validation"
+], function($){
+
     $.widget('mage.newsletter', {
         options: {
             errorClass: 'mage-error'
@@ -42,4 +47,4 @@
             }, this));
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..93acbbb7a2895fe936b9d36da93ddc0ea797951f
--- /dev/null
+++ b/app/code/Magento/OfflinePayments/composer.json
@@ -0,0 +1,20 @@
+{
+    "name": "magento/module-offline-payments",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/OfflinePayments"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..417547b6b4d5a0e39c91e8d755a1919e3f190a06
--- /dev/null
+++ b/app/code/Magento/OfflineShipping/composer.json
@@ -0,0 +1,27 @@
+{
+    "name": "magento/module-offline-shipping",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-sales-rule": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/OfflineShipping"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..324926c35f230870ca996f1d3c31631ca2b51306
--- /dev/null
+++ b/app/code/Magento/Ogone/composer.json
@@ -0,0 +1,23 @@
+{
+    "name": "magento/module-ogone",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Ogone"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Ogone/sql/ogone_setup/install-1.6.0.0.php b/app/code/Magento/Ogone/data/ogone_setup/data-install-1.6.0.0.php
similarity index 100%
rename from app/code/Magento/Ogone/sql/ogone_setup/install-1.6.0.0.php
rename to app/code/Magento/Ogone/data/ogone_setup/data-install-1.6.0.0.php
diff --git a/app/code/Magento/Ogone/view/frontend/templates/placeform.phtml b/app/code/Magento/Ogone/view/frontend/templates/placeform.phtml
index 08c094c1a2e5dfde282f15a363eeff6d78b80d97..bf943782b2a1ee1c523a41c3825b7be5a209c57a 100644
--- a/app/code/Magento/Ogone/view/frontend/templates/placeform.phtml
+++ b/app/code/Magento/Ogone/view/frontend/templates/placeform.phtml
@@ -34,8 +34,12 @@
     <?php endif; ?>
 </form>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     // submit the form as soon as it is displayed to transfer over to the ogone website
     window.onload = function() {
         jQuery("#ogone-review-form").submit();
     };
+
+});
 </script>
diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..c0f7ecc263facd25eba439fb3a2cdd86ff62b11c
--- /dev/null
+++ b/app/code/Magento/PageCache/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "magento/module-page-cache",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/PageCache"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/PageCache/etc/module.xml b/app/code/Magento/PageCache/etc/module.xml
index 4d3e6065287433cf82181378b26afe6309d139ff..d354aef54222fcc6ff784255446b0afbbd4e4cc4 100644
--- a/app/code/Magento/PageCache/etc/module.xml
+++ b/app/code/Magento/PageCache/etc/module.xml
@@ -32,7 +32,6 @@
         <depends>
             <module name="Magento_Store"/>
             <module name="Magento_Backend"/>
-            <module name="Magento_Theme"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/PageCache/view/adminhtml/templates/page_cache_validation.phtml b/app/code/Magento/PageCache/view/adminhtml/templates/page_cache_validation.phtml
index 60810e648dc47de0ecda97103f097a01edceae0b..a439d232bcca7564b567ac282d1301aa47c033c8 100644
--- a/app/code/Magento/PageCache/view/adminhtml/templates/page_cache_validation.phtml
+++ b/app/code/Magento/PageCache/view/adminhtml/templates/page_cache_validation.phtml
@@ -26,8 +26,9 @@
 <?php /** @var \Magento\PageCache\Block\System\Config\Form\Field\Export $this */
 ?>
 <script type="text/javascript">
+require(['jquery'], function($){
+
     //<![CDATA[
-    (function ($) {
         var fieldset = $('#system_full_page_cache_varnish'),
             fields = fieldset.find(':input:not(button)');
         if (fieldset.is(':visible') == false) {
@@ -43,6 +44,7 @@
             });
             $('#system_full_page_cache_varnish_export_button').prop('disabled', (invalidFields.length > 0));
         });
-    })(jQuery);
     //]]>
+
+});
 </script>
\ No newline at end of file
diff --git a/app/code/Magento/PageCache/view/frontend/layout/default.xml b/app/code/Magento/PageCache/view/frontend/layout/default.xml
index d63532d151f196569b68a3f05257e6806b69c0ca..38ee47cf9a35b1885add44aadc2b58f0a2b1737f 100644
--- a/app/code/Magento/PageCache/view/frontend/layout/default.xml
+++ b/app/code/Magento/PageCache/view/frontend/layout/default.xml
@@ -27,23 +27,7 @@
     <referenceBlock name="head.components">
         <block class="Magento\Framework\View\Element\Js\Components" name="pagecache_page_head_components" template="Magento_PageCache::js/components.phtml"/>
     </referenceBlock>
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-pagecache-comments-js" after="jquery-jquery-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_PageCache::js/comments.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-pagecache-form-key-js" after="jquery-jquery-ui-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_PageCache::js/form-key.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-msg-box-js" after="jquery-jquery-ui-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_PageCache::js/msg-box.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
+    <referenceBlock name="head"></referenceBlock>
     <referenceContainer name="content">
         <block class="Magento\PageCache\Block\Javascript" template="Magento_PageCache::javascript.phtml" name="pageCache" as="pageCache"/>
     </referenceContainer>
diff --git a/app/code/Magento/PageCache/view/frontend/templates/javascript.phtml b/app/code/Magento/PageCache/view/frontend/templates/javascript.phtml
index 5cf07fc668ef743a454e7a93bf150667fdd3ccbf..0c35f7f4e1bf9dc60dad7f6cf43429690b6341e7 100644
--- a/app/code/Magento/PageCache/view/frontend/templates/javascript.phtml
+++ b/app/code/Magento/PageCache/view/frontend/templates/javascript.phtml
@@ -24,9 +24,16 @@
 ?>
 <?php /** @var \Magento\PageCache\Block\Javascript $this */ ?>
 <script type="text/javascript">
+require([
+	"jquery",
+	"mage/mage"
+], function(jQuery){
+
     //<![CDATA[
     jQuery(function () {
         jQuery('body').mage('pageCache', <?php echo $this->getScriptOptions(); ?>);
     });
     //]]>
+
+});
 </script>
\ No newline at end of file
diff --git a/app/code/Magento/PageCache/view/frontend/templates/js/components.phtml b/app/code/Magento/PageCache/view/frontend/templates/js/components.phtml
index cde6fa9c917322dd947cb77f5250cfb019b066d4..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/PageCache/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/PageCache/view/frontend/templates/js/components.phtml
@@ -22,20 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            formKey: [
-                '<?php echo $this->getViewFileUrl('Magento_PageCache::js/form-key.js') ?>'
-            ],
-            pageCache: [
-                '<?php echo $this->getViewFileUrl('Magento_PageCache::js/page-cache.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/comments.js b/app/code/Magento/PageCache/view/frontend/web/js/comments.js
index 72341b5fcc51c67b3766b0f374e869c86854736e..2db480e55d6a798c23913f52739deae0a8196d5c 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/comments.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/comments.js
@@ -23,13 +23,15 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function ($, win) {
+define([
+    "jquery"
+], function($){
     "use strict";
     $.fn.comments = function () {
         var elements = [];
         var lookup = function (el) {
             if (el.is('iframe')) {
-                var hostName = win.location.hostname,
+                var hostName = window.location.hostname,
                     iFrameHostName = $('<a>').prop('href', el.prop('src')).prop('hostname');
                 if (hostName != iFrameHostName) {
                     return elements;
@@ -46,4 +48,5 @@
         lookup(this);
         return elements;
     };
-})(jQuery, window);
\ No newline at end of file
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/form-key.js b/app/code/Magento/PageCache/view/frontend/web/js/form-key.js
index c2910a8c9088f421e9fe4d9fd7c623b51456025a..23540274e895f07488cd02c0fee18e2689d10401 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/form-key.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/form-key.js
@@ -20,8 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/cookies"
+], function($){
 
-(function($) {
     /**
      * FormKey Widget - this widget is generating from key, saves it to cookie and
      */
@@ -50,7 +54,9 @@
             return result;
         }
     });
+
     $(function() {
         $('body').formKey();
     });
-})(jQuery);
\ No newline at end of file
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/msg-box.js b/app/code/Magento/PageCache/view/frontend/web/js/msg-box.js
index 248c2f0f9c04e141ea5aa8dc88b39988dfa8014f..f80ea27ddf96382164896eb27014b89e7ebc18a2 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/msg-box.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/msg-box.js
@@ -20,10 +20,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint browser:true jquery:true expr:true*/
-(function ($) {
-    "use strict";
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/cookies"
+], function($){
+     "use strict";
+    
     /**
      * MsgBox Widget checks if message box is displayed and sets cookie
      */
@@ -40,8 +44,9 @@
             }
         }
     });
-})(jQuery);
 
-jQuery(document).ready(function($){
-    $('body').msgBox();
-});
+    $(document).ready(function($){
+        $('body').msgBox();
+    });
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index d678846945b9413d6991210a8d6aaccaf98c9f3a..85c46f4520ee5e1b010c8af2f1767921c6f50a13 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -23,8 +23,14 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true expr:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/cookies",
+    "Magento_PageCache/js/comments"
+], function($){
     "use strict";
+    
     $.widget('mage.pageCache', {
         options: {
             url: '/',
@@ -132,4 +138,4 @@
             });
         }
     });
-})(jQuery);
\ No newline at end of file
+});
diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..61cff656014e1d12bd9d2b2756267e34f873d6cd
--- /dev/null
+++ b/app/code/Magento/PayPalRecurringPayment/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-pay-pal-recurring-payment",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-paypal": "0.1.0-alpha89",
+        "magento/module-recurring-payment": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/PayPalRecurringPayment"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..789f80d72d54070c539bd5a15c68ac6b231ff014
--- /dev/null
+++ b/app/code/Magento/Payment/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-payment",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-centinel": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Payment"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml b/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml
index 8c5b09f283b8e0bfdd674a0f6125670bca44a4bd..207e295a49bda2a5b95de3466bb7f7d657bc0be9 100644
--- a/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml
+++ b/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml
@@ -99,19 +99,23 @@
             <div class="adv-container">&nbsp;</div>
 
             <script type="text/javascript">
-                //<![CDATA[
-                var SSChecked<?php echo $_code ?> = function() {
-                    var elm = $('<?php echo $_code ?>_cc_type');
-                    if (['SS','SM','SO'].indexOf(elm.value) != -1) {
-                        jQuery('#' + '<?php echo $_code ?>_cc_type_ss_div').show().removeClass('ignore-validate');
-                    } else {
-                        jQuery('#' + '<?php echo $_code ?>_cc_type_ss_div').hide().addClass('ignore-validate');
-                    }
-                };
-                Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
-                SSChecked<?php echo $_code ?>();
-                //]]>
-            </script>
+require(['jquery', 'prototype'], function(jQuery){
+
+    //<![CDATA[
+    SSChecked<?php echo $_code ?> = function() {
+        var elm = $('<?php echo $_code ?>_cc_type');
+        if (['SS','SM','SO'].indexOf(elm.value) != -1) {
+            jQuery('#' + '<?php echo $_code ?>_cc_type_ss_div').show().removeClass('ignore-validate');
+        } else {
+            jQuery('#' + '<?php echo $_code ?>_cc_type_ss_div').hide().addClass('ignore-validate');
+        }
+    };
+    Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
+    SSChecked<?php echo $_code ?>();
+    //]]>
+            
+});
+</script>
         </div>
     <?php endif; ?>
 </fieldset>
diff --git a/app/code/Magento/Payment/view/frontend/web/cc-type.js b/app/code/Magento/Payment/view/frontend/web/cc-type.js
index 57a399faf505547daf50e8633a55e30ff9c0c4ce..703a753257b47da883c6db4cdaeb315d252b7de1 100644
--- a/app/code/Magento/Payment/view/frontend/web/cc-type.js
+++ b/app/code/Magento/Payment/view/frontend/web/cc-type.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.creditCardType', {
         options: {
             typeCodes: ['SS', 'SM', 'SO'] // Type codes for Switch/Maestro/Solo credit cards.
@@ -47,4 +51,5 @@
                 .toggle($.inArray(this.element.val(), this.options.typeCodes) !== -1);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php
index c7a044c9b91d74db350be01236f83c2e7b0a911b..8bf6d4d6b47b267ee53ede90f1ee5288f7209a43 100644
--- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php
+++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php
@@ -41,6 +41,7 @@ class Location extends \Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Ex
     {
         $this->setElement($element);
         $js = '
+            require(["prototype"], function(){
             document.observe("dom:loaded", function() {
                 $$(".with-button button.button").each(function(configureButton) {
                     togglePaypalSolutionConfigureButton(configureButton, true);
@@ -402,6 +403,8 @@ class Location extends \Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Ex
                     }
                 });
             });
+
+            });
         ';
         return parent::render($element) . $this->_jsHelper->getScript($js);
     }
diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..cfc787d36f474ab1b1f6a409c244a0fbe82ca6c6
--- /dev/null
+++ b/app/code/Magento/Paypal/composer.json
@@ -0,0 +1,33 @@
+{
+    "name": "magento/module-paypal",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-centinel": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Paypal"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php b/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php
new file mode 100644
index 0000000000000000000000000000000000000000..c1a85daa4350d42b50024fc65e963e33c0ba3912
--- /dev/null
+++ b/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var $installer \Magento\Sales\Model\Resource\Setup */
+$installer = $this;
+
+/**
+ * Prepare database for install
+ */
+$installer->startSetup();
+/**
+ * Add paypal attributes to the:
+ *  - sales/flat_quote_payment_item table
+ *  - sales/flat_order table
+ */
+$installer->addAttribute('quote_payment', 'paypal_payer_id', array());
+$installer->addAttribute('quote_payment', 'paypal_payer_status', array());
+$installer->addAttribute('quote_payment', 'paypal_correlation_id', array());
+$installer->addAttribute(
+    'order',
+    'paypal_ipn_customer_notified',
+    array('type' => 'int', 'visible' => false, 'default' => 0)
+);
+
+$data = array();
+$statuses = array('pending_paypal' => __('Pending PayPal'));
+foreach ($statuses as $code => $info) {
+    $data[] = array('status' => $code, 'label' => $info);
+}
+$installer->getConnection()->insertArray($installer->getTable('sales_order_status'), array('status', 'label'), $data);
+
+/**
+ * Prepare database after install
+ */
+$installer->endSetup();
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php
similarity index 100%
rename from app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.2-1.6.0.3.php
rename to app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php b/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
index a7cfd31533fd6066a47466364a3756d7d3641a2f..9607f307fe10090d7c5de15034667c382c65f608 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
@@ -281,7 +281,7 @@ $table = $installer->getConnection()->newTable(
     'gross_transaction_currency',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     3,
-    array('default' => ''),
+    array('default' => false),
     'Gross Transaction Currency'
 )->addColumn(
     'fee_debit_or_credit',
@@ -371,28 +371,6 @@ $table = $installer->getConnection()->newTable(
     'Paypal Certificate Table'
 );
 $installer->getConnection()->createTable($table);
-
-/**
- * Add paypal attributes to the:
- *  - sales/flat_quote_payment_item table
- *  - sales/flat_order table
- */
-$installer->addAttribute('quote_payment', 'paypal_payer_id', array());
-$installer->addAttribute('quote_payment', 'paypal_payer_status', array());
-$installer->addAttribute('quote_payment', 'paypal_correlation_id', array());
-$installer->addAttribute(
-    'order',
-    'paypal_ipn_customer_notified',
-    array('type' => 'int', 'visible' => false, 'default' => 0)
-);
-
-$data = array();
-$statuses = array('pending_paypal' => __('Pending PayPal'));
-foreach ($statuses as $code => $info) {
-    $data[] = array('status' => $code, 'label' => $info);
-}
-$installer->getConnection()->insertArray($installer->getTable('sales_order_status'), array('status', 'label'), $data);
-
 /**
  * Prepare database after install
  */
diff --git a/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml b/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml
index 8066c90a16773d76d0764c1fb5a80c9f35b89aef..5dd89e3a0af2714f3a285752b43e884d3f6aa173 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/express/review.phtml
@@ -136,10 +136,14 @@
     </div>
 </div>
 <script type="text/javascript">
+require(['jquery', 'mage/mage'], function(jQuery){
+
     jQuery('#order-review-form').mage('validation', {}).mage('orderReview', {
         shippingSubmitFormSelector: '#shipping-method-form',
         shippingSelector: '#shipping-method',
         shippingMethodUpdateUrl: '<?php echo $this->escapeHtml($this->getUpdateShippingMethodsUrl()) ?>',
         isAjax: <?php echo $this->getUseAjax() ? 'true' : 'false' ?>
     });
+
+});
 </script>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/express/shortcut.phtml b/app/code/Magento/Paypal/view/frontend/templates/express/shortcut.phtml
index e076babdc281be4ac8a76677d565654bd7685fe1..9c65d060a06b08d47dda3c9dd932449bdd72ce0d 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/express/shortcut.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/express/shortcut.phtml
@@ -55,16 +55,16 @@ if ($this->isOrPositionBefore()) {
         <a href="<?php echo $linkImage['href']?>"><img src="<?php echo $linkImage['src']?>" /></a>
     <?php endif; ?>
     <script type="text/javascript">
-        (function ($) {
-            head.js("<?php echo $this->getViewFileUrl('Magento_Paypal::js/paypal-checkout.js') ?>", head.ready(function () {
-                $('.paypal-logo.<?php echo $shortcutHtmlId ?>').paypalCheckout({
-                    confirmMessage: "<?php echo $this->escapeJsQuote($this->getConfirmationMessage())?>",
-                    confirmUrl: "<?php echo !empty($confirmationUrl) ? $confirmationUrl : false ?>",
-                    isCatalogProduct: "<?php echo !empty($isInCatalogProduct) ? $isInCatalogProduct : false ?>",
-                    paypalCheckoutSelector: '#pp-checkout-url',
-                    productAddToCartForm: '#product_addtocart_form'
-                });
-            }));
-        })(jQuery);
-    </script>
+require(['jquery', 'Magento_Paypal/js/paypal-checkout'], function($){
+
+    $('.paypal-logo.<?php echo $shortcutHtmlId ?>').paypalCheckout({
+        confirmMessage: "<?php echo $this->escapeJsQuote($this->getConfirmationMessage())?>",
+        confirmUrl: "<?php echo !empty($confirmationUrl) ? $confirmationUrl : false ?>",
+        isCatalogProduct: "<?php echo !empty($isInCatalogProduct) ? $isInCatalogProduct : false ?>",
+        paypalCheckoutSelector: '#pp-checkout-url',
+        productAddToCartForm: '#product_addtocart_form'
+    });
+    
+});
+</script>
 </div>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/hss/form.phtml b/app/code/Magento/Paypal/view/frontend/templates/hss/form.phtml
index a1f36dfc6c2fa5d0ca7ea3249a81e84cd0ddaa8b..40fedef5ad3d140ca60c67502fc17ffab0d801a3 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/hss/form.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/hss/form.phtml
@@ -38,8 +38,12 @@
     <input type="hidden" name="MODE" value="<?php echo $this->isTestMode() ? 'TEST' : 'LIVE'; ?>"/>
 </form>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     // this is NOT tested.
     jQuery('#token_form').submit();
+
+});
 </script>
 </body>
 </html>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/hss/redirect.phtml b/app/code/Magento/Paypal/view/frontend/templates/hss/redirect.phtml
index 58e8f7d7773a4d1600d7f5d40739da85cf924157..a2a237f4d73c18dd020663b8c72464302c972256 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/hss/redirect.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/hss/redirect.phtml
@@ -33,6 +33,8 @@
 </head>
 <body>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     // this code is NOT tested!
     if (window.top == window.self) {
         window.location = "<?php echo $this->getUrl('checkout/cart') ?>";
@@ -56,6 +58,8 @@
     <?php else : ?>
     window.top.location = "<?php echo $this->getUrl('checkout/cart') ?>";
     <?php endif; ?>
+
+});
 </script>
 </body>
 </html>
\ No newline at end of file
diff --git a/app/code/Magento/Paypal/view/frontend/templates/js/components.phtml b/app/code/Magento/Paypal/view/frontend/templates/js/components.phtml
index 6d9bf4e498fd1bb934e095b8da6ab6b300d5c547..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/js/components.phtml
@@ -22,20 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            opcheckoutPaypalIframe: [
-                '<?php echo $this->getViewFileUrl('Magento_Paypal::js/opcheckout.js') ?>'
-            ],
-            orderReview: [
-                '<?php echo $this->getViewFileUrl('Magento_Paypal::order-review.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml b/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml
index b5ee9018416d124a10aa603f0084ce9bcff95089..0aa255928ae38f5c5a827ebdfd9d25d22305d07f 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml
@@ -23,7 +23,10 @@
  */
 ?>
 <script type="text/javascript">
-    (function($) {
-    	$('#checkoutSteps').mage('opcheckoutPaypalIframe');
-    })(jQuery);
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+    $('#checkoutSteps').mage('opcheckoutPaypalIframe');
+});
 </script>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/form.phtml b/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/form.phtml
index 76d4e02a2f62623ee3581b0c59ded692fd722e4f..aaa771f271d1d978a8020450d55b639be8fef160 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/form.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/form.phtml
@@ -38,8 +38,12 @@
     <input type="hidden" name="MODE" value="<?php echo $this->isTestMode() ? 'TEST' : 'LIVE'; ?>"/>
 </form>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     // this is NOT tested.
     jQuery('#token_form').submit();
+
+});
 </script>
 </body>
 </html>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/redirect.phtml b/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/redirect.phtml
index 4e0ebcfad4f76687c76d614e737a4f722ad64841..a35d1c1ccd50379bf9e59432c9c363d1b9165568 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/redirect.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/payflowadvanced/redirect.phtml
@@ -33,6 +33,9 @@
 </head>
 <body>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+var $ = jQuery;
+
     if (window.top == window.self) {
         window.location = "<?php echo $this->getUrl('checkout/cart') ?>";
     }
@@ -61,6 +64,8 @@
     <?php else : ?>
     window.top.location = "<?php echo $this->getUrl('checkout/cart') ?>";
     <?php endif; ?>
+
+});
 </script>
 </body>
 </html>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/payflowlink/form.phtml b/app/code/Magento/Paypal/view/frontend/templates/payflowlink/form.phtml
index a1f36dfc6c2fa5d0ca7ea3249a81e84cd0ddaa8b..40fedef5ad3d140ca60c67502fc17ffab0d801a3 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/payflowlink/form.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/payflowlink/form.phtml
@@ -38,8 +38,12 @@
     <input type="hidden" name="MODE" value="<?php echo $this->isTestMode() ? 'TEST' : 'LIVE'; ?>"/>
 </form>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     // this is NOT tested.
     jQuery('#token_form').submit();
+
+});
 </script>
 </body>
 </html>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/payflowlink/redirect.phtml b/app/code/Magento/Paypal/view/frontend/templates/payflowlink/redirect.phtml
index 35db120bb02f3f3274b01b27bc49a470bfc0ce30..830e80cd3f28b3e51e65df7fb778da5e5ce6d916 100644
--- a/app/code/Magento/Paypal/view/frontend/templates/payflowlink/redirect.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/payflowlink/redirect.phtml
@@ -31,6 +31,9 @@
 </head>
 <body>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+var $ = jQuery;
+
     if (window.top == window.self) {
         window.location = "<?php echo $this->getUrl('checkout/cart') ?>";
     }
@@ -59,6 +62,8 @@
     <?php else : ?>
     window.top.location = "<?php echo $this->getUrl('checkout/cart') ?>";
     <?php endif; ?>
+
+});
 </script>
 </body>
 </html>
diff --git a/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js b/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js
index 93a18d5e7db7e2a405f710ece62c20b2410f3778..d98a5ad5927a876bf922ff92928885c9fb1a0228 100644
--- a/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js
+++ b/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "Magento_Checkout/js/opc-order-review"
+], function($){
     "use strict";
+
     $.widget('mage.opcheckoutPaypalIframe', $.mage.opcOrderReview, {
         options: {
             review: {
@@ -43,4 +48,4 @@
             this._on(events);
         }
     });
-})(jQuery, window);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Paypal/view/frontend/web/js/paypal-checkout.js b/app/code/Magento/Paypal/view/frontend/web/js/paypal-checkout.js
index 1089e9ca794605a0bb9ee1223d830628736bd0bc..00f7df3977cc29f52e9db7fd301ddaf002348c6e 100644
--- a/app/code/Magento/Paypal/view/frontend/web/js/paypal-checkout.js
+++ b/app/code/Magento/Paypal/view/frontend/web/js/paypal-checkout.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($, window) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/mage"
+], function($){
     "use strict";
+
     $.widget('mage.paypalCheckout', {
         /**
          * Initialize store credit events
@@ -45,4 +50,4 @@
             }, this));
         }
     });
-})(jQuery, window);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Paypal/view/frontend/web/order-review.js b/app/code/Magento/Paypal/view/frontend/web/order-review.js
index 8a6a55f0a57668460f93101810bf2ce716cfebca..3c610bb94ccbcfe3ff286f31999aaeab8ac9cfc9 100644
--- a/app/code/Magento/Paypal/view/frontend/web/order-review.js
+++ b/app/code/Magento/Paypal/view/frontend/web/order-review.js
@@ -22,7 +22,13 @@
  */
 /*jshint browser:true jquery:true*/
 /*global alert*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "mage/mage",
+    "mage/validation"
+], function($){
     "use strict";
 
     $.widget('mage.orderReview', {
@@ -301,4 +307,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..92987b1525fad3af4bfc3902d514f4e94bcaef47
--- /dev/null
+++ b/app/code/Magento/Persistent/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-persistent",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-cron": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Persistent"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
index b5c17ed02f8f1f5a0c88de4ba068fa9e4514c418..24112e2023070631cb351b510b17480bec8a7e5d 100644
--- a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
+++ b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
@@ -40,7 +40,7 @@ $table = $installer->getConnection()->newTable(
 )->addColumn(
     'key',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    \Magento\Persistent\Model\Session::KEY_LENGTH,
+    50,
     array('nullable' => false),
     'Unique cookie key'
 )->addColumn(
diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..478a634fc0441fe1771be8b05f887b64407052ff
--- /dev/null
+++ b/app/code/Magento/ProductAlert/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-product-alert",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/ProductAlert"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/RecurringPayment/composer.json b/app/code/Magento/RecurringPayment/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..98a7df3d23c48bee4308a739c26fb17888adb258
--- /dev/null
+++ b/app/code/Magento/RecurringPayment/composer.json
@@ -0,0 +1,29 @@
+{
+    "name": "magento/module-recurring-payment",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/RecurringPayment"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php b/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php
index 86484db0c7ed99834ab110ba8c1823937e83a9d3..87c94686774a84c79fc7c38d7c70aa86921702e1 100644
--- a/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php
+++ b/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php
@@ -22,6 +22,7 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 /** @var $this \Magento\Catalog\Model\Resource\Setup */
+$this->installEntities();
 $entityTypeId = $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
 $attributeSetId = $this->getAttributeSetId($entityTypeId, 'Default');
 
diff --git a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
index b89f2cae73a38c31ec99399f8705dd4666a02f02..3a7e310032da46fb0e9f94fcf9f036bc4c7c0e7c 100644
--- a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
+++ b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
@@ -313,5 +313,4 @@ $table = $this->getConnection()->newTable(
 );
 $this->getConnection()->createTable($table);
 
-$this->installEntities();
 $this->endSetup();
diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..394f1be72ebe8eb80f85a655a39d66f106e35d52
--- /dev/null
+++ b/app/code/Magento/Reports/composer.json
@@ -0,0 +1,35 @@
+{
+    "name": "magento/module-reports",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-log": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-review": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-downloadable": "0.1.0-alpha89",
+        "magento/module-sales-rule": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Reports"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php b/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php
index 7433d128ab3ad8a82e52a0d8f376868bd5eae79a..57220ce51de2c02d7be0e085e97870d3546990b3 100644
--- a/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php
@@ -28,6 +28,195 @@ $installer = $this;
  * Prepare database for tables install
  */
 $installer->startSetup();
+
+/**
+ * Create table 'report_compared_product_index'.
+ * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that
+ * only one record is added when customer/visitor compares same product again.
+ */
+$table = $installer->getConnection()->newTable(
+    $installer->getTable('report_compared_product_index')
+)->addColumn(
+    'index_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
+    null,
+    array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Index Id'
+)->addColumn(
+    'visitor_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true),
+    'Visitor Id'
+)->addColumn(
+    'customer_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true),
+    'Customer Id'
+)->addColumn(
+    'product_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true, 'nullable' => false),
+    'Product Id'
+)->addColumn(
+    'store_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    null,
+    array('unsigned' => true),
+    'Store Id'
+)->addColumn(
+    'added_at',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
+    null,
+    array('nullable' => false),
+    'Added At'
+)->addIndex(
+    $installer->getIdxName(
+        'report_compared_product_index',
+        array('visitor_id', 'product_id'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
+    array('visitor_id', 'product_id'),
+    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
+)->addIndex(
+    $installer->getIdxName(
+        'report_compared_product_index',
+        array('customer_id', 'product_id'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
+    array('customer_id', 'product_id'),
+    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
+)->addIndex(
+    $installer->getIdxName('report_compared_product_index', array('store_id')),
+    array('store_id')
+)->addIndex(
+    $installer->getIdxName('report_compared_product_index', array('added_at')),
+    array('added_at')
+)->addIndex(
+    $installer->getIdxName('report_compared_product_index', array('product_id')),
+    array('product_id')
+)->addForeignKey(
+    $installer->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'),
+    'customer_id',
+    $installer->getTable('customer_entity'),
+    'entity_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+    $installer->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'),
+    'product_id',
+    $installer->getTable('catalog_product_entity'),
+    'entity_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+    $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'),
+    'store_id',
+    $installer->getTable('store'),
+    'store_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->setComment(
+    'Reports Compared Product Index Table'
+);
+$installer->getConnection()->createTable($table);
+
+/**
+ * Create table 'report_viewed_product_index'
+ * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that
+ * only one record is added when customer/visitor views same product again.
+ */
+$table = $installer->getConnection()->newTable(
+    $installer->getTable('report_viewed_product_index')
+)->addColumn(
+    'index_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
+    null,
+    array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Index Id'
+)->addColumn(
+    'visitor_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true),
+    'Visitor Id'
+)->addColumn(
+    'customer_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true),
+    'Customer Id'
+)->addColumn(
+    'product_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true, 'nullable' => false),
+    'Product Id'
+)->addColumn(
+    'store_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    null,
+    array('unsigned' => true),
+    'Store Id'
+)->addColumn(
+    'added_at',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
+    null,
+    array('nullable' => false),
+    'Added At'
+)->addIndex(
+    $installer->getIdxName(
+        'report_viewed_product_index',
+        array('visitor_id', 'product_id'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
+    array('visitor_id', 'product_id'),
+    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
+)->addIndex(
+    $installer->getIdxName(
+        'report_viewed_product_index',
+        array('customer_id', 'product_id'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
+    array('customer_id', 'product_id'),
+    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
+)->addIndex(
+    $installer->getIdxName('report_viewed_product_index', array('store_id')),
+    array('store_id')
+)->addIndex(
+    $installer->getIdxName('report_viewed_product_index', array('added_at')),
+    array('added_at')
+)->addIndex(
+    $installer->getIdxName('report_viewed_product_index', array('product_id')),
+    array('product_id')
+)->addForeignKey(
+    $installer->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'),
+    'customer_id',
+    $installer->getTable('customer_entity'),
+    'entity_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+    $installer->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'),
+    'product_id',
+    $installer->getTable('catalog_product_entity'),
+    'entity_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+    $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'),
+    'store_id',
+    $installer->getTable('store'),
+    'store_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->setComment(
+    'Reports Viewed Product Index Table'
+);
+$installer->getConnection()->createTable($table);
+
 /**
  * Create table 'report_event_types'
  */
diff --git a/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php b/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php
deleted file mode 100644
index c407e27799b8f550d5e0d87727c1ee605f9a0865..0000000000000000000000000000000000000000
--- a/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/** @var $this \Magento\Framework\Module\Setup */
-
-/**
- * Create table 'report_compared_product_index'.
- * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that
- * only one record is added when customer/visitor compares same product again.
- */
-$table = $this->getConnection()->newTable(
-    $this->getTable('report_compared_product_index')
-)->addColumn(
-    'index_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
-    null,
-    array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Index Id'
-)->addColumn(
-    'visitor_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true),
-    'Visitor Id'
-)->addColumn(
-    'customer_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true),
-    'Customer Id'
-)->addColumn(
-    'product_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true, 'nullable' => false),
-    'Product Id'
-)->addColumn(
-    'store_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-    null,
-    array('unsigned' => true),
-    'Store Id'
-)->addColumn(
-    'added_at',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
-    null,
-    array('nullable' => false),
-    'Added At'
-)->addIndex(
-    $this->getIdxName(
-        'report_compared_product_index',
-        array('visitor_id', 'product_id'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
-    ),
-    array('visitor_id', 'product_id'),
-    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
-)->addIndex(
-    $this->getIdxName(
-        'report_compared_product_index',
-        array('customer_id', 'product_id'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
-    ),
-    array('customer_id', 'product_id'),
-    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
-)->addIndex(
-    $this->getIdxName('report_compared_product_index', array('store_id')),
-    array('store_id')
-)->addIndex(
-    $this->getIdxName('report_compared_product_index', array('added_at')),
-    array('added_at')
-)->addIndex(
-    $this->getIdxName('report_compared_product_index', array('product_id')),
-    array('product_id')
-)->addForeignKey(
-    $this->getFkName('report_compared_product_index', 'customer_id', 'customer_entity', 'entity_id'),
-    'customer_id',
-    $this->getTable('customer_entity'),
-    'entity_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
-    $this->getFkName('report_compared_product_index', 'product_id', 'catalog_product_entity', 'entity_id'),
-    'product_id',
-    $this->getTable('catalog_product_entity'),
-    'entity_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
-    $this->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'),
-    'store_id',
-    $this->getTable('store'),
-    'store_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->setComment(
-    'Reports Compared Product Index Table'
-);
-$this->getConnection()->createTable($table);
-
-/**
- * Create table 'report_viewed_product_index'
- * In MySQL version this table comes with unique keys to implement insertOnDuplicate(), so that
- * only one record is added when customer/visitor views same product again.
- */
-$table = $this->getConnection()->newTable(
-    $this->getTable('report_viewed_product_index')
-)->addColumn(
-    'index_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
-    null,
-    array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Index Id'
-)->addColumn(
-    'visitor_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true),
-    'Visitor Id'
-)->addColumn(
-    'customer_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true),
-    'Customer Id'
-)->addColumn(
-    'product_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true, 'nullable' => false),
-    'Product Id'
-)->addColumn(
-    'store_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-    null,
-    array('unsigned' => true),
-    'Store Id'
-)->addColumn(
-    'added_at',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
-    null,
-    array('nullable' => false),
-    'Added At'
-)->addIndex(
-    $this->getIdxName(
-        'report_viewed_product_index',
-        array('visitor_id', 'product_id'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
-    ),
-    array('visitor_id', 'product_id'),
-    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
-)->addIndex(
-    $this->getIdxName(
-        'report_viewed_product_index',
-        array('customer_id', 'product_id'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
-    ),
-    array('customer_id', 'product_id'),
-    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
-)->addIndex(
-    $this->getIdxName('report_viewed_product_index', array('store_id')),
-    array('store_id')
-)->addIndex(
-    $this->getIdxName('report_viewed_product_index', array('added_at')),
-    array('added_at')
-)->addIndex(
-    $this->getIdxName('report_viewed_product_index', array('product_id')),
-    array('product_id')
-)->addForeignKey(
-    $this->getFkName('report_viewed_product_index', 'customer_id', 'customer_entity', 'entity_id'),
-    'customer_id',
-    $this->getTable('customer_entity'),
-    'entity_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
-    $this->getFkName('report_viewed_product_index', 'product_id', 'catalog_product_entity', 'entity_id'),
-    'product_id',
-    $this->getTable('catalog_product_entity'),
-    'entity_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
-    $this->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'),
-    'store_id',
-    $this->getTable('store'),
-    'store_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->setComment(
-    'Reports Viewed Product Index Table'
-);
-$this->getConnection()->createTable($table);
-
-$installFile = __DIR__ . '/install-1.6.0.0.php';
-
-/** @var \Magento\Framework\Filesystem\Directory\Read $modulesDirectory */
-$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Framework\App\Filesystem::MODULES_DIR);
-if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) {
-    include $installFile;
-}
diff --git a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php
index fd332f1e086d3f6c0ff5389fea008e8b507d533e..7769531278e5305b88eb2521e8d3fa5377633276 100644
--- a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php
+++ b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php
@@ -30,9 +30,9 @@ $installer = $this;
 $installer->startSetup();
 
 $aggregationTables = array(
-    \Magento\Reports\Model\Resource\Report\Product\Viewed::AGGREGATION_DAILY,
-    \Magento\Reports\Model\Resource\Report\Product\Viewed::AGGREGATION_MONTHLY,
-    \Magento\Reports\Model\Resource\Report\Product\Viewed::AGGREGATION_YEARLY
+    'report_viewed_product_aggregated_daily',
+    'report_viewed_product_aggregated_monthly',
+    'report_viewed_product_aggregated_yearly'
 );
 $aggregationTableComments = array(
     'Most Viewed Products Aggregated Daily',
diff --git a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
index 225db2370fcedc352462d3f21775000e9c06af9a..4163424822f73e96024cf949ebe2a2305a6f7966 100644
--- a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
+++ b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php
@@ -30,9 +30,9 @@ $installer = $this;
 $installer->startSetup();
 
 $aggregationTablesToRename = array(
-    'reports_viewed_aggregated_daily' => \Magento\Reports\Model\Resource\Report\Product\Viewed::AGGREGATION_DAILY,
-    'reports_viewed_aggregated_monthly' => \Magento\Reports\Model\Resource\Report\Product\Viewed::AGGREGATION_MONTHLY,
-    'reports_viewed_aggregated_yearly' => \Magento\Reports\Model\Resource\Report\Product\Viewed::AGGREGATION_YEARLY
+    'reports_viewed_aggregated_daily' => 'report_viewed_product_aggregated_daily',
+    'reports_viewed_aggregated_monthly' => 'report_viewed_product_aggregated_monthly',
+    'reports_viewed_aggregated_yearly' => 'report_viewed_product_aggregated_yearly'
 );
 
 foreach ($aggregationTablesToRename as $wrongName => $rightName) {
diff --git a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml
index d1437e27c8cc80b3970b3fd2783a96892be354a3..ba8b9dade9c27d95991bdf0cfe0c67f1744edef2 100644
--- a/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml
+++ b/app/code/Magento/Reports/view/adminhtml/templates/grid.phtml
@@ -77,20 +77,24 @@ $numColumns = sizeof($this->getColumns());
                 <?php echo $this->getRefreshButtonHtml() ?>
             </div>
             <script type="text/javascript">
-                (function ($) {
-                    $("#<?php echo $this->getSuffixId('period_date_range') ?>").dateRange({
-                        dateFormat:"<?php echo $this->getDateFormat() ?>",
-                        buttonImage:"<?php echo $this->getViewFileUrl('images/grid-cal.gif') ?>",
-                        buttonText:"<?php echo __('Select Date') ?>",
-                        from:{
-                            id:"<?php echo $this->getSuffixId('period_date_from')?>"
-                        },
-                        to:{
-                            id:"<?php echo $this->getSuffixId('period_date_to')?>"
-                        }
-                    })
-                })(jQuery)
-            </script>
+require([
+    "jquery",
+    "mage/calendar"
+], function($){
+
+    $("#<?php echo $this->getSuffixId('period_date_range') ?>").dateRange({
+        dateFormat:"<?php echo $this->getDateFormat() ?>",
+        buttonImage:"<?php echo $this->getViewFileUrl('images/grid-cal.gif') ?>",
+        buttonText:"<?php echo __('Select Date') ?>",
+        from:{
+            id:"<?php echo $this->getSuffixId('period_date_from')?>"
+        },
+        to:{
+            id:"<?php echo $this->getSuffixId('period_date_to')?>"
+        }
+    });           
+});
+</script>
         </div>
         <?php endif; ?>
     </div>
@@ -106,6 +110,12 @@ $numColumns = sizeof($this->getColumns());
 </div>
 <?php if ($this->canDisplayContainer()): ?>
     <script type="text/javascript">
+require([
+    "jquery",
+    "mage/mage",
+    "mage/adminhtml/grid"
+], function(jQuery){
+
         jQuery.mage.load('validation');
         //<![CDATA[
             <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
@@ -117,7 +127,7 @@ $numColumns = sizeof($this->getColumns());
         period_date_from.adviceContainer = $('<?php echo $this->getSuffixId('period_date_from_advice')?>');
         period_date_to.adviceContainer = $('<?php echo $this->getSuffixId('period_date_to_advice')?>');
 
-        function validateFilterDate() {
+        validateFilterDate = function() {
             if (period_date_from && period_date_to) {
                 var valid = true;
                 jQuery(period_date_from).add(period_date_to).each(function() {
@@ -132,7 +142,7 @@ $numColumns = sizeof($this->getColumns());
             <?php endif;?>
             <?php if ($this->getStoreSwitcherVisibility()): ?>
         /* Overwrite function from switcher.phtml widget*/
-        function switchStore(obj) {
+        switchStore = function(obj) {
             if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
                 var selectionType = 'website';
             } else if (obj.options[obj.selectedIndex].getAttribute('group') == 'true') {
@@ -157,6 +167,8 @@ $numColumns = sizeof($this->getColumns());
         }
             <?php endif; ?>
         //]]>
-    </script>
+    
+});
+</script>
     <?php endif; ?>
 <?php endif; ?>
diff --git a/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml b/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml
index fb7ee325758a082cd75d490c989e7043205cb33c..04fd8c947ce9f088852ecf5c5601f92695a8e685 100644
--- a/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml
+++ b/app/code/Magento/Reports/view/adminhtml/templates/report/grid/container.phtml
@@ -30,6 +30,12 @@
 <?php echo $this->getGridHtml() ?>
 
 <script type="text/javascript">
+require([
+    'jquery',
+    'mage/backend/validation',
+    "prototype"
+], function(jQuery){
+
 //<![CDATA[
     jQuery('#filter_form').mage('validation', {errorClass: 'mage-error'});
     function filterFormSubmit() {
@@ -39,8 +45,10 @@
             if(filters[i].value && filters[i].value.length && !filters[i].disabled) elements.push(filters[i]);
         }
         if (jQuery('#filter_form').valid()) {
-            setLocation('<?php echo $this->getFilterUrl(); ?>filter/'+encode_base64(Form.serializeElements(elements))+'/');
+            setLocation('<?php echo $this->getFilterUrl(); ?>filter/'+Base64.encode(Form.serializeElements(elements))+'/');
         }
     }
 //]]>
+    window.filterFormSubmit = filterFormSubmit;
+});
 </script>
diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml
index 3c3d2a1f39ffa2cf150a95c15976d05e0d3c4d79..fcbc2e3d7614157ced5e2f897c278f05d0aff29d 100644
--- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml
+++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher.phtml
@@ -57,7 +57,9 @@
     <?php echo $this->getHintHtml() ?>
 </div>
 <script type="text/javascript">
-    function switchStore(obj){
+require(['prototype'], function(){
+
+    switchStore = function(obj){
         if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
             var selectionType = 'website';
         } else if (obj.options[obj.selectedIndex].getAttribute('group') == 'true') {
@@ -71,5 +73,7 @@
         }
         setLocation('<?php echo $this->getSwitchUrl() ?>'+storeParam);
     }
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml
index 7d66cfd112e32398195db59f06e2c551b3b98db3..fbcae5ca1144011d4002df037f78710ff6bafa24 100644
--- a/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml
+++ b/app/code/Magento/Reports/view/adminhtml/templates/store/switcher/enhanced.phtml
@@ -63,12 +63,16 @@
     <?php echo $this->getHintHtml() ?>
 </div>
 <script type="text/javascript">
-    function switchStore(obj){
+require(['prototype'], function(){
+
+    switchStore = function(obj){
         var storeParam = obj.value ? 'store_ids/' + obj.value + '/' : '';
         if(obj.switchParams){
             storeParam+= obj.switchParams;
         }
         setLocation('<?php echo $this->getSwitchUrl() ?>'+storeParam);
     }
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Reports/view/frontend/layout/catalog_category_view_type_layered_without_children.xml b/app/code/Magento/Reports/view/frontend/layout/catalog_category_view_type_layered_without_children.xml
deleted file mode 100644
index fd22a20820262a19fffcfd751dadd1e935e80a79..0000000000000000000000000000000000000000
--- a/app/code/Magento/Reports/view/frontend/layout/catalog_category_view_type_layered_without_children.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-</layout>
diff --git a/app/code/Magento/Reports/view/frontend/templates/js/components.phtml b/app/code/Magento/Reports/view/frontend/templates/js/components.phtml
index d3be23cbc9f6a63f2966ff15a2b69bfcefe9fca9..6f8e3d98836ce2b176e162e1f61d48274f4da62b 100644
--- a/app/code/Magento/Reports/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Reports/view/frontend/templates/js/components.phtml
@@ -22,17 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            recentlyViewedProducts: [
-                '<?php echo $this->getViewFileUrl('Magento_Reports::js/recently-viewed.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
\ No newline at end of file
diff --git a/app/code/Magento/Reports/view/frontend/web/js/recently-viewed.js b/app/code/Magento/Reports/view/frontend/web/js/recently-viewed.js
index d01167d8178a7802f9d2e41d03dcf5421b3cb4b8..74c5a6a116dfbf3c0d3d09571f47f483ca76bc87 100644
--- a/app/code/Magento/Reports/view/frontend/web/js/recently-viewed.js
+++ b/app/code/Magento/Reports/view/frontend/web/js/recently-viewed.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.recentlyViewedProducts', {
         options: {
             localStorageKey: "recently-viewed-products",
@@ -63,4 +67,5 @@
             window.localStorage.setItem(this.options.localStorageKey, JSON.stringify(products));
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..dd412e1c2b51b96b64b5aafc37cb4ceb8d656abc
--- /dev/null
+++ b/app/code/Magento/RequireJs/composer.json
@@ -0,0 +1,20 @@
+{
+    "name": "magento/module-require-js",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/RequireJs"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..e5f26494584d7d189b2afd223925958926aef07b
--- /dev/null
+++ b/app/code/Magento/Review/composer.json
@@ -0,0 +1,28 @@
+{
+    "name": "magento/module-review",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-newsletter": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Review"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php b/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php
index 3616c37a6f06d05ac51e913d3ce5e793e0e47a26..d8a831a16963410a55a76be210eaaabeed7a16cd 100644
--- a/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php
@@ -381,7 +381,11 @@ $table = $installer->getConnection()->newTable(
     array('nullable' => false, 'default' => 1),
     'Rating is active.'
 )->addIndex(
-    $installer->getIdxName('rating', array('rating_code'), \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE),
+    $installer->getIdxName(
+        'rating',
+        array('rating_code'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
     array('rating_code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
diff --git a/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml
deleted file mode 100644
index ca496063907b7d1984df9dc79247a8417155547e..0000000000000000000000000000000000000000
--- a/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-rating-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Review::js/rating.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
-</layout>
diff --git a/app/code/Magento/Review/view/adminhtml/templates/add.phtml b/app/code/Magento/Review/view/adminhtml/templates/add.phtml
index 09c2f4ea890949896ffe77a6c365bc89e34fd9ed..06c42eab26f3aefd63a43c862152a0ec5b7e7f99 100644
--- a/app/code/Magento/Review/view/adminhtml/templates/add.phtml
+++ b/app/code/Magento/Review/view/adminhtml/templates/add.phtml
@@ -33,5 +33,14 @@
     <?php echo $this->getFormHtml() ?>
 </div>
 <script type="text/javascript">
-   jQuery('#edit_form').mage('form').mage('validation');
+require([
+    "jquery",
+    "mage/mage",
+    "mage/backend/form",
+    "mage/backend/validation"
+], function($){
+
+   $('#edit_form').mage('form').mage('validation');
+
+});
 </script>
diff --git a/app/code/Magento/Review/view/adminhtml/templates/rating/detailed.phtml b/app/code/Magento/Review/view/adminhtml/templates/rating/detailed.phtml
index c756681c142f7fd59fed3fe9069186fc181f92c5..f769c201403bee02aabd688e613097214af0ed08 100644
--- a/app/code/Magento/Review/view/adminhtml/templates/rating/detailed.phtml
+++ b/app/code/Magento/Review/view/adminhtml/templates/rating/detailed.phtml
@@ -41,12 +41,17 @@
         <input type="hidden" name="validate_rating" class="validate-rating" value="" />
     </div>
 <script type="text/javascript">
-    (function($) {
-        "use strict";
-        $.mage.extend('validation', 'validation',
-            '<?php echo $this->getViewFileUrl('Magento_Review::rating/validation-rules.js'); ?>');
-        $('[data-widget=ratingControl]').ratingControl();
-    })(jQuery);
+require([
+    "jquery",
+    "mage/mage",
+    "Magento_Review/js/rating"
+], function($){
+    "use strict";
+    
+    $.mage.extend('validation', 'validation', 'Magento_Review/rating/validation-rules');
+    $('[data-widget=ratingControl]').ratingControl();
+
+});
 </script>
 <?php else: ?>
     <?php echo __("Rating isn't Available") ?>
diff --git a/app/code/Magento/Review/view/adminhtml/web/js/rating.js b/app/code/Magento/Review/view/adminhtml/web/js/rating.js
index 243133ad5900de70816138ad6688d92db3fd2e7d..31c45aa9c30e94a199323ed7eabe56f09c3e7368 100644
--- a/app/code/Magento/Review/view/adminhtml/web/js/rating.js
+++ b/app/code/Magento/Review/view/adminhtml/web/js/rating.js
@@ -20,9 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     'use strict';
+    
     $.widget("marketing.ratingControl", {
         options: {
             colorFilled: '#333',
@@ -66,4 +69,5 @@
             checkedInputs.prevAll('label').css('color', this.options.colorUnfilled).data('checked', false);
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Review/view/adminhtml/web/rating/validation-rules.js b/app/code/Magento/Review/view/adminhtml/web/rating/validation-rules.js
index e4fb6ec7312fc81eb9f74712255972ecda0ee229..5d248cc452f7d751422cde2c0c7c6dade8851ea5 100644
--- a/app/code/Magento/Review/view/adminhtml/web/rating/validation-rules.js
+++ b/app/code/Magento/Review/view/adminhtml/web/rating/validation-rules.js
@@ -22,7 +22,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function ($) {
+define([
+    "jquery",
+    "mage/validation"
+], function($){
+
     $.validator.addMethod(
         'validate-rating',
         function () {
@@ -35,4 +39,5 @@
             return noError;
         },
         'Please select one of each ratings above.');
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Review/view/frontend/templates/form.phtml b/app/code/Magento/Review/view/frontend/templates/form.phtml
index 0eb61fb9b498812412b4dbcf51a98d34b67a381e..eabde99834ae08fbfa01af6fce8926fdc27e2288 100644
--- a/app/code/Magento/Review/view/frontend/templates/form.phtml
+++ b/app/code/Magento/Review/view/frontend/templates/form.phtml
@@ -95,18 +95,23 @@
     </div>
 </form>
 <script>
-    (function($) {
-        $('#review-form').mage('validation', {
-            errorPlacement: function (error, element) {
-                if (element.parents('#product-review-table').length) {
-                    $('#product-review-table').siblings(this.errorElement + '.' + this.errorClass).remove();
-                    $('#product-review-table').after(error);
-                } else {
-                    element.after(error);
-                }
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+    $('#review-form').mage('validation', {
+        errorPlacement: function (error, element) {
+            if (element.parents('#product-review-table').length) {
+                $('#product-review-table').siblings(this.errorElement + '.' + this.errorClass).remove();
+                $('#product-review-table').after(error);
+            } else {
+                element.after(error);
             }
-        });
-    })(jQuery);
+        }
+    });
+
+});
 </script>
 <?php else: ?>
     <div class="message info notlogged" id="review-form">
diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4696099c4e77647351141087dc29f2881cb92ef
--- /dev/null
+++ b/app/code/Magento/Rss/composer.json
@@ -0,0 +1,30 @@
+{
+    "name": "magento/module-rss",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-sales-rule": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-review": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-gift-message": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Rss"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..665db8299cecae22e190ec3594a85d266bb721d4
--- /dev/null
+++ b/app/code/Magento/Rule/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-rule",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Rule"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Rule/view/adminhtml/web/rules.js b/app/code/Magento/Rule/view/adminhtml/web/rules.js
index 4b0309b87f73f4d65311a5669e8d890d15ffff0e..3d412266ac342d76495c1f2c891dc2e23a71635f 100644
--- a/app/code/Magento/Rule/view/adminhtml/web/rules.js
+++ b/app/code/Magento/Rule/view/adminhtml/web/rules.js
@@ -20,8 +20,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+require([
+    "jquery",
+    "mage/translate",
+    "prototype"
+], function(jQuery){
+
+window.VarienRulesForm = new Class.create();
 
-var VarienRulesForm = new Class.create();
 VarienRulesForm.prototype = {
     initialize : function(parent, newChildUrl){
         this.parent = $(parent);
@@ -379,3 +385,5 @@ VarienRulesForm.prototype = {
         this.updateElement.value = this.chooserSelectedItems.keys().join(', ');
     }
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index b5c0720cae93d2b37296e3529ee77dc877c60269..aa7f6b062367f91b4aa18a988e559ffb38e79760 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -812,11 +812,8 @@ class Order extends \Magento\Sales\Model\AbstractModel
         if (!$this->_canVoidOrder()) {
             return false;
         }
-        if ($this->canUnhold()) {
-            return false;
-        }
 
-        if (!$this->canReviewPayment() && $this->canFetchPaymentReviewUpdate()) {
+        if (!$this->getPayment()->canReviewPayment() && $this->getPayment()->canFetchTransactionInfo()) {
             return false;
         }
 
diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..6fe30a6d47a5170eb72a6bb46fef97ee94845404
--- /dev/null
+++ b/app/code/Magento/Sales/composer.json
@@ -0,0 +1,39 @@
+{
+    "name": "magento/module-sales",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-sales-rule": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-gift-message": "0.1.0-alpha89",
+        "magento/module-reports": "0.1.0-alpha89",
+        "magento/module-weee": "0.1.0-alpha89",
+        "magento/module-rss": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-email": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Sales"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php b/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
index fee5502d66d796c02957730aabc964219530e044..f8ca4ef8b2011a23f4988957817247d8342d0247 100644
--- a/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
@@ -25,6 +25,11 @@
 /** @var $installer \Magento\Sales\Model\Resource\Setup */
 $installer = $this;
 
+/**
+ * Install eav entity types to the eav/entity_type table
+ */
+$installer->installEntities();
+
 /**
  * Install order statuses from config
  */
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.5-1.6.0.6.php b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php
similarity index 100%
rename from app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.5-1.6.0.6.php
rename to app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php
diff --git a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
index b538fb3848ba8f1760984afb6d3647f06be0793b..7f353ff784e2a901b7ae23c9aa3c566d489aafc8 100644
--- a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
@@ -5589,7 +5589,7 @@ $table = $installer->getConnection()->newTable(
     'order_status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     50,
-    array('nullable' => false, 'default' => ''),
+    array('nullable' => false, 'default' => false),
     'Order Status'
 )->addColumn(
     'orders_count',
@@ -5672,7 +5672,7 @@ $table = $installer->getConnection()->newTable(
     'order_status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     50,
-    array('nullable' => false, 'default' => ''),
+    array('nullable' => false, 'default' => false),
     'Order Status'
 )->addColumn(
     'orders_count',
@@ -5927,7 +5927,7 @@ $table = $installer->getConnection()->newTable(
     'order_status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     50,
-    array('nullable' => false, 'default' => ''),
+    array('nullable' => false, 'default' => false),
     'Order Status'
 )->addColumn(
     'orders_count',
@@ -6657,10 +6657,4 @@ $table = $installer->getConnection()->newTable(
 );
 $installer->getConnection()->createTable($table);
 
-
-/**
- * Install eav entity types to the eav/entity_type table
- */
-$installer->installEntities();
-
 $installer->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
index c6e7b33d5a4780417763aa5a8581b829af7677ff..f070bb0f18e889f5aee1dbc02670dc2ddd28fdf0 100644
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
+++ b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
@@ -25,8 +25,6 @@
 /* @var $installer \Magento\Sales\Model\Resource\Setup */
 $installer = $this;
 
-$installer->installEntities();
-
 $invoiceTable = $installer->getTable('sales_flat_invoice');
 $installer->getConnection()->addColumn(
     $invoiceTable,
diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml
index 00ff767a06242fc9ef41d825bb17ab68b689b058..72367847a3e525ca3bb22563d1dfa63feb1f50a1 100644
--- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml
+++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml
@@ -31,24 +31,9 @@
         </action>
     </referenceBlock>
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-create-scripts-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-js-bootstrap-order-create-index-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_Sales::order/create/scripts.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-create-giftmessage-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Sales::order/create/giftmessage.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-catalog-product-composite-configure-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Catalog::catalog/product/composite/configure.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-giftoptions-tooltip-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Sales::order/giftoptions_tooltip.js</argument>
+                <argument name="file" xsi:type="string">Magento_Sales::js/bootstrap/order-create-index.js</argument>
             </arguments>
         </block>
         <block class="Magento\Backend\Block\Template" name="optional_zip_countries" as="optional_zip_countries" template="Magento_Directory::js/optional_zip_countries.phtml"/>
diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml
index 4ec182abd2bcb742888d5ab4c648e976180c3740..701ed4a52268e6e71917d084acce190ac6af6232 100644
--- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml
+++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml
@@ -25,14 +25,9 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-create-giftmessage-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-js-bootstrap-order-create-index-js">
             <arguments>
-                <argument name="file" xsi:type="string">Magento_Sales::order/create/giftmessage.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-giftoptions-tooltip-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Sales::order/giftoptions_tooltip.js</argument>
+                <argument name="file" xsi:type="string">Magento_Sales::js/bootstrap/order-create-index.js</argument>
             </arguments>
         </block>
     </referenceBlock>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/items/column/name.phtml b/app/code/Magento/Sales/view/adminhtml/templates/items/column/name.phtml
index 9e219850894c88da466a1255590afe2b9b074902..7e0684872902aaf220d803adbef609cf09e67e6b 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/items/column/name.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/items/column/name.phtml
@@ -42,12 +42,16 @@
                 <?php $_option = $this->getFormattedOption($_option['value']); ?>
                 <?php echo $_option['value']; ?><?php if (isset($_option['remainder']) && $_option['remainder']): ?><span id="<?php echo $_dots = 'dots' . uniqid()?>"> ...</span><span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_option['remainder'] ?></span>
                     <script type="text/javascript">
-                    $('<?php echo $_id ?>').hide();
-                    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
-                    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_dots?>').hide();});
-                    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
-                    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_dots ?>').show();});
-                    </script>
+require(['prototype'], function(){
+
+    $('<?php echo $_id ?>').hide();
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
+    $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_dots?>').hide();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_id ?>').hide();});
+    $('<?php echo $_id ?>').up().observe('mouseout',  function(){$('<?php echo $_dots ?>').show();});
+                    
+});
+</script>
                 <?php endif; ?>
             <?php endif; ?>
             </dd>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml
index 0d66a3caa7cdf80729cf9a90c70ebee64b5f4800..b8c1a95a6e6ca73a338db45a8a83a8123cb6c69b 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/comments/view.phtml
@@ -58,12 +58,16 @@
     </ul>
 </div>
 <script type="text/javascript">
-function submitComment() {
+require(['prototype'], function(){
+
+submitComment = function() {
     submitAndReloadArea($('comments_block').parentNode, '<?php echo $this->getSubmitUrl() ?>')
 }
 
 if ($('submit_comment_button')) {
     $('submit_comment_button').observe('click', submitComment);
 }
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml
index f5c767635c6af26c7aef19efff2dce5b49d648a9..c35a1cf69d5f4606d363a2f387a1f64780c7dec9 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml
@@ -46,7 +46,11 @@
     <?php endforeach; ?>
     </dl>
 </div>
-<script type="text/javascript">order.setPaymentMethod('<?php echo $this->getSelectedMethodCode() ?>')</script>
+<script type="text/javascript">
+    require(["Magento_Sales/order/create/form"], function(){
+        order.setPaymentMethod('<?php echo $this->getSelectedMethodCode() ?>')
+    });
+</script>
 <?php else: ?>
     <div><?php echo __('No Payment Methods') ?></div>
 <?php endif; ?>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml
index 349c56f915eb828ce8bcb4492dd976380cb47edd..4ea27672a291a660e12d5f3fc9e57ad96329cd7d 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml
@@ -25,4 +25,8 @@
 <!--<h4 class="icon-head fieldset-legend <?php echo $this->getHeaderCssClass() ?>"><?php echo $this->getHeaderText() ?></h4>-->
 <label for="order-comment"><?php echo __('Order Comments') ?></label><br />
 <textarea style="width:98%; height:8em;" id="order-comment" name="order[comment][customer_note]" rows="2" cols="15"><?php echo $this->getCommentNote() ?></textarea>
-<script type="text/javascript">order.commentFieldsBind('order-comment')</script>
+<script type="text/javascript">
+	require(["Magento_Sales/order/create/form"], function(){
+		order.commentFieldsBind('order-comment')
+	});
+</script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml
index c8e65f0c9dcc93b5cddce5f25ed83cfca8483f55..544ebebe7ae7331070aac05583b50b59659f3186 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml
@@ -38,9 +38,13 @@
             <p><strong><?php echo $this->escapeHtml($this->getCouponCode()) ?></strong> [<a href="#" onclick="order.applyCoupon(''); return false;" title="<?php echo __('Remove Coupon Code') ?>"><?php echo __('Remove') ?></a>]</p>
             <?php endif; ?>
             <script type="text/javascript">
-            order.overlay('shipping-method-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
-            order.overlay('address-shipping-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
-            </script>
+            require(["Magento_Sales/order/create/form"], function(){
+
+                order.overlay('shipping-method-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
+                order.overlay('address-shipping-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
+                        
+            });
+</script>
         </div>
     </fieldset>
 </div>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml
index 911de4f528823850bee0ea985ccba4e4bd23ff25..6d71ee2ef826c299405468a815f23aaabb382a7d 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml
@@ -23,7 +23,11 @@
  */
 ?>
 <div class="page-create-order">
-    <script type="text/javascript">order.setCurrencySymbol('<?php echo $this->getCurrencySymbol($this->getCurrentCurrencyCode()) ?>')</script>
+    <script type="text/javascript">
+    require(["Magento_Sales/order/create/form"], function(){
+        order.setCurrencySymbol('<?php echo $this->getCurrencySymbol($this->getCurrentCurrencyCode()) ?>')
+    });
+</script>
     <?php if($this->getCustomerId()): ?>
     <div class="order-sidebar">
         <div class="store-switcher order-currency">
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml
index 3cce58d518e72485ea03294bd63662834f516135..6682724403385b41f1fdeca364bc737b56b9c21e 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form.phtml
@@ -22,13 +22,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    var order = new AdminOrder(<?php echo $this->getOrderDataJson() ?>);
-    order.setLoadBaseUrl('<?php echo $this->getLoadBlockUrl() ?>');
-    var payment = {};
-    payment.switchMethod = order.switchPaymentMethod.bind(order);
-</script>
-<form id="edit_form" action="<?php echo $this->getSaveUrl() ?>" method="post" enctype="multipart/form-data">
+<form id="edit_form" data-order-config="<?php echo $this->getOrderDataJson() ?>" data-load-base-url="<?php echo $this->getLoadBlockUrl() ?>" action="<?php echo $this->getSaveUrl() ?>" method="post" enctype="multipart/form-data">
     <?php echo $this->getBlockHtml('formkey')?>
     <div id="order-message">
         <?php echo $this->getChildHtml('message') ?>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml
index 042f63a153a0d2dc5bef81f43f6d861c9737b938..f5c317ca5def4dfdda5919b550d08b1135d2e50d 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml
@@ -29,4 +29,8 @@
 <div class="form-inline" id="customer_account_fieds">
     <?php echo $this->getForm()->getHtml() ?>
 </div>
-<script type="text/javascript">order.accountFieldsBind($('customer_account_fieds'))</script>
+<script type="text/javascript">
+	require(["prototype", "Magento_Sales/order/create/form"], function(){
+		order.accountFieldsBind($('customer_account_fieds'));
+	});
+</script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml
index 44a4bf4938290b09589d6ade375dd0d55d686c02..bdfdc4117baffa224c8a76a2a4b8f326506cf5a3 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml
@@ -30,17 +30,23 @@ if($this->getIsShipping()):
     $_addressChoiceContainerId = 'order-shipping_address_choice';
     ?>
     <script type="text/javascript">
-    order.shippingAddressContainer = '<?php echo $_fieldsContainerId ?>';
-    order.setAddresses(<?php echo $this->getAddressCollectionJson() ?>);
-    </script>
+    require(["Magento_Sales/order/create/form"], function(){
+
+        order.shippingAddressContainer = '<?php echo $_fieldsContainerId ?>';
+        order.setAddresses(<?php echo $this->getAddressCollectionJson() ?>);
+        
+    });
+</script>
     <?php
 else:
     $_fieldsContainerId = 'order-billing_address_fields';
     $_addressChoiceContainerId = 'order-billing_address_choice';
     ?>
     <script type="text/javascript">
-    order.billingAddressContainer = '<?php echo $_fieldsContainerId ?>';
-    </script>
+        require(["Magento_Sales/order/create/form"], function(){
+            order.billingAddressContainer = '<?php echo $_fieldsContainerId ?>';
+        });
+</script>
     <?php
 endif; ?>
 
@@ -83,11 +89,14 @@ endif; ?>
     <?php $hideElement = 'address-' . ($this->getIsShipping() ? 'shipping' : 'billing') . '-overlay'; ?>
     <div style="display:none;" id="<?php echo $hideElement ?>" class="overlay"><span><?php echo __('You don\'t need to select a shipping address.') ?></span></div>
     <script type="text/javascript">
-        order.bindAddressFields('<?php echo $_fieldsContainerId ?>');
-        order.bindAddressFields('<?php echo $_addressChoiceContainerId ?>');
-        <?php if($this->getIsShipping() && $this->getIsAsBilling()): ?>
-        order.disableShippingAddress(true);
-        <?php endif; ?>
-    </script>
+        require(["Magento_Sales/order/create/form"], function(){
+                order.bindAddressFields('<?php echo $_fieldsContainerId ?>');
+                order.bindAddressFields('<?php echo $_addressChoiceContainerId ?>');
+                <?php if($this->getIsShipping() && $this->getIsAsBilling()): ?>
+                order.disableShippingAddress(true);
+                <?php endif; ?>
+            
+        });
+</script>
 </fieldset>
 
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml
index 6cde96c059df785a203294d140bd875051282e75..3613592ab86c93c7bd758325ed4745253a8e72aa 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml
@@ -36,7 +36,10 @@
         <?php endif; ?>
     </fieldset>
     <script type="text/javascript">
-        order.giftmessageFieldsBind('order-giftmessage');
-    </script>
+require(['Magento_Sales/order/create/form'], function(){
+
+    order.giftmessageFieldsBind('order-giftmessage');
+});
+</script>
 </div>
 <?php endif; ?>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml
index 528a5d32df9bc5c663fca909f037a50351bef474..1552de2111e37da968d98155e1d28b1e37e01649 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml
@@ -391,11 +391,22 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data');
         <p><?php echo $this->getButtonHtml(__('Update Items and Qty\'s'),'order.itemsUpdate()'); ?></p>
     </div>
     <div class="order-coupons" id="order-coupons"><?php echo $this->getChildHtml();?></div>
-    <script type="text/javascript">order.itemsOnchangeBind()</script>
+    <script type="text/javascript">
+require([
+    'Magento_Sales/order/create/form'
+], function(){
+    order.itemsOnchangeBind()
+});
+</script>
 </div>
 
 <?php if ($this->isGiftMessagesAvailable()) : ?>
 <script type="text/javascript">
+require([
+    "prototype",
+    "Magento_Sales/order/giftoptions_tooltip"
+], function(){
+
 //<![CDATA[
     /**
      * Retrieve gift options tooltip content
@@ -417,9 +428,14 @@ $_weeeHelper = $this->helper('Magento\Weee\Helper\Data');
         });
         return contentLines.join('<br/>');
     }
+
     giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
 
+    window.getGiftOptionsTooltipContent = getGiftOptionsTooltipContent;
+
 //]]>
+
+});
 </script>
 <?php endif; ?>
 <?php endif; ?>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/js.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/js.phtml
index 3161acc318bc639528e03e529f3808cdb1f04462..6c9399fbc5a88ca505072075880ae55f2eb620c0 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/js.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/js.phtml
@@ -23,6 +23,12 @@
  */
  ?>
 <script type="text/javascript">
+require([
+    "prototype",
+    "Magento_Sales/order/create/form",
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+
     order.sidebarHide();
     Event.observe(window, 'load',  function() {
         if (window.productConfigure) {
@@ -34,4 +40,6 @@
             });
         }
     });
+
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml
index 9d51dead98bf6f34d3e2e16a2e11d2d0275891be..8ef5d3d4d4396b67bb223fbe9c7139e5fad55b82 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml
@@ -84,7 +84,11 @@
             </a>
         </div>
     <?php else: ?>
-        <script type="text/javascript">$('order-shipping-method-choose').show();</script>
+        <script type="text/javascript">
+require(['prototype'], function(){
+    $('order-shipping-method-choose').show();
+});
+</script>
     <?php endif; ?>
 <?php elseif($this->getIsRateRequest()): ?>
     <strong><?php echo __('Sorry, no quotes are available for this order.') ?></strong>
@@ -98,6 +102,10 @@
 <?php endif; ?>
 <div style="display:none;" id="shipping-method-overlay" class="overlay"><span><?php echo __('You don\'t need to select a shipping method.') ?></span></div>
 <script type="text/javascript">
-order.overlay('shipping-method-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
-order.overlay('address-shipping-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
+    require(["Magento_Sales/order/create/form"], function(){
+
+        order.overlay('shipping-method-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
+        order.overlay('address-shipping-overlay', <?php if ($this->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>);
+
+    });
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml
index 1e1e2f1a16af83c3042e7f7661efc70283c19e2e..30de4254baa1a9c0ec520a7250419c80039d7750 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml
@@ -41,28 +41,36 @@
     </div>
 </div>
 <script>
-function addSidebarCompositeListType() {
-    productConfigure.addListType('sidebar', {
-        urlFetch: '<?php echo $this->getUrl('sales/order_create/configureProductToAdd') ?>',
-        urlConfirm: '<?php echo $this->getUrl('sales/order_create/addConfigured') ?>'
-    });
-    productConfigure.addListType('sidebar_wishlist', {
-        urlFetch: '<?php echo $this->getUrl('customer/wishlist_product_composite_wishlist/configure') ?>',
-        urlConfirm: '<?php echo $this->getUrl('sales/order_create/addConfigured') ?>'
-    });
-}
+require([
+    "prototype",
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
 
-if (typeof(sidebarListTypeWorkedOn) == 'undefined') {
-    sidebarListTypeWorkedOn = false;
-}
-if (!sidebarListTypeWorkedOn) {
-    if (typeof(productConfigure) == 'undefined') {
-        Event.observe(window, 'load',  function(){
-            setTimeout(addSidebarCompositeListType, 10);
-        })
-    } else {
-        addSidebarCompositeListType();
+    function addSidebarCompositeListType() {
+        productConfigure.addListType('sidebar', {
+            urlFetch: '<?php echo $this->getUrl('sales/order_create/configureProductToAdd') ?>',
+            urlConfirm: '<?php echo $this->getUrl('sales/order_create/addConfigured') ?>'
+        });
+        productConfigure.addListType('sidebar_wishlist', {
+            urlFetch: '<?php echo $this->getUrl('customer/wishlist_product_composite_wishlist/configure') ?>',
+            urlConfirm: '<?php echo $this->getUrl('sales/order_create/addConfigured') ?>'
+        });
     }
-    sidebarListTypeWorkedOn = true;
-}
+
+    if (typeof(sidebarListTypeWorkedOn) == 'undefined') {
+        sidebarListTypeWorkedOn = false;
+    }
+    if (!sidebarListTypeWorkedOn) {
+        if (typeof(productConfigure) == 'undefined') {
+            Event.observe(window, 'load',  function(){
+                setTimeout(addSidebarCompositeListType, 10);
+            })
+        } else {
+            addSidebarCompositeListType();
+        }
+        sidebarListTypeWorkedOn = true;
+    }
+
+    window.addSidebarCompositeListType = addSidebarCompositeListType;
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml
index 0c134cd0a3b305113bcd8c6bd3401fa0e05d0a00..5aeb326bca89cb5aa5249276b7f292fa5f2c7d45 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml
@@ -45,6 +45,8 @@
 </div>
 
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 var sendEmailCheckbox = $('send_confirmation');
 if (sendEmailCheckbox) {
@@ -60,4 +62,9 @@ function notifyCustomerUpdate() {
     notifyCustomerCheckbox.disabled = !sendEmailCheckbox.checked;
 }
 //]]>
+
+window.notifyCustomerUpdate = notifyCustomerUpdate;
+window.sendEmailCheckbox = sendEmailCheckbox;
+
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml
index 904ae9364b731c8cc3ab66f8e510ae63b0bf0213..a9667511fa45e22cd62355105b4a80f4bc3dc4d5 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml
@@ -120,6 +120,8 @@
 </div>
 
 <script type="text/javascript">
+require(['jquery', 'prototype'], function(jQuery){
+
 //<![CDATA[
 var submitButtons = $$('.submit-button');
 var updateButtons = $$('.update-button');
@@ -149,24 +151,27 @@ function checkButtonsRelation() {
     }
 }
 
-function submitCreditMemo() {
+submitCreditMemo = function() {
     if ($('creditmemo_do_offline')) $('creditmemo_do_offline').value=0;
     // Temporary solution will be replaced after refactoring order functionality
     jQuery('#edit_form').triggerHandler('save');
 }
-function submitCreditMemoOffline() {
+
+submitCreditMemoOffline = function() {
     if ($('creditmemo_do_offline')) $('creditmemo_do_offline').value=1;
     // Temporary solution will be replaced after refactoring order functionality
     jQuery('#edit_form').triggerHandler('save');
 }
 
 var sendEmailCheckbox = $('send_email');
+
 if (sendEmailCheckbox) {
     var notifyCustomerCheckbox = $('notify_customer');
     var creditmemoCommentText = $('creditmemo_comment_text');
     Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
     bindSendEmail();
 }
+
 function bindSendEmail()
 {
     if (sendEmailCheckbox.checked == true) {
@@ -178,5 +183,10 @@ function bindSendEmail()
         //creditmemoCommentText.disabled = true;
     }
 }
+
+window.bindSendEmail = bindSendEmail;
+window.checkButtonsRelation = checkButtonsRelation;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/totals/adjustments.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/totals/adjustments.phtml
index 14dcda4f0aeab0b26f5d6a943c1fb27f1708ea00..e8cd80d0f7df048a5c73c10edc2f1d3559c16d7c 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/totals/adjustments.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/totals/adjustments.phtml
@@ -36,38 +36,42 @@
         <td class="label"><?php echo __('Adjustment Fee') ?><div id="adjustment_negative_adv"></div></td>
         <td><input type="text" name="creditmemo[adjustment_negative]" value="<?php echo $_source->getBaseAdjustmentFeeNegative()*1 ?>" class="input-text not-negative-amount" id="adjustment_negative"/>
         <script type="text/javascript">
-            //<![CDATA[
-            Validation.addAllThese([
-                ['not-negative-amount', '<?php echo __('Please enter a positive number in this field.') ?>', function(v) {
-                    if(v.length)
-                        return /^\s*\d+([,.]\d+)*\s*%?\s*$/.test(v);
-                    else
-                        return true;
-                }]
-            ]);
+require(['prototype'], function(jQuery){
 
-            if ($('shipping_amount')) {
-                $('shipping_amount').advaiceContainer = $('shipping_amount_adv');
-                unblockSubmit('shipping_amount');
-            }
-            if ($('adjustment_positive')) {
-                $('adjustment_positive').advaiceContainer = $('adjustment_positive_adv');
-                unblockSubmit('adjustment_positive');
-            }
-            if ($('adjustment_negative')) {
-                $('adjustment_negative').advaiceContainer = $('adjustment_negative_adv');
-                unblockSubmit('adjustment_negative');
-            }
+//<![CDATA[
+Validation.addAllThese([
+    ['not-negative-amount', '<?php echo __('Please enter a positive number in this field.') ?>', function(v) {
+        if(v.length)
+            return /^\s*\d+([,.]\d+)*\s*%?\s*$/.test(v);
+        else
+            return true;
+    }]
+]);
 
-            function unblockSubmit(id) {
-                $(id).observe('focus', function(event) {
-                    if ($$('button[class="scalable update-button disabled"]').size() > 0) {
-                        enableElements('submit-button');
-                    }
-                });
-            }
-            //]]>
-        </script>
+if ($('shipping_amount')) {
+    $('shipping_amount').advaiceContainer = $('shipping_amount_adv');
+    unblockSubmit('shipping_amount');
+}
+if ($('adjustment_positive')) {
+    $('adjustment_positive').advaiceContainer = $('adjustment_positive_adv');
+    unblockSubmit('adjustment_positive');
+}
+if ($('adjustment_negative')) {
+    $('adjustment_negative').advaiceContainer = $('adjustment_negative_adv');
+    unblockSubmit('adjustment_negative');
+}
+
+function unblockSubmit(id) {
+    $(id).observe('focus', function(event) {
+        if ($$('button[class="scalable update-button disabled"]').size() > 0) {
+            enableElements('submit-button');
+        }
+    });
+}
+//]]>
+        
+});
+</script>
         </td>
     </tr>
 
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/form.phtml
index f6077f2c8b50e0b87c1e247300103b8a4f335cae..dfff83897867c475cbbce5acbc659ab4bc78fd8e 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/form.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/form.phtml
@@ -86,6 +86,8 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
     var createShipment = $('invoice_do_shipment');
     if (createShipment) {
@@ -106,5 +108,11 @@
         shipmentElement.disabled = true;
         document.getElementById('tracking').style.display = 'block';
     }
+
+    window.createShipment = createShipment;
+    window.forcedShipmentCreate = forcedShipmentCreate;
+    window.shipmentElement = shipmentElement;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml
index b1b69cd6d94a9dbdd5704f6002fe7a99ac5f93dd..87452d3edeceae2e05d426cd613879816fbccc2c 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml
@@ -129,6 +129,8 @@
 </div>
 
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 var submitButtons = $$('.submit-button');
 var updateButtons = $$('.update-button');
@@ -179,5 +181,10 @@ function bindSendEmail()
         //invoiceCommentText.disabled = true;
     }
 }
+
+window.bindSendEmail = bindSendEmail;
+window.checkButtonsRelation = checkButtonsRelation;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml
index 7b92564e4e224bb071cd1ac3fe5f18b47705449e..fd903d85190d36a7d838c366493ff4c87514225d 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/history.phtml
@@ -74,6 +74,10 @@
     <?php endforeach; ?>
     </ul>
     <script type="text/javascript">
+require(['prototype'], function(){
+
         if($('order_status'))$('order_status').update('<?php echo $this->getOrder()->getStatusLabel() ?>');
-    </script>
+    
+});
+</script>
 </div>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/tab/info.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/tab/info.phtml
index 95d8d7aef6d97bef2f4cbae2e1a0d7d2319eb6ec..c4a61acf991bb854bbc40feea0dd0f00be992d86 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/tab/info.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/tab/info.phtml
@@ -90,6 +90,11 @@
 <?php echo $this->getChildHtml('popup_window');?>
 
 <script type="text/javascript">
+require([
+    "prototype",
+    "Magento_Sales/order/giftoptions_tooltip"
+], function(){
+
 //<![CDATA[
     /**
      * Retrieve gift options tooltip content
@@ -112,5 +117,8 @@
         return contentLines.join('<br/>');
     }
     giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
+    window.getGiftOptionsTooltipContent = getGiftOptionsTooltipContent;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/page/js/components.phtml b/app/code/Magento/Sales/view/adminhtml/templates/page/js/components.phtml
index 2f6fa0258f9d0eb042edf07d511f825f8beb092e..78be4caf02ac82913e1e1461539036123de80ec7 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/page/js/components.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/page/js/components.phtml
@@ -24,17 +24,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            orderEditDialog: [
-                '<?php echo $this->getViewFileUrl('Magento_Sales::order/edit/message.js')?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Sales/view/adminhtml/web/js/bootstrap/order-create-index.js b/app/code/Magento/Sales/view/adminhtml/web/js/bootstrap/order-create-index.js
new file mode 100644
index 0000000000000000000000000000000000000000..4caa6e28aa2307b6dca8b0b92a1171bae0aa316d
--- /dev/null
+++ b/app/code/Magento/Sales/view/adminhtml/web/js/bootstrap/order-create-index.js
@@ -0,0 +1,28 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+require([
+    // From Magento_Sales::sales_order_create_index.xml
+    "Magento_Sales/order/create/giftmessage",
+    "Magento_Sales/order/giftoptions_tooltip"
+]);
\ No newline at end of file
diff --git a/lib/web/js/init.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/form.js
similarity index 63%
rename from lib/web/js/init.js
rename to app/code/Magento/Sales/view/adminhtml/web/order/create/form.js
index 128da6d4eed752ddf2b76ce4d9b332a7681d407c..b833d6459ae78dd662fb36fe5fadff4778788667 100644
--- a/lib/web/js/init.js
+++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/form.js
@@ -21,23 +21,30 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-(function() {
-    var source = [
-        '../../jquery/jquery.js',
-        '../../mage/terms.js',
-        '../../mage/dropdowns.js',
-        '../../jquery/jquery.popups.js',
-        '../../js/mui.js'
-    ];
+define([
+	"jquery",
+    "Magento_Sales/order/create/scripts"
+], function(jQuery){
+	var $el = jQuery('#edit_form'),
+		config,
+		baseUrl,
+        order,
+        payment;
 
-    for (var i=0, len=source.length; i<len; i++) {
-        var script = document.createElement('script');
+    if( !$el.length || !$el.data('order-config') ){
+        return;
+    }
 
-        script.type = 'text/javascript';
-        script.async = false;
-        script.src = source[i];
+    config = $el.data('order-config'),
+    baseUrl = $el.data('load-base-url');
 
-        var s = document.getElementsByTagName('script')[0];
-        s.parentNode.insertBefore(script, s);
-    }
-})();
+    order = new AdminOrder(config);
+    order.setLoadBaseUrl(baseUrl);
+    
+    payment = {
+        switchMethod: order.switchPaymentMethod.bind(order)
+    };
+
+    window.order = order;
+    window.payment = payment;
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js
index 3a9a62af5371bc64a7bc5dbb3ccd157d4a241dc9..cb29797f02bc05408d6f815708dcf45ba9cb07d1 100644
--- a/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js
+++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/giftmessage.js
@@ -20,8 +20,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-var giftMessagesController = {
+/********************* GIFT OPTIONS POPUP ***********************/
+/********************* GIFT OPTIONS SET ***********************/
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "mage/validation",
+    "prototype"
+], function(jQuery){
+
+window.giftMessagesController = {
     toogleRequired: function(source, objects)
     {
         if(!$(source).value.blank()) {
@@ -132,9 +141,9 @@ function findFieldLabel(field) {
     return false;
 }
 
+window.findFieldLabel = findFieldLabel;
 
-/********************* GIFT OPTIONS POPUP ***********************/
-var GiftOptionsPopup = Class.create();
+window.GiftOptionsPopup = Class.create();
 GiftOptionsPopup.prototype = {
     //giftOptionsWindowMask: null,
     giftOptionsWindow: null,
@@ -217,8 +226,8 @@ GiftOptionsPopup.prototype = {
 }
 
 
-/********************* GIFT OPTIONS SET ***********************/
-GiftMessageSet = Class.create();
+window.GiftMessageSet = Class.create();
+
 GiftMessageSet.prototype = {
     destPrefix: 'current_item_giftmessage_',
     sourcePrefix: 'giftmessage_',
@@ -266,3 +275,5 @@ GiftMessageSet.prototype = {
         }
     }
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js
index 5c41a0672a3d5757fcf83c726b5d3cf7694c05e6..79cdae928913e068d280d668b873b83f1088c23a 100644
--- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js
+++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js
@@ -20,7 +20,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var AdminOrder = new Class.create();
+define([
+    "jquery",
+    "mage/translate",
+    "prototype",
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(jQuery){
+
+window.AdminOrder = new Class.create();
+
 AdminOrder.prototype = {
     initialize : function(data){
         if(!data) data = {};
@@ -66,7 +74,7 @@ AdminOrder.prototype = {
                 window.setTimeout(function () {
                     el.remove();
                 }, 10);
-            }
+            };
 
             this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) {
                 proceed();
@@ -76,7 +84,7 @@ AdminOrder.prototype = {
 
             this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) {
                 proceed();
-                if (!$(searchAreaId).visible()) {
+                if ($(searchAreaId) && !$(searchAreaId).visible()) {
                     this.addControlButton(searchButton);
                 }
             });
@@ -1202,7 +1210,7 @@ AdminOrder.prototype = {
     }
 };
 
-var OrderFormArea = Class.create();
+window.OrderFormArea = Class.create();
 OrderFormArea.prototype = {
     _name: null,
     _node: null,
@@ -1210,6 +1218,8 @@ OrderFormArea.prototype = {
     _callbackName: null,
 
     initialize: function(name, node, parent){
+        if(!node)
+            return;
         this._name = name;
         this._parent = parent;
         this._callbackName = node.callback;
@@ -1236,7 +1246,8 @@ OrderFormArea.prototype = {
     }
 };
 
-var ControlButton = Class.create();
+window.ControlButton = Class.create();
+
 ControlButton.prototype = {
     _label: '',
     _node: null,
@@ -1261,3 +1272,5 @@ ControlButton.prototype = {
         Element.insert(element, content);
     }
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/edit/message.js b/app/code/Magento/Sales/view/adminhtml/web/order/edit/message.js
index 4799cb3eeabff8567c2ddec63f59fe0898b444b9..9707ee4c6ae566e4dd392be74c9442a9be019508 100644
--- a/app/code/Magento/Sales/view/adminhtml/web/order/edit/message.js
+++ b/app/code/Magento/Sales/view/adminhtml/web/order/edit/message.js
@@ -22,8 +22,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate"
+], function($){
     "use strict";
 
     $.widget('mage.orderEditDialog', {
@@ -82,4 +85,5 @@
                 });
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/giftoptions_tooltip.js b/app/code/Magento/Sales/view/adminhtml/web/order/giftoptions_tooltip.js
index 6b29efdb635b42cf52422e19aa00ce88b850bd24..50ab852bf0c71478f05d594488a464d1fad8a3e8 100644
--- a/app/code/Magento/Sales/view/adminhtml/web/order/giftoptions_tooltip.js
+++ b/app/code/Magento/Sales/view/adminhtml/web/order/giftoptions_tooltip.js
@@ -20,13 +20,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /**
  * Gift Options Tooltip Model
  * 
  * @author      Magento Core Team <core@magentocommerce.com>
  */
-GiftOptionsTooltip = Class.create();
+define(["prototype"], function(){
+
+
+window.GiftOptionsTooltip = Class.create();
 GiftOptionsTooltip.prototype = {
     _tooltipLines: [],
     _tooltipWindow: null,
@@ -205,4 +207,6 @@ GiftOptionsTooltip.prototype = {
     }
 };
 
-giftOptionsTooltip = new GiftOptionsTooltip();
+window.giftOptionsTooltip = new GiftOptionsTooltip();
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml b/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml
index 22f362d198909ff4dc97838b565305122762934e..ed667450e4ab9f90be303bbdc1567804c3253985 100644
--- a/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml
+++ b/app/code/Magento/Sales/view/frontend/layout/sales_guest_view.xml
@@ -31,10 +31,13 @@
             <argument name="template" xsi:type="string">1column.phtml</argument>
         </action>
     </referenceBlock>
-    <referenceContainer name="content">
-        <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info">
+    <referenceContainer name="page.main.title">
+        <container name="order.actions.container" htmlTag="div" htmlClass="actions-toolbar order-actions-toolbar">
             <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons" cacheable="false"/>
-        </block>
+        </container>
+    </referenceContainer>
+    <referenceContainer name="content">
+        <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"/>
         <block class="Magento\Sales\Block\Order\View" name="sales.order.view" after="sales.order.info" cacheable="false">
             <block class="Magento\Sales\Block\Order\Items" name="order_items" template="order/items.phtml">
                 <block class="Magento\Framework\View\Element\RendererList" name="sales.order.items.renderers" as="renderer.list" />
diff --git a/app/code/Magento/Sales/view/frontend/templates/js/components.phtml b/app/code/Magento/Sales/view/frontend/templates/js/components.phtml
index 1af7e6a078dadc1b740a70325d6f0868d632dd5f..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Sales/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/js/components.phtml
@@ -22,26 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            extraOptions: [
-                '<?php echo $this->getViewFileUrl('Magento_GiftMessage::extra-options.js') ?>'
-            ],
-            giftMessage: [
-                '<?php echo $this->getViewFileUrl('Magento_Sales::gift-message.js') ?>'
-            ],
-            giftOptions: [
-                '<?php echo $this->getViewFileUrl('Magento_GiftMessage::gift-options.js') ?>'
-            ],
-            ordersReturns: [
-                '<?php echo $this->getViewFileUrl('Magento_Sales::orders-returns.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/items.phtml b/app/code/Magento/Sales/view/frontend/templates/order/items.phtml
index 8bab5f6305a1c0fefc14c4044a331dca1e188374..b3e708bf8b8635a21f4a86e16c5542cdb24bf271 100644
--- a/app/code/Magento/Sales/view/frontend/templates/order/items.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/order/items.phtml
@@ -74,6 +74,10 @@
 </div>
 <?php if ($_giftMessage): ?>
     <script type="text/javascript">
-        jQuery('a.action.show').add('a.action.close').mage('giftMessage', {});
-    </script>
+require(['jquery', "mage/mage"], function(jQuery){
+
+    jQuery('a.action.show').add('a.action.close').mage('giftMessage', {});
+    
+});
+</script>
 <?php endif; ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/print.phtml b/app/code/Magento/Sales/view/frontend/templates/order/print.phtml
index 00da52142659f06e46d7bce24b269b6586ec2a67..1d2073d39bae6b97cc7590589647cda9e1bc2e24 100644
--- a/app/code/Magento/Sales/view/frontend/templates/order/print.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/order/print.phtml
@@ -92,4 +92,6 @@
         <?php endforeach; ?>
     </table>
 </div>
-<script type="text/javascript">window.print();</script>
+<script type="text/javascript">
+window.print();
+</script>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml b/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml
index 5dc5c30828f6228d62e3253b0a8fe8863313c498..58cdda0f2c4df7c0669ed2a51a18298b218a790e 100644
--- a/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml
@@ -110,4 +110,6 @@
         </table>
     </div>
 <?php endforeach; ?>
-<script type="text/javascript">window.print();</script>
+<script type="text/javascript">
+window.print();
+</script>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml b/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml
index 7a5813f5a0a0dfe68812efc12370a8063ca68190..d9e7a05e76bc7e58625b303ad440eadaf32700ce 100644
--- a/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml
@@ -107,4 +107,6 @@
     </table>
 </div>
 <?php endforeach; ?>
-<script type="text/javascript">window.print();</script>
+<script type="text/javascript">
+window.print();
+</script>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/print/shipment.phtml b/app/code/Magento/Sales/view/frontend/templates/order/print/shipment.phtml
index bf2db55c1287fc4280e0bdd955cd9e1118955d7d..67091ed4ca39132d597a4e1db157415452267a1c 100644
--- a/app/code/Magento/Sales/view/frontend/templates/order/print/shipment.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/order/print/shipment.phtml
@@ -112,4 +112,6 @@
     </div>
     <?php endforeach; ?>
 <?php endif; ?>
-<script type="text/javascript">window.print();</script>
+<script type="text/javascript">
+window.print();
+</script>
diff --git a/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml b/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml
index 078f89395ea6be9fd683d5fb80bf52e3164e7680..4ca94efa82f9fab79c6fb1775a2f8e18f35fbd8d 100644
--- a/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml
+++ b/app/code/Magento/Sales/view/frontend/templates/reorder/sidebar.phtml
@@ -70,11 +70,15 @@
     </div>
     <?php echo $this->getPagerHtml(); ?>
     <script type="text/javascript">
-        jQuery('#reorder-validate-detail').mage('validation', {
-            errorPlacement: function(error, element) {
-                error.appendTo('#cart-sidebar-reorder-advice-container');
-            }
-        });
-    </script>
+require(["jquery", "mage/mage"], function(jQuery){
+
+jQuery('#reorder-validate-detail').mage('validation', {
+    errorPlacement: function(error, element) {
+        error.appendTo('#cart-sidebar-reorder-advice-container');
+    }
+});
+    
+});
+</script>
 </div>
 <?php endif ?>
diff --git a/app/code/Magento/Sales/view/frontend/web/gift-message.js b/app/code/Magento/Sales/view/frontend/web/gift-message.js
index a18ead47b94cd240245166c7a84367bdb19064a1..e43fc2aa2d9d3250dadea0ef7672ed14d9b30589 100644
--- a/app/code/Magento/Sales/view/frontend/web/gift-message.js
+++ b/app/code/Magento/Sales/view/frontend/web/gift-message.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.giftMessage', {
         options: {
             rowPrefix: '#order-item-row-', // Selector prefix for item's row in the table.
@@ -69,4 +73,5 @@
             event.preventDefault(); // Prevent event propagation and avoid going to the link's href.
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sales/view/frontend/web/orders-returns.js b/app/code/Magento/Sales/view/frontend/web/orders-returns.js
index 6d02b405fdb55ccee60ae2e5042a666059c641c8..d267c6afa49abda4575685cdd230cb16192b2373 100644
--- a/app/code/Magento/Sales/view/frontend/web/orders-returns.js
+++ b/app/code/Magento/Sales/view/frontend/web/orders-returns.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true, jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.ordersReturns', {
         options: {
             zipCode: '#oar-zip', // Search by zip code.
@@ -45,4 +49,5 @@
             $(this.options.emailAddress).toggle(value === 'email');
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..5881306da23dd51f2e5d2afbdf6fcdc4a104b716
--- /dev/null
+++ b/app/code/Magento/SalesRule/composer.json
@@ -0,0 +1,35 @@
+{
+    "name": "magento/module-sales-rule",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-rule": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-reports": "0.1.0-alpha89",
+        "magento/module-catalog-rule": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-cron": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/SalesRule"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php b/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
index 4889500270cf755626284c6f8f490b927ac3ef65..32f2aaad57375fa8db7e9db2efdce380702319ef 100644
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
+++ b/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
@@ -67,12 +67,6 @@ $table = $installer->getConnection()->newTable(
     null,
     array('nullable' => false, 'default' => '0'),
     'Uses Per Customer'
-)->addColumn(
-    'customer_group_ids',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    '64k',
-    array(),
-    'Customer Group Ids'
 )->addColumn(
     'is_active',
     \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
@@ -157,12 +151,6 @@ $table = $installer->getConnection()->newTable(
     null,
     array('nullable' => false, 'default' => '0'),
     'Is Rss'
-)->addColumn(
-    'website_ids',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    4000,
-    array(),
-    'Website Ids'
 )->addColumn(
     'coupon_type',
     \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
@@ -231,7 +219,11 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true),
     'Is Primary'
 )->addIndex(
-    $installer->getIdxName('salesrule_coupon', array('code'), \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE),
+    $installer->getIdxName(
+        'salesrule_coupon',
+        array('code'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
     array('code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
index f74e0dce97eec5553a48314781db884aad5ad522..ee5589dbd91beb382fd20f021f4a53c452aca2d8 100644
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
+++ b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
@@ -117,45 +117,6 @@ $table = $connection->newTable(
 $connection->createTable($table);
 
 
-/**
- * Fill out relation table 'salesrule_website' with website Ids
- */
-$select = $connection->select()->from(
-    array('sr' => $rulesTable),
-    array('sr.rule_id', 'cw.website_id')
-)->join(
-    array('cw' => $websitesTable),
-    $connection->prepareSqlCondition('sr.website_ids', array('finset' => new \Zend_Db_Expr('cw.website_id'))),
-    array()
-);
-$query = $select->insertFromSelect($rulesWebsitesTable, array('rule_id', 'website_id'));
-$connection->query($query);
-
-
-/**
- * Fill out relation table 'salesrule_customer_group' with customer group Ids
- */
-
-$select = $connection->select()->from(
-    array('sr' => $rulesTable),
-    array('sr.rule_id', 'cg.customer_group_id')
-)->join(
-    array('cg' => $customerGroupsTable),
-    $connection->prepareSqlCondition(
-        'sr.customer_group_ids',
-        array('finset' => new \Zend_Db_Expr('cg.customer_group_id'))
-    ),
-    array()
-);
-$query = $select->insertFromSelect($rulesCustomerGroupsTable, array('rule_id', 'customer_group_id'));
-$connection->query($query);
-
-/**
- * Eliminate obsolete columns
- */
-$connection->dropColumn($rulesTable, 'website_ids');
-$connection->dropColumn($rulesTable, 'customer_group_ids');
-
 /**
  * Change default value to "null" for "from" and "to" dates columns
  */
diff --git a/app/code/Magento/SalesRule/view/adminhtml/templates/promo/salesrulejs.phtml b/app/code/Magento/SalesRule/view/adminhtml/templates/promo/salesrulejs.phtml
index 97f03385095e8115c85b844b4957c69bb96f56a5..b5f067cac1741cec965bdbdc232544b25234257f 100644
--- a/app/code/Magento/SalesRule/view/adminhtml/templates/promo/salesrulejs.phtml
+++ b/app/code/Magento/SalesRule/view/adminhtml/templates/promo/salesrulejs.phtml
@@ -23,6 +23,8 @@
  */
 ?>
 <script type="text/javascript">
+require(['jquery', "prototype"], function(jQuery){
+
 //<![CDATA[
 var couponTypeSpecific = '<?php echo \Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC ?>';
 var tmpButtonsActionsStorage = [];
@@ -114,7 +116,15 @@ Ajax.Responders.register({
     }
 });
 
+window.generateCouponCodes = generateCouponCodes;
+window.refreshCouponCodesGrid = refreshCouponCodesGrid;
+window.handleCouponTypeChange = handleCouponTypeChange;
+window.handleCouponsTabContentActivity = handleCouponsTabContentActivity;
+window.disableEnableCouponsTabContent = disableEnableCouponsTabContent;
+
 document.observe("dom:loaded", handleCouponsTabContentActivity);
 document.observe("dom:loaded", handleCouponTypeChange);
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..ce7c55ff29479c6697b054e2175aadba9fe12757
--- /dev/null
+++ b/app/code/Magento/Sendfriend/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-sendfriend",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Sendfriend"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml b/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml
index 911cf5fe89d2005e59621d1276baf038e6cd37b6..87d4fc05de4569faeb52e25144dc4abd45932542 100644
--- a/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml
+++ b/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml
@@ -130,7 +130,11 @@
     </div>
 </form>
 <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
     //<![CDATA[
         jQuery('a[role="back"]').on('click', function() { history.back(); return false; });
     //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..6e53c76cf9ddb3a7ee943b4a288dee28d21e181a
--- /dev/null
+++ b/app/code/Magento/Shipping/composer.json
@@ -0,0 +1,31 @@
+{
+    "name": "magento/module-shipping",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-contact": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "ext-gd": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Shipping"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml
index f9efc8cd20265d1beecb9b352a37dd19f9e23b14..5dec754161d08908a9bf58c229caeaa3ec7deeab 100644
--- a/app/code/Magento/Shipping/etc/module.xml
+++ b/app/code/Magento/Shipping/etc/module.xml
@@ -40,7 +40,6 @@
             <module name="Magento_Contact"/>
             <module name="Magento_Customer"/>
             <module name="Magento_Payment"/>
-            <module name="Magento_Theme"/>
             <module name="Magento_Tax"/>
             <module name="Magento_CatalogInventory"/>
         </depends>
diff --git a/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml
index 270052813bd34ed6bb71340e9055762917d59d04..c6ff5db33ccf08cdd3274cc753d0b21d1eba8b89 100644
--- a/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml
+++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-order-shipment-packaging-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Shipping::order/packaging.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceContainer name="content">
         <block class="Magento\Shipping\Block\Adminhtml\Create" name="sales_shipment_create">
             <block class="Magento\Shipping\Block\Adminhtml\Create\Form" name="form" template="create/form.phtml">
diff --git a/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml
index c61d56ef8b1afafd10817f86cea2d0975d7d0f03..b05e5cdf968739391adb48715cc953b0acb36da6 100644
--- a/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml
+++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-order-shipment-packaging-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Shipping::order/packaging.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceContainer name="content">
         <block class="Magento\Shipping\Block\Adminhtml\View" name="sales_shipment_view">
             <block class="Magento\Shipping\Block\Adminhtml\View\Form" name="form" template="view/form.phtml">
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml
index ec5c791f131f8996201bb375cdfe899fd6703ed0..7e391fa2452dbd22beaf8705d0be22f0c8e4b286 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml
@@ -70,6 +70,8 @@
 </form>
 <?php echo $this->getChildHtml('shipment_packaging') ?>
 <script type="text/javascript">
+require(["jquery", "mage/mage", "prototype"], function(jQuery){
+
 //<![CDATA[
     document.observe("dom:loaded", function() {
         setTimeout(function(){
@@ -99,4 +101,6 @@
 
     jQuery('#edit_form').mage('form').mage('validation');
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/create/items.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/create/items.phtml
index 055d69d0a798dd4f9f752ada0c0bfa96b5ff6f24..61983a27d42f96718aaceeaacd41d83337f1ca00 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/create/items.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/create/items.phtml
@@ -88,6 +88,8 @@
     </div>
 </div>
 <script type="text/javascript">
+require(["jquery", "prototype"], function(jQuery){
+
 //<![CDATA[
 var sendEmailCheckbox = $('send_email');
 if (sendEmailCheckbox) {
@@ -141,5 +143,16 @@ function validQtyItems() {
     });
     return valid;
 }
+
+window.validQtyItems = validQtyItems;
+window.submitShipment = submitShipment;
+window.toggleCreateLabelCheckbox = toggleCreateLabelCheckbox;
+window.bindSendEmail = bindSendEmail;
+
+window.shipmentCommentText = shipmentCommentText;
+window.notifyCustomerCheckbox = notifyCustomerCheckbox;
+window.sendEmailCheckbox = sendEmailCheckbox;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/Tracking/view.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/Tracking/view.phtml
index c7f66e72304a4929f3608f7c3d6ff8d3b758a095..0c278ae1e3f4510983b64472775f506272f15e7c 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/order/Tracking/view.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/Tracking/view.phtml
@@ -67,6 +67,8 @@
 <?php endif; ?>
 </table>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 function selectCarrier(elem) {
     var option = elem.options[elem.selectedIndex];
@@ -78,5 +80,10 @@ function deleteTrackingNumber(url) {
         submitAndReloadArea($('shipment_tracking_info').parentNode, url)
     }
 }
+
+window.selectCarrier = selectCarrier;
+window.deleteTrackingNumber = deleteTrackingNumber;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml
index 2788e002297fb7e9ef02aaa4c3e5af68c05d7dad..7fc30f7668c20e88d202dd7bc875333c4c991e48 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/packed.phtml
@@ -181,6 +181,8 @@
 </div>
 
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
     function showPackedWindow() {
         var window = $('packed_window');
@@ -195,5 +197,9 @@
         $('packed_window').hide();
         $('popup-window-mask').hide();
     }
+    window.hidePackedWindow = hidePackedWindow;
+    window.showPackedWindow = showPackedWindow;
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml
index 1281565c95b8b2409e5ee4660fc95c9b46c6c81f..f3816a044e882851f10b0b2472681116b9fe2b0c 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml
@@ -29,6 +29,8 @@ $sizeSource = $this->getSourceSizeModel()->toOptionArray();
 $girthEnabled = $this->isDisplayGirthValue() && $this->isGirthAllowed() ? 1 : 0;
 ?>
 <script type="text/javascript">
+require(["prototype", "Magento_Shipping/order/packaging"], function(){
+
     //<![CDATA[
     document.observe("dom:loaded", function() {
         packaging = new Packaging(<?php echo $this->getConfigDataJson() ?>);
@@ -39,6 +41,8 @@ $girthEnabled = $this->isDisplayGirthValue() && $this->isGirthAllowed() ? 1 : 0;
         );
     });
     //]]>
+
+});
 </script>
 <div id="packaging_window" class="packaging-window" style="display:none;">
     <div class="popup-window-wrapper">
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml
index cd43be3c70d2ab25f5dbf8baa2852806c66d55f7..b933f92df5ea8780c12ddad0c363c1c1d9109d25 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml
@@ -24,6 +24,8 @@
 ?>
 <?php /** @var $this Magento\Shipping\Block\Adminhtml\Order\Tracking */?>
 <script type="text/javascript">
+require(['prototype'], function(){
+
     //<![CDATA[
     var trackingControl;
     trackingControl = {
@@ -63,8 +65,12 @@
                 elem.valueInput.value = '';
             }
         }
-    }
+    };
+
+    window.trackingControl = trackingControl;
     //]]>
+
+});
 </script>
 <table cellspacing="0" class="data-table" id="tracking_numbers_table">
     <thead>
@@ -96,7 +102,11 @@
     </tbody>
 </table>
 <script type="text/javascript">
+require(['prototype'], function(){
+
     //<![CDATA[
     trackingControl.template = new Template('<tr>' + $('track_row_template').innerHTML.replace(/__index__/g, '#{index}') + '<\/tr>');
     //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
index 6eee67ace5ed7e46d73ec65c1b03126c0e2a0f57..f2b8613d1da9ff16976b04d46e631235130a63e0 100644
--- a/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
+++ b/app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
@@ -76,6 +76,8 @@
             <div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
         <?php echo $this->getChildHtml('shipment_packaging') ?>
         <script type="text/javascript">
+require(['prototype'], function(){
+
         //<![CDATA[
             document.observe("dom:loaded", function() {
                 setTimeout(function(){
@@ -91,7 +93,9 @@
                 }, 500);
             });
         //]]>
-        </script>
+        
+});
+</script>
         </div>
     </div>
 </div>
diff --git a/app/code/Magento/Shipping/view/adminhtml/web/order/packaging.js b/app/code/Magento/Shipping/view/adminhtml/web/order/packaging.js
index 5de971769840e287440a8a7fa691f9cf67fee5a7..5c329b79b486984db76a01420e131f04726ddd41 100644
--- a/app/code/Magento/Shipping/view/adminhtml/web/order/packaging.js
+++ b/app/code/Magento/Shipping/view/adminhtml/web/order/packaging.js
@@ -20,7 +20,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var Packaging = Class.create();
+define(["prototype"], function(){
+
+window.Packaging = Class.create();
 Packaging.prototype = {
     /**
      * Initialize object
@@ -822,3 +824,5 @@ Packaging.prototype = {
     }
 //******************** End Private functions ******************************//
 };
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..8e78eedc06c55f26882cb0541395da2cece4f4eb
--- /dev/null
+++ b/app/code/Magento/Sitemap/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-sitemap",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Sitemap"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..aa8356e9d1a78615a62a53d335a355648456273b
--- /dev/null
+++ b/app/code/Magento/Store/composer.json
@@ -0,0 +1,22 @@
+{
+    "name": "magento/module-store",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Store"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php b/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php
index e75178ebf5c94da786e7e62c86747c68e35d2192..88ae298ff33aec4e212e53607d9feaa265b0bced 100644
--- a/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php
+++ b/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php
@@ -71,7 +71,11 @@ $table = $connection->newTable(
     array('unsigned' => true, 'default' => '0'),
     'Defines Is Website Default'
 )->addIndex(
-    $installer->getIdxName('store_website', array('code'), \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE),
+    $installer->getIdxName(
+        'store_website',
+        array('code'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
     array('code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
diff --git a/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php b/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php
index 0a0ea9addb85aa4f748056bf0f50fe42378024fd..a551d9c582888b9611f5d59a7ef113ad12aaecbc 100644
--- a/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php
+++ b/app/code/Magento/Tax/Block/Adminhtml/Frontend/Region/Updater.php
@@ -55,7 +55,8 @@ class Updater extends \Magento\Backend\Block\System\Config\Form\Field
         $html = parent::_getElementHtml($element);
 
         $js = '<script type="text/javascript">
-               var updater = new RegionUpdater("tax_defaults_country", "none", "tax_defaults_region", %s, "nullify");
+              require(["prototype", "mage/adminhtml/form"], function(){
+               updater = new RegionUpdater("tax_defaults_country", "none", "tax_defaults_region", %s, "nullify");
                if(updater.lastCountryId) {
                    var tmpRegionId = $("tax_defaults_region").value;
                    var tmpCountryId = updater.lastCountryId;
@@ -66,6 +67,7 @@ class Updater extends \Magento\Backend\Block\System\Config\Form\Field
                } else {
                    updater.update();
                }
+                });
                </script>';
 
         $html .= sprintf($js, $this->_directoryHelper->getRegionJson());
diff --git a/app/code/Magento/Tax/Helper/Data.php b/app/code/Magento/Tax/Helper/Data.php
index c87caae9d81af6efb9de5a7100e8b88d71eb16cc..cb42eb2640016c711f9ebf68c6bc4fce68c8b317 100644
--- a/app/code/Magento/Tax/Helper/Data.php
+++ b/app/code/Magento/Tax/Helper/Data.php
@@ -32,6 +32,7 @@ use Magento\Tax\Service\V1\Data\TaxClassKey;
 use Magento\Tax\Service\V1\Data\TaxClassKeyBuilder;
 use Magento\Tax\Service\V1\TaxCalculationServiceInterface;
 use Magento\Customer\Model\Address\Converter as AddressConverter;
+use Magento\Customer\Model\Session as CustomerSession;
 
 /**
  * Catalog data helper
@@ -151,6 +152,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
      */
     protected $addressConverter;
 
+    /**
+     * @var CustomerSession
+     */
+    protected $customerSession;
+
     /**
      * TaxClassKey builder
      *
@@ -174,6 +180,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
      * @param QuoteDetailsItemBuilder $quoteDetailsItemBuilder
      * @param TaxClassKeyBuilder $taxClassKeyBuilder
      * @param TaxCalculationServiceInterface $taxCalculationService
+     * @param CustomerSession $customerSession
      * @param AddressConverter $addressConverter
      */
     public function __construct(
@@ -192,6 +199,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
         QuoteDetailsItemBuilder $quoteDetailsItemBuilder,
         TaxClassKeyBuilder $taxClassKeyBuilder,
         TaxCalculationServiceInterface $taxCalculationService,
+        CustomerSession $customerSession,
         AddressConverter $addressConverter
     ) {
         parent::__construct($context);
@@ -209,6 +217,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
         $this->quoteDetailsItemBuilder = $quoteDetailsItemBuilder;
         $this->taxClassKeyBuilder = $taxClassKeyBuilder;
         $this->taxCalculationService = $taxCalculationService;
+        $this->customerSession = $customerSession;
         $this->addressConverter = $addressConverter;
     }
 
@@ -596,6 +605,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
                     $this->taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID)
                         ->setValue($ctc)->create()
                 )->setItems([$item])
+                ->setCustomerId($this->customerSession->getCustomerId())
                 ->create();
 
             $storeId = null;
diff --git a/app/code/Magento/Tax/Model/Calculation/CalculatorFactory.php b/app/code/Magento/Tax/Model/Calculation/CalculatorFactory.php
index b042d865a8b111aa03cd15a1f2bf14c43d6d0c6a..b5308008a2f859e176cdca25bcfa1ac03ce1c819 100644
--- a/app/code/Magento/Tax/Model/Calculation/CalculatorFactory.php
+++ b/app/code/Magento/Tax/Model/Calculation/CalculatorFactory.php
@@ -103,7 +103,7 @@ class CalculatorFactory
             $calculator->setCustomerTaxClassId($customerTaxClassId);
         }
         if (null != $customerId) {
-            $calculator->setCustomerId($customerTaxClassId);
+            $calculator->setCustomerId($customerId);
         }
         return $calculator;
     }
diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php
index a888602de26d3f67901f0e7f52b4334053332f70..5cdb2c2b52a0e0636bb93e32d295a279b8285684 100644
--- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php
+++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php
@@ -434,6 +434,7 @@ class CommonTaxCollector extends AbstractTotal
                 ->create()
         );
         $this->quoteDetailsBuilder->setItems($itemDataObjects);
+        $this->quoteDetailsBuilder->setCustomerId($address->getCustomerId());
 
         $quoteDetails = $this->quoteDetailsBuilder->create();
         return $quoteDetails;
diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..1e15ed685b8cf3ad271617efde00c8b37078c5f7
--- /dev/null
+++ b/app/code/Magento/Tax/composer.json
@@ -0,0 +1,33 @@
+{
+    "name": "magento/module-tax",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-reports": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-configurable-product": "0.1.0-alpha89",
+        "magento/module-admin-notification": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Tax"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Tax/data/tax_setup/data-install-1.6.0.0.php b/app/code/Magento/Tax/data/tax_setup/data-install-1.6.0.0.php
index ec18360c80b6ccc42508a1ee0097885cb5decfb8..fa59896796de57fad9b07fb0ca61553a686f0749 100644
--- a/app/code/Magento/Tax/data/tax_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Tax/data/tax_setup/data-install-1.6.0.0.php
@@ -23,6 +23,39 @@
  */
 /** @var $installer \Magento\Tax\Model\Resource\Setup */
 $installer = $this;
+
+/**
+ * Add tax_class_id attribute to the 'eav_attribute' table
+ */
+$catalogInstaller = $installer->getCatalogResourceSetup(array('resourceName' => 'catalog_setup'));
+$catalogInstaller->addAttribute(
+    \Magento\Catalog\Model\Product::ENTITY,
+    'tax_class_id',
+    array(
+        'group' => 'Prices',
+        'type' => 'int',
+        'backend' => '',
+        'frontend' => '',
+        'label' => 'Tax Class',
+        'input' => 'select',
+        'class' => '',
+        'source' => 'Magento\Tax\Model\TaxClass\Source\Product',
+        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
+        'visible' => true,
+        'required' => true,
+        'user_defined' => false,
+        'default' => '',
+        'searchable' => true,
+        'filterable' => false,
+        'comparable' => false,
+        'visible_on_front' => false,
+        'visible_in_advanced_search' => true,
+        'used_in_product_listing' => true,
+        'unique' => false,
+        'apply_to' => implode($this->getTaxableItems(), ',')
+    )
+);
+
 /**
  * install tax classes
  */
diff --git a/app/code/Magento/Tax/data/tax_setup/data-upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Tax/data/tax_setup/data-upgrade-1.6.0.0-1.6.0.1.php
new file mode 100644
index 0000000000000000000000000000000000000000..34f36f1e584875b313de70db87ac213c9204473b
--- /dev/null
+++ b/app/code/Magento/Tax/data/tax_setup/data-upgrade-1.6.0.0-1.6.0.1.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+/** @var $installer \Magento\Tax\Model\Resource\Setup */
+$installer = $this;
+
+//New attributes order and properties
+$properties = array('is_required', 'default_value');
+$attributesOrder = array(
+    //Product Details tab
+    'tax_class_id' => array('Product Details' => 40, 'is_required' => 0, 'default_value' => 2),
+);
+
+$entityTypeId = $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
+$attributeSetId = $this->getAttributeSetId($entityTypeId, 'Default');
+
+foreach ($attributesOrder as $key => $value) {
+    $attribute = $installer->getAttribute($entityTypeId, $key);
+    if ($attribute) {
+        foreach ($value as $propertyName => $propertyValue) {
+            if (in_array($propertyName, $properties)) {
+                $installer->updateAttribute($entityTypeId, $attribute['attribute_id'], $propertyName, $propertyValue);
+            } else {
+                $installer->addAttributeToGroup(
+                    $entityTypeId,
+                    $attributeSetId,
+                    $propertyName,
+                    $attribute['attribute_id'],
+                    $propertyValue
+                );
+            }
+        }
+    }
+}
diff --git a/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php b/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php
index 446d00f7ac5556bc1dac827f51c7af5b8121c79b..2a533edbc3fd66527e4ead4c1e5cc50e1fd19d31 100644
--- a/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php
@@ -46,7 +46,7 @@ $table = $installer->getConnection()->newTable(
     'class_type',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     8,
-    array('nullable' => false, 'default' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER),
+    array('nullable' => false, 'default' => 'CUSTOMER'),
     'Class Type'
 )->setComment(
     'Tax Class'
@@ -397,36 +397,4 @@ $table = $installer->getConnection()->newTable(
 );
 $installer->getConnection()->createTable($table);
 
-/**
- * Add tax_class_id attribute to the 'eav_attribute' table
- */
-$catalogInstaller = $installer->getCatalogResourceSetup(array('resourceName' => 'catalog_setup'));
-$catalogInstaller->addAttribute(
-    \Magento\Catalog\Model\Product::ENTITY,
-    'tax_class_id',
-    array(
-        'group' => 'Prices',
-        'type' => 'int',
-        'backend' => '',
-        'frontend' => '',
-        'label' => 'Tax Class',
-        'input' => 'select',
-        'class' => '',
-        'source' => 'Magento\Tax\Model\TaxClass\Source\Product',
-        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
-        'visible' => true,
-        'required' => true,
-        'user_defined' => false,
-        'default' => '',
-        'searchable' => false,
-        'filterable' => false,
-        'comparable' => false,
-        'visible_on_front' => false,
-        'visible_in_advanced_search' => false,
-        'used_in_product_listing' => true,
-        'unique' => false,
-        'apply_to' => implode($this->getTaxableItems(), ',')
-    )
-);
-
 $installer->endSetup();
diff --git a/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_edit.xml b/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_edit.xml
index ae5a7867956e39c4a295d451fbc6ddb2fa7f7c5e..d871569d3e2ef6be37f14ec49140a2611c598ede 100644
--- a/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_edit.xml
+++ b/app/code/Magento/Tax/view/adminhtml/layout/tax_rule_edit.xml
@@ -25,19 +25,9 @@
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
     <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-editablemultiselect-js-jquery-editable-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-tax-js-bootstrap-js">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/editableMultiselect/js/jquery.editable.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-editablemultiselect-js-jquery-multiselect-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/editableMultiselect/js/jquery.multiselect.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-backend-editablemultiselect-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/backend/editablemultiselect.js</argument>
+                <argument name="file" xsi:type="string">Magento_Tax::js/bootstrap.js</argument>
             </arguments>
         </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="jquery-editablemultiselect-css-jquery-multiselect-css">
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/class/page/edit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/class/page/edit.phtml
index 7cb7d6aec4898653a1e755246fbef6159afa3fc7..a7462cd5abf11f1d31f93e7c70503047c837af25 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/class/page/edit.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/class/page/edit.phtml
@@ -30,5 +30,9 @@
 </div>
 <?php echo $this->getRenameFormHtml(); ?>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#<?php echo $this->getRenameFormId() ?>').mage('form').mage('validation');
+
+});
 </script>
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/importExport.phtml b/app/code/Magento/Tax/view/adminhtml/templates/importExport.phtml
index 4055cfc0ff1940cd826dbac8b9f0494058e2e5a3..dc2533e43365a1c2b23fc9dd383d54eabdf6d449 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/importExport.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/importExport.phtml
@@ -38,19 +38,23 @@
         </form>
         <?php endif; ?>
         <script type="text/javascript">
-            jQuery('#import-form').mage('form').mage('validation');
-            (function ($) {
-                $('.import-submit').click(function(){
-                    if($(':input[name="import_rates_file"]').val()) {
-                        $('body').loadingPopup({
-                            timeout: false
-                        });
+require(['jquery', "mage/mage", "js/theme"], function(jQuery){
 
-                        $(this.form).submit();
-                    }
+    jQuery('#import-form').mage('form').mage('validation');
+    (function ($) {
+        $('.import-submit').click(function(){
+            if($(':input[name="import_rates_file"]').val()) {
+                $('body').loadingPopup({
+                    timeout: false
                 });
-            })(jQuery);
-        </script>
+
+                $(this.form).submit();
+            }
+        });
+    })(jQuery);
+        
+});
+</script>
     </div>
     <?php endif; ?>
     <div class="export-tax-rates <?php if ($this->getIsReadonly()): ?>box-left<?php else: ?>box-right<?php endif; ?>">
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml
index 8f6ac0d4991e3bba28c92c020688bf469126b892..d272155d5d6f4df91f88ab441842d70185d44dc4 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml
@@ -23,6 +23,11 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    "jquery",
+    "mage/adminhtml/form"
+], function(jQuery){
+
     var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?php echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, 'disable');
     (function ($) {
         $(document).ready(function () {
@@ -60,4 +65,7 @@
             zipIsRange.trigger('change');
         });
     })(jQuery);
+
+    window.updater = updater;
+});
 </script>
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml
index f94c78464f1bd873375b556bebc7346d55c48f54..f8a80255468ef1bfcf7c02b2a71d1ef12746efeb 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml
@@ -25,7 +25,13 @@
 /** @var $this \Magento\Tax\Block\Adminhtml\Rule\Edit\Form */
 ?>
 <script type="text/javascript">
-(function ($) {
+require([
+    "jquery",
+    "jquery/ui",
+    "jquery/editableMultiselect/js/jquery.multiselect",
+    "mage/mage"
+], function($){
+
     $.widget("adminhtml.dialogRates", $.ui.dialog, {
         options: {
             itemRate: {},
@@ -254,5 +260,7 @@
             });
         }
     };
-})(jQuery);
+
+    window.TaxRateEditableMultiselect = TaxRateEditableMultiselect;
+});
 </script>
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml b/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml
index eb9213bc5c4bc5dcd6e5cc11a58d076dc7a4e1e6..4b3023448d59fcd6140d3d6a136b9cf726857d1f 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/rule/rate/form.phtml
@@ -29,5 +29,8 @@
 </div>
 
 <script type="text/javascript">
+
+
     var taxRateCollection = <?php echo json_encode($this->getRateCollection());?>;
+
 </script>
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml
index 4cf4ae13e391d3b117de21d2bda6b907c0f40711..9b3da8e20384b14ad67ec895fa84b98f711be86e 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/class/save.phtml
@@ -30,6 +30,10 @@
 <?php if ($form): ?>
 <?php echo $form->toHtml(); ?>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#<?php echo $form->getForm()->getId() ?>').mage('form').mage('validation');
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml
index 5c259c0f9c2970bc005e04789afc335f5d825c89..3c442e3dd8b1b5a7451c3671d6405316d3130964 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rate/save.phtml
@@ -26,35 +26,40 @@
 <?php echo $form->toHtml();?>
 
 <script type="text/javascript">
-    jQuery('#<?php echo $form->getForm()->getId() ?>').mage('form').mage('validation');
+require([
+    "jquery",
+    "mage/mage"
+], function($){
 
-    (function ($) {
-        $(document).ready(function () {
-            'use strict';
+    $('#<?php echo $form->getForm()->getId() ?>').mage('form').mage('validation');
 
-            $('.field-zip_from').addClass('ignore-validate');
-            $('.field-zip_to').addClass('ignore-validate');
+    $(document).ready(function () {
+        'use strict';
 
-            $('#zip_is_range').on('change.zipRange', function(){
+        $('.field-zip_from').addClass('ignore-validate');
+        $('.field-zip_to').addClass('ignore-validate');
 
-                var elem = $(this),
-                    zipFrom =$('.field-zip_from'),
-                    zipTo =$('.field-zip_to'),
-                    zipCode =$('.field-tax_postcode');
+        $('#zip_is_range').on('change.zipRange', function(){
 
-                if (elem.is(':checked')) {
-                    zipCode.addClass('hidden').addClass('ignore-validate');
-                    zipFrom.removeClass('hidden').removeClass('ignore-validate');
-                    zipTo.removeClass('hidden').removeClass('ignore-validate');
+            var elem = $(this),
+                zipFrom =$('.field-zip_from'),
+                zipTo =$('.field-zip_to'),
+                zipCode =$('.field-tax_postcode');
 
-                } else {
-                    zipCode.removeClass('hidden').removeClass('ignore-validate');
-                    zipFrom.addClass('hidden').addClass('ignore-validate');
-                    zipTo.addClass('hidden').addClass('ignore-validate');
-                }
+            if (elem.is(':checked')) {
+                zipCode.addClass('hidden').addClass('ignore-validate');
+                zipFrom.removeClass('hidden').removeClass('ignore-validate');
+                zipTo.removeClass('hidden').removeClass('ignore-validate');
+
+            } else {
+                zipCode.removeClass('hidden').removeClass('ignore-validate');
+                zipFrom.addClass('hidden').addClass('ignore-validate');
+                zipTo.addClass('hidden').addClass('ignore-validate');
+            }
 
-            });
         });
-    })(jQuery);
+    });
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml
index 8b2f7ddbc81037950f76aee3b4bfc21fd3fedb26..0d62074daeaf7e77d3b5d64888d840cba2f20262 100644
--- a/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml
+++ b/app/code/Magento/Tax/view/adminhtml/templates/toolbar/rule/save.phtml
@@ -31,6 +31,10 @@
 <?php if ($form): ?>
 <?php echo $form->toHtml(); ?>
 <script type="text/javascript">
+require(['jquery', "mage/mage"], function(jQuery){
+
     jQuery('#<?php echo $form->getForm()->getId() ?>').mage('form').mage('validation');
+
+});
 </script>
 <?php endif; ?>
diff --git a/app/code/Magento/Tax/view/adminhtml/web/js/bootstrap.js b/app/code/Magento/Tax/view/adminhtml/web/js/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..26edf5104aefb35f7a271d48b7249acf2f3230b8
--- /dev/null
+++ b/app/code/Magento/Tax/view/adminhtml/web/js/bootstrap.js
@@ -0,0 +1,25 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+require([
+    'mage/backend/editablemultiselect'
+]);
\ No newline at end of file
diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..3fbcd123752d4d35ad565b445c7b87f520d4dab9
--- /dev/null
+++ b/app/code/Magento/Theme/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-theme",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-translation": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Theme"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml
index 91ca5d976698850f50c0088ea5f025e22ebbb400..30343ee1111366a587d192eec0fb115e634f8f12 100644
--- a/app/code/Magento/Theme/etc/config.xml
+++ b/app/code/Magento/Theme/etc/config.xml
@@ -44,7 +44,6 @@ Disallow: /*.js$
 Disallow: /*.css$
 Disallow: /checkout/
 Disallow: /app/
-Disallow: /downloader/
 Disallow: /js/
 Disallow: /lib/
 Disallow: /*.php$
diff --git a/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_edit.xml b/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_edit.xml
index cb5f18c0b5321aafd188538be036b4f36ef2167c..35616ec217ea3d56fe5589ec85429f520cb1eef1 100644
--- a/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_edit.xml
+++ b/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_theme_edit.xml
@@ -36,56 +36,6 @@
                 <argument name="file" xsi:type="string">jquery/fileUploader/css/jquery.fileupload-ui.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-iframe-transport-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.iframe-transport.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-load-image-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/load-image.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-canvas-to-blob-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/canvas-to-blob.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-fp-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-fp.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-theme-js-custom-js-list-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Theme::js/custom-js-list.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-browser-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/adminhtml/browser.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-fileuploader-jquery-fileupload-ui-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/fileUploader/jquery.fileupload-ui.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-theme-js-form-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Theme::js/form.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-theme-js-sortable-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Theme::js/sortable.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-theme-css-theme-css">
             <arguments>
                 <argument name="file" xsi:type="string">Magento_Theme::css/theme.css</argument>
@@ -101,6 +51,11 @@
                 <argument name="file" xsi:type="string">Magento_Core::prototype/magento.css</argument>
             </arguments>
         </block>
+        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-theme-js-bootstrap-js">
+            <arguments>
+                <argument name="file" xsi:type="string">Magento_Theme::js/bootstrap.js</argument>
+            </arguments>
+        </block>
     </referenceBlock>
     <referenceContainer name="content">
         <block class="Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit" name="theme_edit"/>
diff --git a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml
index d3aeaf2555e831fa0b38d315b2e82a3dddc17461..d8b1aaa774e41b521dcf7e86400d241b29a9d6a2 100644
--- a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml
+++ b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml
@@ -45,8 +45,9 @@
 </div>
 
 <script type="text/javascript">
+require(['jquery', "jquery/file-uploader"], function($){
+
 //<![CDATA[
-(function($) {
     $(function () {
         $('#fileupload').fileupload({
             dataType: 'json',
@@ -93,6 +94,7 @@
             }
         });
     });
-})(jQuery);
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Theme/view/adminhtml/templates/tabs/css.phtml b/app/code/Magento/Theme/view/adminhtml/templates/tabs/css.phtml
index 27cd80bedc54abf78ccd312b2ccb714cbd66e7d6..c8e3f3718d748acc56c2199ee3b9615010e7a904 100644
--- a/app/code/Magento/Theme/view/adminhtml/templates/tabs/css.phtml
+++ b/app/code/Magento/Theme/view/adminhtml/templates/tabs/css.phtml
@@ -28,64 +28,68 @@
 <?php echo $this->getFormHtml(); ?>
 
 <script type="text/javascript">
-    (function ($) {
+require([
+    "jquery",
+    "jquery/file-uploader",
+    "mage/translate"
+], function($){
 
-        $( '#css_file_uploader' ).fileupload({
-            dataType: 'json',
-            replaceFileInput: false,
-            url : '<?php echo $this->getUrl('*/system_design_theme/uploadcss') ?>',
-            acceptFileTypes: /(.|\/)(css)$/i,
+    $( '#css_file_uploader' ).fileupload({
+        dataType: 'json',
+        replaceFileInput: false,
+        url : '<?php echo $this->getUrl('*/system_design_theme/uploadcss') ?>',
+        acceptFileTypes: /(.|\/)(css)$/i,
 
-            /**
-             * Add data
-             * @param e
-             * @param data
-             */
-            add: function (e, data) {
-                var uploadButton = $('#css_uploader_button');
-                /** Unbind click event on file change */
-                uploadButton.unbind('click');
-                uploadButton.removeAttr('disabled');
+        /**
+         * Add data
+         * @param e
+         * @param data
+         */
+        add: function (e, data) {
+            var uploadButton = $('#css_uploader_button');
+            /** Unbind click event on file change */
+            uploadButton.unbind('click');
+            uploadButton.removeAttr('disabled');
 
-                uploadButton.click(function () {
-                    $('#messages').html('');
-                    $(this).attr('disabled', 'disabled');
-                    data.submit();
-                });
-            },
+            uploadButton.click(function () {
+                $('#messages').html('');
+                $(this).attr('disabled', 'disabled');
+                data.submit();
+            });
+        },
 
-            /**
-             * On done event
-             * @param e
-             * @param data
-             */
-            done: function (e, data) {
-                var contentArea = $('#custom_css_content');
-                $(this).val('');
+        /**
+         * On done event
+         * @param e
+         * @param data
+         */
+        done: function (e, data) {
+            var contentArea = $('#custom_css_content');
+            $(this).val('');
 
-                $('#css_uploader_button').attr('disabled', 'disabled');
+            $('#css_uploader_button').attr('disabled', 'disabled');
 
-                if (!data.result.error) {
-                    contentArea.trigger('focusin');
-                    contentArea.val(data.result.content);
-                    contentArea.trigger('focusout');
-                }
-            },
-
-            /**
-             * Fail event
-             * @param e
-             * @param data
-             */
-            fail: function(e, data) {
-                $(this).val('');
-                alert($.mage.__("We don't recognize this file extension."));
+            if (!data.result.error) {
+                contentArea.trigger('focusin');
+                contentArea.val(data.result.content);
+                contentArea.trigger('focusout');
             }
-        });
+        },
+
+        /**
+         * Fail event
+         * @param e
+         * @param data
+         */
+        fail: function(e, data) {
+            $(this).val('');
+            alert($.mage.__("We don't recognize this file extension."));
+        }
+    });
 
-        $(document).on('beforeSubmit', function() {
-            $('#css_file_uploader').val('');
-        });
+    $(document).on('beforeSubmit', function() {
+        $('#css_file_uploader').val('');
+    });
 
-    })(jQuery);
+});
 </script>
diff --git a/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml b/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml
index 4ec07c68bbdfe2f65b2783608e5161516d620f83..63e9d21c91de6d4b2535db11f693ba18cdc48d43 100644
--- a/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml
+++ b/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml
@@ -57,6 +57,12 @@
 <ul id="js-files-container" class="js-files-container ui-sortable" ></ul>
 
 <script type="text/javascript">
+require([
+    "jquery",
+    "jquery/ui",
+    "Magento_Theme/js/custom-js-list"
+], function(jQuery){
+
 jQuery(function($) {
     $('.ui-sortable').sortable();
     $('.ui-sortable').disableSelection();
@@ -71,4 +77,6 @@ jQuery(function($) {
         {jsList: <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getJsFiles()) ?>}
     );
 });
+
+});
 </script>
diff --git a/app/code/Magento/Theme/view/adminhtml/templates/tabs/js.phtml b/app/code/Magento/Theme/view/adminhtml/templates/tabs/js.phtml
index 63b38b41ebd2c2ab095d4d38225515792aa171ce..8527775b859bf986c3c239e2f37d1b2576d18baa 100644
--- a/app/code/Magento/Theme/view/adminhtml/templates/tabs/js.phtml
+++ b/app/code/Magento/Theme/view/adminhtml/templates/tabs/js.phtml
@@ -26,103 +26,108 @@
 <?php echo $this->getFormHtml(); ?>
 
 <script type="text/javascript">
-    (function ($) {
-
-        $('#js_files_uploader').fileupload({
-            dataType: 'json',
-            replaceFileInput: false,
-            sequentialUploads: true,
-            url : '<?php echo $this->getJsUploadUrl(); ?>',
-
-            /**
-             * Add data
-             * @param e
-             * @param data
-             */
-            add: function (e, data) {
-                $.each(data.files, function (index, file) {
-                    data.fileId =  Math.random().toString(36).substr(2,9);
-                    var progressTmpl = $('#js-file-uploader-template').children(':first').clone();
-                    progressTmpl.attr('id', data.fileId);
-                    var fileSize = typeof(file.size) == "undefined"
-                        ? $.mage.__('We cannot detect a size.')
-                        : byteConvert(file.size);
-                    var fileInfoHtml = progressTmpl.html().replace('{{size}}', fileSize)
-                        .replace('{{name}}', file.name);
-                    progressTmpl.html(fileInfoHtml) ;
-                    progressTmpl.appendTo('#js-file-uploader');
-                });
-
-                var uploadButton = $('#js_uploader_button');
-                uploadButton.removeAttr('disabled');
-
-                uploadButton.click(function () {
-                    $('#messages').html('');
-                    $(this).attr('disabled', 'disabled');
-
-                    data.submit();
-                });
-            },
-
-            /**
-             * On done event
-             * @param e
-             * @param data
-             */
+require([
+    "jquery",
+    "jquery/file-uploader",
+    "mage/translate"
+], function($){
+
+    $('#js_files_uploader').fileupload({
+        dataType: 'json',
+        replaceFileInput: false,
+        sequentialUploads: true,
+        url : '<?php echo $this->getJsUploadUrl(); ?>',
+
+        /**
+         * Add data
+         * @param e
+         * @param data
+         */
+        add: function (e, data) {
+            $.each(data.files, function (index, file) {
+                data.fileId =  Math.random().toString(36).substr(2,9);
+                var progressTmpl = $('#js-file-uploader-template').children(':first').clone();
+                progressTmpl.attr('id', data.fileId);
+                var fileSize = typeof(file.size) == "undefined"
+                    ? $.mage.__('We cannot detect a size.')
+                    : byteConvert(file.size);
+                var fileInfoHtml = progressTmpl.html().replace('{{size}}', fileSize)
+                    .replace('{{name}}', file.name);
+                progressTmpl.html(fileInfoHtml) ;
+                progressTmpl.appendTo('#js-file-uploader');
+            });
+
+            var uploadButton = $('#js_uploader_button');
+            uploadButton.removeAttr('disabled');
+
+            uploadButton.click(function () {
+                $('#messages').html('');
+                $(this).attr('disabled', 'disabled');
+
+                data.submit();
+            });
+        },
+
+        /**
+         * On done event
+         * @param e
+         * @param data
+         */
         done: function (e, data) {
-                $('#no-js-files-found').remove();
+            $('#no-js-files-found').remove();
 
-                var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
-                $(progressSelector).css('width','100%');
+            var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+            $(progressSelector).css('width','100%');
 
-                $(this).val('');
+            $(this).val('');
 
-                if (!data.result.error) {
-                    $(progressSelector).removeClass('upload-progress').addClass('upload-success');
+            if (!data.result.error) {
+                $(progressSelector).removeClass('upload-progress').addClass('upload-success');
 
-                    $('#' + data.fileId).delay(2000).fadeOut(2000);
-                    $('body').trigger('refreshJsList', {jsList : data.result.files});
-                } else {
-                    $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
-                    /** fix for ie 8 to display error message if file wasn't uploaded */
-                    if ($.browser.msie && $.browser.version == '8.0') {
-                        alert(data.result.message);
-                    }
-                }
-
-                $('.ui-sortable').sortable('initButtons');
-            },
-
-            /**
-             * On progress
-             * @param e
-             * @param data
-             */
-            progress: function(e, data) {
-                var progress = parseInt(data.loaded / data.total * 100, 10);
-                var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
-                $(progressSelector).css('width', progress + '%');
-            },
-
-            /**
-             * Fail event
-             * @param e
-             * @param data
-             */
-            fail: function(e, data) {
-                var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+                $('#' + data.fileId).delay(2000).fadeOut(2000);
+                $('body').trigger('refreshJsList', {jsList : data.result.files});
+            } else {
                 $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
-
-                $(this).val('');
-                alert($.mage.__("We don't recognize this file extension."));
+                /** fix for ie 8 to display error message if file wasn't uploaded */
+                if ($.browser.msie && $.browser.version == '8.0') {
+                    alert(data.result.message);
+                }
             }
-        });
-
-        $('#js_files_uploader').click(function () {
-            /** Unbind click event on file change */
-            $('#js-file-uploader').html('');
-            $('#js_uploader_button').unbind('click');
-        });
 
-    })(jQuery);
+            $('.ui-sortable').sortable('initButtons');
+        },
+
+        /**
+         * On progress
+         * @param e
+         * @param data
+         */
+        progress: function(e, data) {
+            var progress = parseInt(data.loaded / data.total * 100, 10);
+            var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+            $(progressSelector).css('width', progress + '%');
+        },
+
+        /**
+         * Fail event
+         * @param e
+         * @param data
+         */
+        fail: function(e, data) {
+            var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
+            $(progressSelector).removeClass('upload-progress').addClass('upload-failure');
+
+            $(this).val('');
+            alert($.mage.__("We don't recognize this file extension."));
+        }
+    });
+
+    $('#js_files_uploader').click(function () {
+        /** Unbind click event on file change */
+        $('#js-file-uploader').html('');
+        $('#js_uploader_button').unbind('click');
+    });
+
+
+});
 </script>
diff --git a/app/code/Magento/Theme/view/adminhtml/web/js/bootstrap.js b/app/code/Magento/Theme/view/adminhtml/web/js/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..82ba24f40ed1f3b9b84cbaa966254a4961e4bb1c
--- /dev/null
+++ b/app/code/Magento/Theme/view/adminhtml/web/js/bootstrap.js
@@ -0,0 +1,29 @@
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+require([
+    "jquery/file-uploader",
+    "mage/adminhtml/browser",
+    "Magento_Theme/js/form",
+    "Magento_Theme/js/sortable"
+]);
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/adminhtml/web/js/custom-js-list.js b/app/code/Magento/Theme/view/adminhtml/web/js/custom-js-list.js
index 4f8a974ef38f8903beb6b31435a72d9b3ca9e4c0..5c323a3fd3f70598a5966e3b23b491f3d232e00e 100644
--- a/app/code/Magento/Theme/view/adminhtml/web/js/custom-js-list.js
+++ b/app/code/Magento/Theme/view/adminhtml/web/js/custom-js-list.js
@@ -21,8 +21,14 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+
     'use strict';
+
     $.widget('theme.themeJsList', {
         options : {
             templateId : null,
@@ -108,4 +114,5 @@
         }
     });
 
-})(window.jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/adminhtml/web/js/form.js b/app/code/Magento/Theme/view/adminhtml/web/js/form.js
index cd0fdee572c4376b1924053be58454def40e5a45..e1c1e5365f1ff56aa22f74a099fa8d2b64c875a7 100644
--- a/app/code/Magento/Theme/view/adminhtml/web/js/form.js
+++ b/app/code/Magento/Theme/view/adminhtml/web/js/form.js
@@ -20,6 +20,8 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define(["prototype"], function(){
+
 function parentThemeOnChange(selected, defaultsById) {
     var statusBar = $$('.tab-item-link')[0];
     var isChanged = statusBar.hasClassName('changed');
@@ -28,3 +30,7 @@ function parentThemeOnChange(selected, defaultsById) {
         $('theme_title').value = defaults.theme_title;
     }
 }
+
+window.parentThemeOnChange = parentThemeOnChange;
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/adminhtml/web/js/sortable.js b/app/code/Magento/Theme/view/adminhtml/web/js/sortable.js
index ed0bdc181b2531c8d7cdd9bf7c42783c5cdc3d09..5a2b8b7172d98d434cded1eed40890f00fa588b0 100644
--- a/app/code/Magento/Theme/view/adminhtml/web/js/sortable.js
+++ b/app/code/Magento/Theme/view/adminhtml/web/js/sortable.js
@@ -20,8 +20,7 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+define(["jquery","jquery/ui"], function($){
     /**
      * Widget panel
      */
@@ -61,4 +60,4 @@
         }
     });
 
-})(jQuery);
+});
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml
index b041e7e658e6f4d7d273cf5569eb7a89abf6dd12..772166e988867eaf10a7419c2a5f1341b20c5892 100644
--- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml
+++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml
@@ -31,111 +31,33 @@
         <block class="Magento\Theme\Block\Html\Head\Css" name="magento-calendar-css">
             <arguments>
                 <argument name="file" xsi:type="string">mage/calendar.css</argument>
-                <argument name="properties" xsi:type="array">
-                    <item name="attributes" xsi:type="string"/>
-                </argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="requirejs">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-migrate-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery-migrate.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-jquery-no-conflict-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/jquery-no-conflict.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-mobile-custom-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.mobile.custom.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-head-js">
-            <arguments>
-                <argument name="file" xsi:type="string">headjs/head.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-magento-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/mage.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-decorate-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/decorate.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-translate-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/translate.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-cookie-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.cookie.js</argument>
+                <argument name="file" xsi:type="string">requirejs/require.js</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-cookies-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="app-config" after="jquery">
             <arguments>
-                <argument name="file" xsi:type="string">mage/cookies.js</argument>
+                <argument name="file" xsi:type="string">app-config.js</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ui-js" after="jquery-jquery-js">
+        <!-- /**
+        TODO: remove jQuery. jQuery could be loaded through RequireJS. But only in case ALL MODULES ARE AMD MODULES.
+        Detail: http://requirejs.org/docs/jquery.html#noconflictmap
+        */ -->
+        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery" after="requirejs">
             <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery-ui.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-tmpl-min-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.tmpl.min.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-bootstrap-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/bootstrap.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-page-js-truncate-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Theme::js/truncate.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-common-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/common.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-toggle-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/toggle.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-popup-window-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/popup-window.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-loader-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/loader.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-dataPost-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/dataPost.js</argument>
+                <argument name="file" xsi:type="string">jquery/jquery.js</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-menu-js">
+        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-no-conflict" after="jquery">
             <arguments>
-                <argument name="file" xsi:type="string">mage/menu.js</argument>
+                <argument name="file" xsi:type="string">mage/jquery-no-conflict.js</argument>
             </arguments>
         </block>
+
         <block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml"/>
     </referenceBlock>
 </layout>
diff --git a/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml b/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml
index fc36123ffcc30c0aa5ec302591ccd0bff5fe8305..cf99036b45b21ece4b30a3cb1c760e52bdfed5b8 100644
--- a/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml
+++ b/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml
@@ -24,18 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ui-timepicker-addon-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery-ui-timepicker-addon.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-calendar-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/calendar.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceContainer name="content">
         <block class="Magento\Framework\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/>
     </referenceContainer>
diff --git a/app/code/Magento/Theme/view/frontend/templates/html/head.phtml b/app/code/Magento/Theme/view/frontend/templates/html/head.phtml
index 52ff9abeb8ea3e9890ef9f096248610affbaf23f..d25e01c66b8ec17f607fcac6a4a376356c3ece9e 100644
--- a/app/code/Magento/Theme/view/frontend/templates/html/head.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/html/head.phtml
@@ -29,6 +29,14 @@
 <meta name="robots" content="<?php echo $this->escapeHtml($this->getRobots())?>"/>
 <link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon"/>
 <link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon"/>
+<script type="text/javascript">
+    var require = {
+    	"baseUrl": "<?php echo $this->getViewFileUrl('/') ?>",
+    	"paths": {
+    		"jquery/ui": "jquery/jquery-ui"
+    	}
+    };
+</script>
 <?php echo $this->getCssJsHtml() ?>
 <?php echo $this->getChildHtml() ?>
 <?php echo $this->getIncludes() ?>
diff --git a/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml b/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml
index b7114e9aaea1af8174389575dd4ff26d7d1d2e69..f6ddf25a749c65946dfb77de98a3599e9abe2544 100644
--- a/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml
@@ -49,6 +49,8 @@
         </div>
     </div>
     <script type="text/javascript">
+require(['jquery'], function(jQuery){
+
         // <![CDATA[
         (function($) {
             var test = 'test';
@@ -60,7 +62,9 @@
             }
         })(jQuery);
         // ]]>
-    </script>
+    
+});
+</script>
 <?php endif; ?>
 <?php if ($this->displayDemoNotice()): ?>
     <div class="message global demo">
@@ -84,16 +88,21 @@
         </div>
     </div>
     <script type="text/javascript">
-        // <![CDATA[
-        (function($) {
-            $('#notice-cookie-block').mage('cookieBlock', {
-                cookieAllowButtonSelector: '#btn-cookie-allow',
-                cookieName: '<?php echo \Magento\Store\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE ?>',
-                cookieValue: '<?php echo $this->helper('Magento\Store\Helper\Cookie')->getAcceptedSaveCookiesWebsiteIds() ?>',
-                cookieLifetime: <?php echo $this->helper('Magento\Store\Helper\Cookie')->getCookieRestrictionLifetime()?>,
-                noCookiesUrl: '<?php echo $this->getUrl('cms/index/noCookies') ?>'
-            });
-        })(jQuery);
-        // ]]>
-    </script>
+require([
+    "jquery",
+    "mage/mage"
+], function($){
+
+// <![CDATA[
+    $('#notice-cookie-block').mage('cookieBlock', {
+        cookieAllowButtonSelector: '#btn-cookie-allow',
+        cookieName: '<?php echo \Magento\Store\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE ?>',
+        cookieValue: '<?php echo $this->helper('Magento\Store\Helper\Cookie')->getAcceptedSaveCookiesWebsiteIds() ?>',
+        cookieLifetime: <?php echo $this->helper('Magento\Store\Helper\Cookie')->getCookieRestrictionLifetime()?>,
+        noCookiesUrl: '<?php echo $this->getUrl('cms/index/noCookies') ?>'
+    });
+// ]]>
+    
+});
+</script>
 <?php endif; ?>
diff --git a/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml b/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
index 7115e31f275addc332c10501f8391af03203f7cb..d40227d009dc9f69e3657fe7f2d9c3132c23053f 100644
--- a/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
@@ -31,8 +31,12 @@
 ?>
 
 <script type="text/javascript">
+require([
+    "jquery",
+    "jquery/ui"
+], function($){
+
 //<![CDATA[
-(function($) {
     $.extend(true, $, {
         calendarConfig: {
             dayNames: <?php echo $days['wide']?>,
@@ -63,7 +67,9 @@
             showMinute: false
         }
     });
-})(jQuery);
-enUS = <?php echo $enUS?>; // en_US locale reference
+
+    enUS = <?php echo $enUS?>; // en_US locale reference
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Theme/view/frontend/templates/js/components.phtml b/app/code/Magento/Theme/view/frontend/templates/js/components.phtml
index d93c42a2d0805ff73d75abadf94af6dbf370339f..c72c448288cc135b5b69b0d3671affae43cdb552 100644
--- a/app/code/Magento/Theme/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/js/components.phtml
@@ -23,40 +23,18 @@
  */
 ?>
 <script type="text/javascript">
-    (function($) {
-        "use strict";
+    require([
+        "jquery",
+        "mage/mage"
+    ], function($){
+        'use strict';
+        
         /**
          * Declaration of resources needed for defined components
          */
         $.mage.component({
-            deletableItem: [
-                '<?php echo $this->getViewFileUrl('mage/deletable-item.js') ?>'
-            ],
-            itemTable: [
-                '<?php echo $this->getViewFileUrl('mage/item-table.js') ?>'
-            ],
-            validation: [
-                '<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>',
-                '<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js') ?>',
-                '<?php echo $this->getViewFileUrl('mage/validation.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/validation/validation.js') ?>'
-            ],
-            fieldsetControls: [
-                '<?php echo $this->getViewFileUrl('mage/fieldset-controls.js') ?>'
-            ],
-            fieldsetResetControl: [
-                '<?php echo $this->getViewFileUrl('mage/fieldset-controls.js') ?>'
-            ],
-            redirectUrl: [
-                '<?php echo $this->getViewFileUrl('mage/redirect-url.js') ?>'
-            ],
-            dropdownDialog: [
-                '<?php echo $this->getViewFileUrl('mage/dropdown.js') ?>'
-            ],
-            cookieBlock: [
-                '<?php echo $this->getViewFileUrl('Magento_Theme::js/notices.js') ?>'
-            ]
+            validation: 'mage/validation/validation'
         });
-    })(jQuery);
+    });
 </script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Theme/view/frontend/templates/js/cookie.phtml b/app/code/Magento/Theme/view/frontend/templates/js/cookie.phtml
index c4f2ee5701b342c32626ccfb5f76c95ec182087c..91b93bba9d92971fbc58db4b0bc9fd24e993e249 100644
--- a/app/code/Magento/Theme/view/frontend/templates/js/cookie.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/js/cookie.phtml
@@ -31,15 +31,20 @@
 ?>
 
 <script type="text/javascript">
-    //<![CDATA[
-    (function($) {
-        $.extend($.mage.cookies.defaults, {
-            expires: null,
-            path: '<?php echo $this->getPath()?>',
-            domain: '<?php echo $this->getDomain()?>',
-            secure: false
-        });
-        $.extend($.cookie.defaults, $.mage.cookies.defaults);
-    })(jQuery);
-    //]]>
+	require([
+		"jquery",
+		"jquery/jquery.cookie",
+		"mage/mage",
+		"mage/cookies"
+	], function($){
+	    
+	    $.extend($.mage.cookies.defaults, {
+	        expires: null,
+	        path: '<?php echo $this->getPath()?>',
+	        domain: '<?php echo $this->getDomain()?>',
+	        secure: false
+	    });
+	    
+	    $.extend($.cookie.defaults, $.mage.cookies.defaults);
+	});
 </script>
diff --git a/app/code/Magento/Theme/view/frontend/web/js/notices.js b/app/code/Magento/Theme/view/frontend/web/js/notices.js
index 74d4ef3d96e4014e20b4d7c3f9f714fb040c15fe..7d2fbcdfb63d50c078eed2e493da832894efc132 100644
--- a/app/code/Magento/Theme/view/frontend/web/js/notices.js
+++ b/app/code/Magento/Theme/view/frontend/web/js/notices.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/cookies"
+], function($){
+
     $.widget('mage.cookieBlock', {
         _create: function() {
             if ($.mage.cookies.get(this.options.cookieName)) {
@@ -40,4 +45,5 @@
             }, this));
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/frontend/web/js/row-builder.js b/app/code/Magento/Theme/view/frontend/web/js/row-builder.js
index fd63ff33f4e63f2da084ff7aecc9c59908c617a8..94668119718671cb8e7b0893f3acea528bfc34ad 100644
--- a/app/code/Magento/Theme/view/frontend/web/js/row-builder.js
+++ b/app/code/Magento/Theme/view/frontend/web/js/row-builder.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
     "use strict";
+
     $.widget('mage.rowBuilder', {
 
         /**
@@ -217,4 +222,4 @@
         }
     });
 
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/frontend/web/js/truncate.js b/app/code/Magento/Theme/view/frontend/web/js/truncate.js
index 2684f26d476e151ebc0730f75df43e3fd55789ad..83897d9e803967f4ffeb5de235bfc3d74c1fed98 100644
--- a/app/code/Magento/Theme/view/frontend/web/js/truncate.js
+++ b/app/code/Magento/Theme/view/frontend/web/js/truncate.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+    
     $.widget('mage.truncateOptions', {
         options: {
             detailsLink: 'a.details',
@@ -48,4 +52,5 @@
             $(event.currentTarget).find(this.options.truncatedFullValue).toggleClass('show');
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Theme/view/frontend/web/menu.js b/app/code/Magento/Theme/view/frontend/web/menu.js
index d75763e7b1d9550f1c30f961507cc0c299076847..445d27ddc183a8b1d975cc18418421cec00f6411 100644
--- a/app/code/Magento/Theme/view/frontend/web/menu.js
+++ b/app/code/Magento/Theme/view/frontend/web/menu.js
@@ -20,13 +20,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /**
  * @classDescription simple Navigation with replacing old handlers
  * @param {String} id id of ul element with navigation lists
  * @param {Object} settings object with settings
  */
-var mainNav = function() {
+define(["prototype"], function(){
+
+
+window.mainNav = function() {
 
     var main = {
         obj_nav :   $(arguments[0]) || $("nav"),
@@ -128,3 +130,5 @@ document.observe("dom:loaded", function() {
     //run navigation with delays
     mainNav("nav", {"show_delay":"100","hide_delay":"100"});
 });
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Translation/Block/Js.php b/app/code/Magento/Translation/Block/Js.php
index 6b6506efc2eb2a55abc69c5f2dacd1e9f25791b0..428e70f58a572544ac4d9ddaf0e689543a38b9a6 100644
--- a/app/code/Magento/Translation/Block/Js.php
+++ b/app/code/Magento/Translation/Block/Js.php
@@ -65,7 +65,7 @@ class Js
     {
         $json = \Zend_Json::encode($this->dataProvider->getTranslateData());
         $this->translateInline->processResponseBody($json, false);
-        $script = '(function($) {$.mage.translate.add(' . $json . ')})(jQuery);';
+        $script = 'require(["jquery", "mage/translate"], function($){ $.mage.translate.add(' . $json . '); })';
         return '<script type="text/javascript">//<![CDATA[' . "\n{$script}\n" . '//]]></script>';
     }
 }
diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..cffec76d78cb04e35b0e697023b47c167530da94
--- /dev/null
+++ b/app/code/Magento/Translation/composer.json
@@ -0,0 +1,22 @@
+{
+    "name": "magento/module-translation",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Translation"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php
index a5ddb80796bf133a0652368a5441f0b789ed2e91..64112cae78f5eea9f0b0ba33410f2bc0725a2686 100644
--- a/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php
+++ b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php
@@ -49,7 +49,7 @@ $table = $installer->getConnection()
         255,
         array(
             'nullable' => false,
-            'default' => \Magento\Framework\TranslateInterface::DEFAULT_STRING,
+            'default' => 'Translate String',
         ),
         'Translation String'
     )->addColumn(
@@ -83,7 +83,7 @@ $table = $installer->getConnection()
         null,
         array(
             'nullable' => false,
-            'default'  => crc32(\Magento\Framework\TranslateInterface::DEFAULT_STRING)
+            'default'  => crc32('Translate String')
         ),
         'Translation String CRC32 Hash'
     )->addIndex(
diff --git a/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml b/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml
index c46aeb4649605a4820060d7d1a29b821d20907ad..246c199447179c8f7815bd9efc9aaef5edcac01f 100644
--- a/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml
+++ b/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml
@@ -23,11 +23,8 @@
  */
 ?>
 
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('prototype/window.js') ?>"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('prototype/windows/themes/default.css') ?>"/>
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('Magento_Core::prototype/magento.css') ?>"/>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/edit-trigger.js') ?>"></script>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate-inline.js') ?>"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('mage/translate-inline.css') ?>"/>
 
 <script id="translate-inline-icon" type="text/x-jQuery-tmpl">
@@ -65,8 +62,12 @@
 <div data-role="translate-dialog"
      data-mage-init='{"translateInline":{"ajaxUrl":"<?php echo $this->getAjaxUrl() ?>"},"loader":{}}'></div>
 <script type="text/javascript">
-    (function($){
+require([
+    "jquery",
+    "mage/edit-trigger",
+    "mage/translate-inline"
+], function($){
         $('body').editTrigger({img: '<?php echo $this->getViewFileUrl('Magento_Core::fam_book_open.png') ?>', alwaysShown:true, singleElement:false});
         $('body').addClass('trnslate-inline-area');
-    })(jQuery);
+});
 </script>
diff --git a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml
index 36f449e5e31f3aee906189d7a9756f0691e1e722..1e6c22653e173535ed62b9532a37143282f3c21d 100644
--- a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml
+++ b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml
@@ -25,8 +25,6 @@
 
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('Magento_Core::prototype/magento.css') ?>"/>
 <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('mage/translate-inline.css') ?>"/>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/edit-trigger.js') ?>"></script>
-<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate-inline.js') ?>"></script>
 
 <script id="translate-inline-icon" type="text/x-jQuery-tmpl">
     <span class="action translate"></span>
@@ -61,7 +59,11 @@
 
 <div data-role="translate-dialog" data-mage-init='{"translateInline":{"ajaxUrl":"<?php echo $this->getAjaxUrl() ?>"}, "loader": {}}'></div>
 <script type="text/javascript">
-    (function($){
+    require([
+        "jquery",
+        "mage/edit-trigger",
+        "mage/translate-inline"
+    ], function($){
         $('body').editTrigger({alwaysShown:true, singleElement:false}).addClass('trnslate-inline-area');
-    })(jQuery);
+    });
 </script>
diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..36a24ede4300b873f29d2575f7901c692d1233e3
--- /dev/null
+++ b/app/code/Magento/Ups/composer.json
@@ -0,0 +1,26 @@
+{
+    "name": "magento/module-ups",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Ups"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml b/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml
index b9e5991b9159825b7610b607370c047de7b43a3c..3aa2855c7685c38ea06525011de69d790640403b 100644
--- a/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml
+++ b/app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml
@@ -52,6 +52,8 @@ if (!$storeCode && $websiteCode) {
 }
 ?>
 <script type="text/javascript">
+require(["prototype"], function(){
+
 //<![CDATA[
     function hideRowArrayElements(arr)
     {
@@ -189,4 +191,6 @@ if (!$storeCode && $websiteCode) {
     };
     xml = new upsXml();
     //]]>
+
+});
 </script>
diff --git a/app/code/Magento/UrlRedirect/Controller/Router.php b/app/code/Magento/UrlRedirect/Controller/Router.php
index 916578caa61510d493df9f7d282f2162a7dcd897..26b365613cddb7e759a01e246b1ce15e14f39dde 100644
--- a/app/code/Magento/UrlRedirect/Controller/Router.php
+++ b/app/code/Magento/UrlRedirect/Controller/Router.php
@@ -43,6 +43,11 @@ class Router implements \Magento\Framework\App\RouterInterface
     /** @var \Magento\UrlRedirect\Service\V1\UrlMatcherInterface */
     protected $urlMatcher;
 
+    /**
+     * @var \Magento\Framework\App\ActionFactory
+     */
+    protected $actionFactory;
+
     /**
      * @param \Magento\Framework\App\ActionFactory $actionFactory
      * @param \Magento\Framework\UrlInterface $url
@@ -59,7 +64,7 @@ class Router implements \Magento\Framework\App\RouterInterface
         \Magento\Framework\App\ResponseInterface $response,
         \Magento\UrlRedirect\Service\V1\UrlMatcherInterface $urlMatcher
     ) {
-        parent::__construct($actionFactory);
+        $this->actionFactory = $actionFactory;
         $this->url = $url;
         $this->appState = $appState;
         $this->storeManager = $storeManager;
@@ -91,14 +96,14 @@ class Router implements \Magento\Framework\App\RouterInterface
             $redirectCode = $redirectType == \Magento\UrlRedirect\Model\OptionProvider::PERMANENT ? 301 : 302;
             $this->response->setRedirect($urlRewrite->getTargetPath(), $redirectCode);
             $request->setDispatched(true);
-            return $this->_actionFactory->createController(
+            return $this->actionFactory->createController(
                 'Magento\Framework\App\Action\Redirect',
                 array('request' => $request)
             );
         }
 
         $request->setPathInfo('/' . $urlRewrite->getTargetPath());
-        return $this->_actionFactory->createController(
+        return $this->actionFactory->createController(
             'Magento\Framework\App\Action\Forward',
             array('request' => $request)
         );
diff --git a/app/code/Magento/UrlRedirect/composer.json b/app/code/Magento/UrlRedirect/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..30615273b95c205ff4b451171b6c21972f38c3ce
--- /dev/null
+++ b/app/code/Magento/UrlRedirect/composer.json
@@ -0,0 +1,24 @@
+{
+    "name": "magento/module-url-redirect",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-install": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/UrlRedirect"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..d8eb8310edad6fcf4f47d1d3afde8ba353465965
--- /dev/null
+++ b/app/code/Magento/UrlRewrite/composer.json
@@ -0,0 +1,22 @@
+{
+    "name": "magento/module-url-rewrite",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/UrlRewrite"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..127bbd4d541303310a603e850781f24e2b0de630
--- /dev/null
+++ b/app/code/Magento/User/composer.json
@@ -0,0 +1,55 @@
+{
+    "name": "magento/module-user",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-newsletter": "0.1.0-alpha89",
+        "magento/module-review": "0.1.0-alpha89",
+        "magento/module-admin-notification": "0.1.0-alpha89",
+        "magento/module-backup": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-catalog-rule": "0.1.0-alpha89",
+        "magento/module-catalog-search": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-contact": "0.1.0-alpha89",
+        "magento/module-currency-symbol": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-design-editor": "0.1.0-alpha89",
+        "magento/module-downloadable": "0.1.0-alpha89",
+        "magento/module-google-shopping": "0.1.0-alpha89",
+        "magento/module-import-export": "0.1.0-alpha89",
+        "magento/module-index": "0.1.0-alpha89",
+        "magento/module-integration": "0.1.0-alpha89",
+        "magento/module-payment": "0.1.0-alpha89",
+        "magento/module-paypal": "0.1.0-alpha89",
+        "magento/module-persistent": "0.1.0-alpha89",
+        "magento/module-reports": "0.1.0-alpha89",
+        "magento/module-rss": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-sales-rule": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-sitemap": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-widget": "0.1.0-alpha89",
+        "magento/module-wishlist": "0.1.0-alpha89",
+        "magento/module-email": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/User"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php
index 5f6bffb9e5465e0a54a6aaee6ff1984fcfc121f1..499d748d464654aeff4cfb79ebae6e1b5ab9fc0c 100644
--- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php
+++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php
@@ -35,7 +35,7 @@ $connection->addColumn(
         'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
         'length' => 5,
         'nullable' => false,
-        'default' => \Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE,
+        'default' => 'en_US',
         'comment' => 'Backend interface locale'
     )
 );
diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php
index 8fc21870143462529323620bc91b277478117ab0..93b517fc1e93c98e89eaa061e36c5c4280f7b5e5 100644
--- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php
+++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php
@@ -30,7 +30,12 @@ $connection = $installer->getConnection();
 $connection->addColumn(
     $installer->getTable('admin_role'),
     'user_type',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 16, 'nullable' => true, 'comment' => 'User type')
+    array(
+        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+        'length' => 16,
+        'nullable' => true,
+        'comment' => 'User type'
+    )
 );
 $connection->dropColumn($installer->getTable('admin_rule'), 'role_type');
 $installer->endSetup();
diff --git a/app/code/Magento/User/view/adminhtml/templates/admin/forgotpassword.phtml b/app/code/Magento/User/view/adminhtml/templates/admin/forgotpassword.phtml
index 46edc6b93c375f21fe6e0ee954b3c1d8a6c661af..2696ac85db951e657064db87147db6ead6b04ffa 100644
--- a/app/code/Magento/User/view/adminhtml/templates/admin/forgotpassword.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/admin/forgotpassword.phtml
@@ -30,6 +30,15 @@
 
     <link rel="icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico'); ?>" type="image/x-icon" />
     <link rel="shortcut icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico'); ?>" type="image/x-icon" />
+    <script type="text/javascript">
+        var require = {
+            "baseUrl": "<?php echo $this->getViewFileUrl('/') ?>",
+            "paths": {
+                "jquery/ui": "jquery/jquery-ui-1.9.2",
+                "mage/components": "mage/backend/components"
+            }
+        };
+    </script>
 
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/reset.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/base.css') ?>" media="all" />
@@ -39,22 +48,14 @@
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/pages.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/utils.css') ?>" media="all" />
 
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui-1.9.2.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/validation.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/backend/validation.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/backend/form.js') ?>"></script>
-
-    <script src="<?php echo $this->getViewFileUrl('prototype/prototype.js'); ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/adminhtml/events.js'); ?>"></script>
+     <script src="<?php echo $this->getViewFileUrl('prototype/prototype.js'); ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('scriptaculous/effects.js'); ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('mage/captcha.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('modernizr/modernizr.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('headjs/head.min.js') ?>"></script>
+
+    <script src="<?php echo $this->getViewFileUrl('requirejs/require.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('app-config.js') ?>"></script>
 
 <body id="page-login" class="page-login page-forgotpassword">
     <div class="wrapper">
@@ -90,7 +91,13 @@
                     </fieldset>
                 </form>
                 <script type="text/javascript">
-                    jQuery('#login-form').form().validation();
+                    require([
+                        "jquery",
+                        "mage/backend/form",
+                        "mage/backend/validation"
+                    ], function(jQuery){
+                        jQuery('#login-form').form().validation();
+                    });
                 </script>
             </div>
         </div>
diff --git a/app/code/Magento/User/view/adminhtml/templates/admin/resetforgottenpassword.phtml b/app/code/Magento/User/view/adminhtml/templates/admin/resetforgottenpassword.phtml
index 3c6a57c2215e6c95ac15646dcac3b70c2a496b37..92e10f21ec12f4e4afef222200f99ee918eee1ea 100644
--- a/app/code/Magento/User/view/adminhtml/templates/admin/resetforgottenpassword.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/admin/resetforgottenpassword.phtml
@@ -29,6 +29,15 @@
     <title><?php echo __('Reset a Password'); ?></title>
     <link rel="icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico'); ?>" type="image/x-icon" />
     <link rel="shortcut icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico'); ?>" type="image/x-icon" />
+    <script type="text/javascript">
+        var require = {
+            "baseUrl": "<?php echo $this->getViewFileUrl('/') ?>",
+            "paths": {
+                "jquery/ui": "jquery/jquery-ui-1.9.2",
+                "mage/components": "mage/backend/components"
+            }
+        };
+    </script>
 
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/reset.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/base.css') ?>" media="all" />
@@ -38,21 +47,14 @@
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/pages.css') ?>" media="all" />
     <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/utils.css') ?>" media="all" />
 
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui-1.9.2.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/validation.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/backend/validation.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('mage/backend/form.js') ?>"></script>
-
     <script src="<?php echo $this->getViewFileUrl('prototype/prototype.js') ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('scriptaculous/effects.js') ?>"></script>
     <script src="<?php echo $this->getViewFileUrl('mage/captcha.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('modernizr/modernizr.js') ?>"></script>
-    <script src="<?php echo $this->getViewFileUrl('headjs/head.min.js') ?>"></script>
+
+    <script src="<?php echo $this->getViewFileUrl('requirejs/require.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script>
+    <script src="<?php echo $this->getViewFileUrl('app-config.js') ?>"></script>
 
 <body id="page-login" class="page-login page-resetpass">
     <div class="wrapper">
@@ -91,8 +93,16 @@
                     </fieldset>
                 </form>
                 <script type="text/javascript">
-                    jQuery('#reset-password-form').form().validation();
-                </script>
+require([
+    "jquery",
+    "mage/backend/form",
+    "mage/backend/validation"
+], function(jQuery){
+
+    jQuery('#reset-password-form').form().validation();
+                
+});
+</script>
             </div>
         </div>
     </div>
diff --git a/app/code/Magento/User/view/adminhtml/templates/role/info.phtml b/app/code/Magento/User/view/adminhtml/templates/role/info.phtml
index 4e99ecf454976714e446e4884fed436ba4fc42b0..7b07b6c10075eab5cc32dc19a809072f4d583d95 100644
--- a/app/code/Magento/User/view/adminhtml/templates/role/info.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/role/info.phtml
@@ -26,7 +26,14 @@
     <?php echo $this->getBlockHtml('formkey')?>
 </form>
 <script type="text/javascript">
+require([
+	"jquery",
+	"mage/mage"
+], function(jQuery){
+
     jQuery(document).ready(function() {
         jQuery('#role-edit-form').mage('form').mage('validation');
     });
+
+});
 </script>
diff --git a/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml b/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml
index 173919713285381e6902d6847eef7e758381b8f3..b07fac9dcde6a612d5fb3141439d254cd471988a 100644
--- a/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/role/users_grid_js.phtml
@@ -23,6 +23,11 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    'jquery',
+    'mage/adminhtml/grid'
+], function(jQuery){
+
 <!--
 <?php $myBlock = $this->getLayout()->getBlock('roleUsersGrid'); ?>
 <?php if( is_object($myBlock) && $myBlock->getJsObjectName() ): ?>
@@ -100,7 +105,7 @@
             roleUsersRowInit(<?php echo $myBlock->getJsObjectName() ?>, row);
         });
     }
-    jQuery(function() {
+    document.observe('dom:loaded', function(){
         <?php echo $myBlock->getJsObjectName() ?>.rowClickCallback = roleUsersRowClick;
         <?php echo $myBlock->getJsObjectName() ?>.initRowCallback = roleUsersRowInit;
         <?php echo $myBlock->getJsObjectName() ?>.checkboxCheckCallback = registerUserRole;
@@ -110,4 +115,6 @@
     });
 <?php endif; ?>
 //-->
+
+});
 </script>
diff --git a/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml b/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml
index 636d999152dd82c4d1c7281330c361f4e4481cc0..12f8072b3b0c07f123662531a1299c4950bb0cf2 100644
--- a/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml
+++ b/app/code/Magento/User/view/adminhtml/templates/user/roles_grid_js.phtml
@@ -23,7 +23,10 @@
  */
 ?>
 <script type="text/javascript">
-<!--
+require([
+    "mage/adminhtml/grid"
+], function(){
+
 <?php $myBlock = $this->getLayout()->getBlock('user.roles.grid'); ?>
 <?php if( is_object($myBlock) && $myBlock->getJsObjectName()): ?>
     var radioBoxes = $H({});
@@ -79,5 +82,6 @@
 <?php echo $myBlock->getJsObjectName() ?>.checkboxCheckCallback = registerUserRole;
 <?php echo $myBlock->getJsObjectName() ?>.rows.each(function(row){rolesRowInit(<?php echo $myBlock->getJsObjectName() ?>, row)});
 <?php endif; ?>
-//-->
+
+});
 </script>
diff --git a/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js b/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js
index d02a145de5b2e7ebb70a2a2a6d66fe3b889056fc..7eebf4fb15e03352fe2449a19e31bb9768cedaf2 100644
--- a/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js
+++ b/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-jQuery(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/jstree/jquery.jstree"
+], function($){
     'use strict';
+
     $.widget('mage.rolesTree', {
         options: {
             treeInitData: {},
@@ -81,4 +86,5 @@ jQuery(function($) {
             return false;
         }
     });
-});
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..e384ca64a3868bc0556d01e4309946335ebb56b4
--- /dev/null
+++ b/app/code/Magento/Usps/composer.json
@@ -0,0 +1,27 @@
+{
+    "name": "magento/module-usps",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-shipping": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Usps"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Usps/sql/usps_setup/install-2.0.0.0.php b/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.0.php
similarity index 100%
rename from app/code/Magento/Usps/sql/usps_setup/install-2.0.0.0.php
rename to app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.0.php
diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..8d931626342448fc65d503cc894fb4193678c884
--- /dev/null
+++ b/app/code/Magento/Webapi/composer.json
@@ -0,0 +1,26 @@
+{
+    "name": "magento/module-webapi",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-integration": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-user": "0.1.0-alpha89",
+        "magento/module-authz": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Webapi"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Webapi/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml b/app/code/Magento/Webapi/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml
index 4293e51aec879ad0d62171db0c147df6a097b6d6..a3500f86e58ea177e48d358677c19cec11cee5bf 100644
--- a/app/code/Magento/Webapi/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml
+++ b/app/code/Magento/Webapi/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml
@@ -39,26 +39,22 @@
 </fieldset>
 <?php if (!$this->isTreeEmpty()): ?>
     <script type="text/javascript">
-    jQuery(function($) {
-        head.js(
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js')?>',
-            '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js')?>',
-            '<?php echo $this->getViewFileUrl('Magento_User::js/roles-tree.js')?>'
-        );
-        head.ready(function () {
-            $.widget('mage.rolesTree', $.mage.rolesTree, {
-                _checkNode: function(event) {},
-                _checkNodes: function() {
-                    this._super();
-                    this.element.jstree('disable_hotkeys').jstree('hide_checkboxes')
-                        .find('li.jstree-unchecked').hide().end().find('li.jstree-checked').attr('rel', 'disabled');
-                }
-            });
-            $('[data-role="resource-tree"]').rolesTree({
-                'treeInitData': <?php echo $this->getResourcesTreeJson() ?>,
-                'treeInitSelectedData': <?php echo $this->getSelectedResourcesJson() ?>
-            });
-        });
+require(["jquery", "Magento_User/js/roles-tree"], function($){
+
+    $.widget('mage.rolesTree', $.mage.rolesTree, {
+        _checkNode: function(event) {},
+        _checkNodes: function() {
+            this._super();
+            this.element.jstree('disable_hotkeys').jstree('hide_checkboxes')
+                .find('li.jstree-unchecked').hide().end().find('li.jstree-checked').attr('rel', 'disabled');
+        }
     });
-    </script>
+
+    $('[data-role="resource-tree"]').rolesTree({
+        'treeInitData': <?php echo $this->getResourcesTreeJson() ?>,
+        'treeInitSelectedData': <?php echo $this->getSelectedResourcesJson() ?>
+    });
+    
+});
+</script>
 <?php endif ?>
diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..29650859b107c172801bf393beab4d7b22030772
--- /dev/null
+++ b/app/code/Magento/Weee/composer.json
@@ -0,0 +1,29 @@
+{
+    "name": "magento/module-weee",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-directory": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-eav": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-bundle": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Weee"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Weee/data/weee_setup/data-install-1.6.0.0.php b/app/code/Magento/Weee/data/weee_setup/data-install-1.6.0.0.php
new file mode 100644
index 0000000000000000000000000000000000000000..b5e2ce84991006151487f622efb3ac359835832e
--- /dev/null
+++ b/app/code/Magento/Weee/data/weee_setup/data-install-1.6.0.0.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var $installer \Magento\Sales\Model\Resource\Setup */
+$installer = $this;
+
+$installer->addAttribute('order_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'weee_tax_applied', array('type' => 'text'));
+
+$installer->addAttribute('quote_item', 'weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('quote_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
+$installer->addAttribute('quote_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('quote_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
+
+$installer->addAttribute('order_item', 'weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('order_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
+
+$installer->addAttribute('invoice_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'weee_tax_applied', array('type' => 'text'));
+$installer->addAttribute('invoice_item', 'weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('invoice_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
+
+$installer->addAttribute('quote_item', 'weee_tax_applied', array('type' => 'text'));
+$installer->addAttribute('quote_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('quote_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
+$installer->addAttribute('quote_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('quote_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
+
+$installer->addAttribute('creditmemo_item', 'weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'weee_tax_applied', array('type' => 'text'));
+$installer->addAttribute('creditmemo_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
+$installer->addAttribute('creditmemo_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
diff --git a/app/code/Magento/Weee/etc/module.xml b/app/code/Magento/Weee/etc/module.xml
index 5b9ce1ed900af0c7a2c137251eafc3f27f854d3d..7cfebef72988d1a8f5f2c98b457b5f46328782f2 100644
--- a/app/code/Magento/Weee/etc/module.xml
+++ b/app/code/Magento/Weee/etc/module.xml
@@ -41,7 +41,6 @@
             <module name="Magento_Eav"/>
             <module name="Magento_Customer"/>
             <module name="Magento_Bundle"/>
-            <module name="Magento_Theme"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php b/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php
index 58f89d2eda28c035af6d058782e52348f0bed2e8..18f4680e81c39ef3ffbad7cf18bac26a0320cb6b 100644
--- a/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php
@@ -187,46 +187,4 @@ $table = $installer->getConnection()->newTable(
 );
 $installer->getConnection()->createTable($table);
 
-$installer->addAttribute('order_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'weee_tax_applied', array('type' => 'text'));
-
-$installer->addAttribute('quote_item', 'weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('quote_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
-$installer->addAttribute('quote_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('quote_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
-
-$installer->addAttribute('order_item', 'weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('order_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
-
-$installer->addAttribute('invoice_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'weee_tax_applied', array('type' => 'text'));
-$installer->addAttribute('invoice_item', 'weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('invoice_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
-
-$installer->addAttribute('quote_item', 'weee_tax_applied', array('type' => 'text'));
-$installer->addAttribute('quote_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('quote_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
-$installer->addAttribute('quote_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('quote_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
-
-$installer->addAttribute('creditmemo_item', 'weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'weee_tax_row_disposition', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'base_weee_tax_disposition', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'base_weee_tax_row_disposition', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'weee_tax_applied', array('type' => 'text'));
-$installer->addAttribute('creditmemo_item', 'base_weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'base_weee_tax_applied_row_amnt', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'weee_tax_applied_amount', array('type' => 'decimal'));
-$installer->addAttribute('creditmemo_item', 'weee_tax_applied_row_amount', array('type' => 'decimal'));
-
 $installer->endSetup();
diff --git a/app/code/Magento/Weee/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Weee/view/adminhtml/layout/catalog_product_new.xml
deleted file mode 100644
index 31207fe5529d1e67cb93d2e9666df318aaa1a63d..0000000000000000000000000000000000000000
--- a/app/code/Magento/Weee/view/adminhtml/layout/catalog_product_new.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="mage-weee-js-fpt-attribute-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Weee::js/fpt-attribute.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
-</layout>
diff --git a/app/code/Magento/Weee/view/adminhtml/web/js/fpt-attribute.js b/app/code/Magento/Weee/view/adminhtml/web/js/fpt-attribute.js
index 2e3fb04ced277cda22b72b027d14ca5c5d694c96..13e837302900276bfe95408155f065c9b716c03d 100644
--- a/app/code/Magento/Weee/view/adminhtml/web/js/fpt-attribute.js
+++ b/app/code/Magento/Weee/view/adminhtml/web/js/fpt-attribute.js
@@ -20,7 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "mage/adminhtml/form"
+], function($){
+
     $.widget('mage.fptAttribute', {
         _create: function () {
             var widget = this;
@@ -103,4 +109,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Weee/view/frontend/layout/default.xml b/app/code/Magento/Weee/view/frontend/layout/default.xml
index 28b1967a7ed9a51cd5f5c397ac65db26258ad2d6..71cabb7fa136c77677faa0490abac321c1a3393b 100644
--- a/app/code/Magento/Weee/view/frontend/layout/default.xml
+++ b/app/code/Magento/Weee/view/frontend/layout/default.xml
@@ -24,11 +24,5 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-weee-tax-toggle-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Weee::tax-toggle.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
+    <referenceBlock name="head"></referenceBlock>
 </layout>
diff --git a/app/code/Magento/Weee/view/frontend/web/tax-toggle.js b/app/code/Magento/Weee/view/frontend/web/tax-toggle.js
index 145b0edd42f6afbe9bad01aa29d6f48e868f261e..34743885281864f65310394dbf72c699ef6cf172 100644
--- a/app/code/Magento/Weee/view/frontend/web/tax-toggle.js
+++ b/app/code/Magento/Weee/view/frontend/web/tax-toggle.js
@@ -21,8 +21,9 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define(["jquery"], function($){
     "use strict";
+    
     $(function() {
         $('body').on('click', '[data-tax-toggle]', function() {
             var currElem = $(this),
@@ -32,4 +33,5 @@
             $(args.itemTaxId).toggle();
         });
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget.php b/app/code/Magento/Widget/Block/Adminhtml/Widget.php
index a4b0612d68b5d393cd70192840a00b19811a9c97..57254ba14200bf64a9520f3bfa32863413adbe46 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget.php
@@ -51,12 +51,12 @@ class Widget extends \Magento\Backend\Block\Widget\Form\Container
         $this->buttonList->update('save', 'onclick', 'wWidget.insertWidget()');
         $this->buttonList->update('save', 'region', 'footer');
 
-        $this->_formScripts[] = 'wWidget = new WysiwygWidget.Widget(' .
+        $this->_formScripts[] = 'require(["mage/adminhtml/wysiwyg/widget"], function(){wWidget = new WysiwygWidget.Widget(' .
             '"widget_options_form", "select_widget_type", "widget_options", "' .
             $this->getUrl(
                 'adminhtml/*/loadOptions'
             ) . '", "' . $this->getRequest()->getParam(
                 'widget_target_id'
-            ) . '");';
+            ) . '");});';
     }
 }
diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php
index e774045a69fe9b0253589d7a3d10c1a67f095dc5..401e50c55e69a2923e22d8de4532954c892569f4 100644
--- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php
+++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php
@@ -204,7 +204,9 @@ class Chooser extends \Magento\Backend\Block\Template
             <div id="' .
             $chooserId .
             'advice-container" class="hidden"></div>
-            <script type="text/javascript">//<![CDATA[
+            <script type="text/javascript">
+            require(["prototype", "mage/adminhtml/wysiwyg/widget"], function(){
+            //<![CDATA[
                 (function() {
                     var instantiateChooser = function() {
                         window.' .
@@ -237,7 +239,9 @@ class Chooser extends \Magento\Backend\Block\Template
                         document.observe("dom:loaded", instantiateChooser);
                     }
                 })();
-            //]]></script>
+            //]]>
+            });
+            </script>
         ';
     }
 }
diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..35416fd879a95303314f1dc257ac484c29d79dc3
--- /dev/null
+++ b/app/code/Magento/Widget/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-widget",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-cms": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Widget"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_edit.xml b/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_edit.xml
index 91b62ea70a2e5e18beecf6f146c069288d888989..c07b0ad0e7334cff2a0e84b896fe884e5f5c1179 100644
--- a/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_edit.xml
+++ b/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_edit.xml
@@ -28,11 +28,6 @@
         <action method="setCanLoadExtJs">
             <argument name="flag" xsi:type="string">1</argument>
         </action>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-wysiwyg-widget-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/adminhtml/wysiwyg/widget.js</argument>
-            </arguments>
-        </block>
         <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-window-js">
             <arguments>
                 <argument name="file" xsi:type="string">prototype/window.js</argument>
diff --git a/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml b/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml
index 885e2d1daad0c59e0da83291d28e90e9fec9ff75..2386c179eea19705d6ed44bbc74e33119ee64e19 100644
--- a/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml
+++ b/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml
@@ -31,6 +31,8 @@
     </div>
 </fieldset>
 <script type="text/javascript">
+require(['prototype'], function(){
+
 //<![CDATA[
 
 var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id="page_group_container_{{id}}">'+
@@ -189,6 +191,8 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id="
 '</div>'+
 '</div>';
 
+window.pageGroupTemplate = pageGroupTemplate;
+
 var WidgetInstance = {
     pageGroupTemplate    : pageGroupTemplate,
     pageGroupContainerId : 'page_group_container',
@@ -472,6 +476,8 @@ var WidgetInstance = {
     }
 };
 
+window.WidgetInstance = WidgetInstance;
+
 Ext.onReady(function(){
     <?php foreach ($this->getPageGroups() as $pageGroup): ?>
         WidgetInstance.addPageGroup(<?php echo Zend_Json::encode($pageGroup) ?>);
@@ -489,4 +495,6 @@ Ext.onReady(function(){
     });
 });
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Widget/view/adminhtml/templates/instance/js.phtml b/app/code/Magento/Widget/view/adminhtml/templates/instance/js.phtml
index d3e6932545e6a4f0d04ff157774290a033043817..4c2bec4446905de752d5791bc04a5ea63dd80aff 100644
--- a/app/code/Magento/Widget/view/adminhtml/templates/instance/js.phtml
+++ b/app/code/Magento/Widget/view/adminhtml/templates/instance/js.phtml
@@ -23,8 +23,10 @@
  */
 ?>
 <script type="text/javascript">
+require(["jquery", "prototype"], function(jQuery){
+
 //<![CDATA[
-function setSettings(urlTemplate, codeElement, themeElement) {
+setSettings = function(urlTemplate, codeElement, themeElement) {
     if (!jQuery('#edit_form').valid()) {
         return false;
     }
@@ -37,4 +39,6 @@ function setSettings(urlTemplate, codeElement, themeElement) {
     }));
 }
 //]]>
+
+});
 </script>
diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..0316d3b519f33fe4b5336e8e852a3319a357ce35
--- /dev/null
+++ b/app/code/Magento/Wishlist/composer.json
@@ -0,0 +1,33 @@
+{
+    "name": "magento/module-wishlist",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/module-store": "0.1.0-alpha89",
+        "magento/module-customer": "0.1.0-alpha89",
+        "magento/module-catalog": "0.1.0-alpha89",
+        "magento/module-core": "0.1.0-alpha89",
+        "magento/module-checkout": "0.1.0-alpha89",
+        "magento/module-theme": "0.1.0-alpha89",
+        "magento/module-catalog-inventory": "0.1.0-alpha89",
+        "magento/module-tax": "0.1.0-alpha89",
+        "magento/module-backend": "0.1.0-alpha89",
+        "magento/module-bundle": "0.1.0-alpha89",
+        "magento/module-sales": "0.1.0-alpha89",
+        "magento/module-grouped-product": "0.1.0-alpha89",
+        "magento/module-configurable-product": "0.1.0-alpha89",
+        "magento/module-downloadable": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-module",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Wishlist"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml b/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml
index fecb77504a632c8f829644275e6e85116ab9adba..7bc8aa675a7a1b31917bcd3943b9036c3a89d1b1 100644
--- a/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml
+++ b/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml
@@ -27,6 +27,11 @@
  */
 ?>
 <script type="text/javascript">
+require([
+    "prototype",
+    "Magento_Catalog/catalog/product/composite/configure"
+], function(){
+
 //<!--
 wishlistControl = {
     reload: function (urlParams) {
@@ -75,4 +80,6 @@ productConfigure.addListType(
     }
 );
 //-->
+
+});
 </script>
diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml
index ae0a34517b97c242f3b67958c596f111bd9c76da..cdc3975ab1bd4c3ce1d9fcac706189f710994e50 100644
--- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml
+++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml
@@ -24,13 +24,6 @@
  */
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-bundle-js-product-summary-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Bundle::js/product-summary.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
     <referenceBlock name="root">
         <action method="addBodyClass">
             <argument name="value" xsi:type="string">type-bundle</argument>
diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml
index 742ca9673b1d9ca23196dbe86b3774f7d6c70df7..052631031e96d7cff8bff34ec25c0cb13a477253 100644
--- a/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml
+++ b/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml
@@ -38,7 +38,14 @@
     <?php endif; ?>
 </div>
 <script type="text/javascript">
-    jQuery('body').mage('addToWishlist',
-        <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode(array('productType' => $_product->getTypeId()))?>
-    );
+    require([
+        "jquery",
+        "mage/mage"
+    ], function(jQuery){
+
+        jQuery('body').mage('addToWishlist',
+            <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode(array('productType' => $_product->getTypeId()))?>
+        );
+
+    });
 </script>
\ No newline at end of file
diff --git a/app/code/Magento/Wishlist/view/frontend/templates/js/components.phtml b/app/code/Magento/Wishlist/view/frontend/templates/js/components.phtml
index d5cb3564a243f5882aa6f78b7545d25434300e16..2dd557c677f20546066e61a819051ea8dc756ff6 100644
--- a/app/code/Magento/Wishlist/view/frontend/templates/js/components.phtml
+++ b/app/code/Magento/Wishlist/view/frontend/templates/js/components.phtml
@@ -22,28 +22,4 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<script type="text/javascript">
-    (function($) {
-        "use strict";
-        /**
-         * Declaration of resources needed for defined components
-         */
-        $.mage.component({
-            wishlist: [
-                '<?php echo $this->getViewFileUrl('jquery/jquery.validate.js')?>',
-                '<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/validation.js')?>',
-                '<?php echo $this->getViewFileUrl('mage/validation/validation.js')?>',
-                '<?php echo $this->getViewFileUrl('jquery/handlebars/handlebars-v1.3.0.js')?>',
-                '<?php echo $this->getViewFileUrl('Magento_Wishlist::wishlist.js')?>'
-            ],
-            addToWishlist: [
-                '<?php echo $this->getViewFileUrl('Magento_Wishlist::js/add-to-wishlist.js') ?>'
-            ],
-            wishlistSearch: [
-                '<?php echo $this->getViewFileUrl('Magento_Wishlist::js/search.js') ?>'
-            ]
-        });
-    })(jQuery);
-</script>
 <?php echo $this->getChildHtml() ?>
diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js
index 76d71f60a5a9425cbf9fb3acd7d736ff0cab559a..886d693c4557bbbef9194664b8d23b2733422494 100644
--- a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js
+++ b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.addToWishlist', {
         options: {
             bundleInfo: '[id^=bundle-option-]',
@@ -54,4 +58,5 @@
             });
         }
     });
-})(jQuery);
\ No newline at end of file
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/search.js b/app/code/Magento/Wishlist/view/frontend/web/js/search.js
index 24681bbd509fc00fad155eacea2e3820a853bb02..f134933ee8edd343662d5ed5ff58bd968e459768 100644
--- a/app/code/Magento/Wishlist/view/frontend/web/js/search.js
+++ b/app/code/Magento/Wishlist/view/frontend/web/js/search.js
@@ -20,10 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.wishlistSearch', {
 
         /**
@@ -52,4 +55,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/app/code/Magento/Wishlist/view/frontend/web/wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/wishlist.js
index 8d577b6ec8113019d9514e4791105ba1aa0e04cc..f2c6e864c12684fc73dd66a4224bf4899fa79129 100644
--- a/app/code/Magento/Wishlist/view/frontend/web/wishlist.js
+++ b/app/code/Magento/Wishlist/view/frontend/web/wishlist.js
@@ -20,13 +20,18 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
 /*jshint browser:true jquery:true sub:true*/
 /*global alert*/
 /*global Handlebars*/
+define([
+    "jquery",
+    "handlebars",
+    "jquery/ui",
+    "mage/validation/validation",
+    "mage/dataPost"
+], function($){
+     "use strict";
 
-(function($, Handlebars, window) {
-    "use strict";
     $.widget('mage.wishlist', {
         options: {
             dataAttribute: 'item-id',
@@ -210,4 +215,6 @@
             });
         }
     });
-})(jQuery, Handlebars, window);
+
+
+});
\ No newline at end of file
diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml
index c4e81a31dc96c568c768be2cbfe63e593f985b42..8fd44f9188e01c278907ba7335d6259cd4a33e7a 100644
--- a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml
+++ b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml
@@ -89,40 +89,5 @@
                 </argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="lib-modernizr-js">
-            <arguments>
-                <argument name="file" xsi:type="string">modernizr/modernizr.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-dropdown-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/dropdown_old.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-tabs-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.tabs.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-farbtastic-jquery-farbtastic-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/farbtastic/jquery.farbtastic.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-theme-js">
-            <arguments>
-                <argument name="file" xsi:type="string">js/theme.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-modernizr-details-js">
-            <arguments>
-                <argument name="file" xsi:type="string">modernizr/modernizr.details.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-jquery-details-js">
-            <arguments>
-                <argument name="file" xsi:type="string">jquery/jquery.details.js</argument>
-            </arguments>
-        </block>
     </referenceBlock>
 </layout>
diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..8d5060896f34c3c6711d2b0e4f538092c7a78aff
--- /dev/null
+++ b/app/design/adminhtml/Magento/backend/composer.json
@@ -0,0 +1,19 @@
+{
+    "name": "magento/theme-adminhtml-backend",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-theme",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "adminhtml/Magento/backend"
+            ]
+        ]
+    }
+}
diff --git a/app/design/adminhtml/Magento/backend/theme.xml b/app/design/adminhtml/Magento/backend/theme.xml
index c06a36c1457ccf52f4dcd1d42d455055483db605..e4b8434d1fedfc85aa782e81fd0e142b46e2f330 100644
--- a/app/design/adminhtml/Magento/backend/theme.xml
+++ b/app/design/adminhtml/Magento/backend/theme.xml
@@ -24,5 +24,5 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento 2 backend</title>
-    <version>0.1.0</version>
+    <version>0.1.0-alpha89</version>
 </theme>
diff --git a/app/code/Magento/Reports/view/frontend/layout/catalog_category_view_type_default_without_children.xml b/app/design/adminhtml/Magento/backend/web/bootstrap.js
similarity index 74%
rename from app/code/Magento/Reports/view/frontend/layout/catalog_category_view_type_default_without_children.xml
rename to app/design/adminhtml/Magento/backend/web/bootstrap.js
index fd22a20820262a19fffcfd751dadd1e935e80a79..bc9e638156fe6d124f6734fb389e881010d42675 100644
--- a/app/code/Magento/Reports/view/frontend/layout/catalog_category_view_type_default_without_children.xml
+++ b/app/design/adminhtml/Magento/backend/web/bootstrap.js
@@ -1,5 +1,3 @@
-<?xml version="1.0"?>
-<!--
 /**
  * Magento
  *
@@ -22,6 +20,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-</layout>
+require([
+    "jquery/jquery.tabs",
+    "js/theme",
+    "Magento_AdminNotification/system/notification",
+    "Magento_AdminNotification/toolbar_entry",    
+    "mage/dropdown_old",
+    "mage/backend/bootstrap",
+    "mage/adminhtml/form",
+    "mage/adminhtml/grid",
+    "Magento_Catalog/catalog/product",
+]);
diff --git a/app/design/adminhtml/Magento/backend/web/js/theme.js b/app/design/adminhtml/Magento/backend/web/js/theme.js
index 01d7ba7252d805787734bc34789e55c41172d13d..9839f7fe2b0822d2efc26193c353f0cf87a3b069 100644
--- a/app/design/adminhtml/Magento/backend/web/js/theme.js
+++ b/app/design/adminhtml/Magento/backend/web/js/theme.js
@@ -21,7 +21,15 @@
  * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-;(function($, document) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/hover-intent",
+    "jquery/jquery.details",
+    "jquery/jquery.tabs",
+    "mage/backend/floating-header",
+    "jquery/farbtastic"  // $(..).farbtastic()
+],function($) {
     'use strict';
 
     $.widget('mage.globalSearch', {
@@ -116,7 +124,7 @@
                      clearTimeout($(this).prop('hoverIntent_t'));
                     $(this).prop('hoverIntent_s', 0);
                     $(this).removeClass('recent hover');
-                })
+                });
 
             var targetSubmenu = $(e.target).closest('.submenu');
             if(targetSubmenu.length && targetSubmenu.is(':visible')) {
@@ -428,4 +436,4 @@
         $('details').details();
         switcherForIe8();
     });
-})(window.jQuery, document);
+});
diff --git a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml
index b238107f16f0cc384ad46c16f7d218c40e086849..7b503b96d50467842c34e050f63b9dc9fbab7bc0 100644
--- a/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml
+++ b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml
@@ -30,35 +30,5 @@
                 <argument name="file" xsi:type="string">css/styles.css</argument>
             </arguments>
         </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-jquery-dropdowns-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/dropdowns.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-terms">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/terms.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-matchmedia-js">
-            <arguments>
-                <argument name="file" xsi:type="string">matchMedia.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-responsive-js">
-            <arguments>
-                <argument name="file" xsi:type="string">js/responsive.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-navigation-menu-js">
-            <arguments>
-                <argument name="file" xsi:type="string">mage/menu.js</argument>
-            </arguments>
-        </block>
-        <block class="Magento\Theme\Block\Html\Head\Script" name="js-theme-js">
-            <arguments>
-                <argument name="file" xsi:type="string">js/theme.js</argument>
-            </arguments>
-        </block>
     </referenceBlock>
 </layout>
diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..629ed93f41a2f4ff41c67cca836426fc1c3239ac
--- /dev/null
+++ b/app/design/frontend/Magento/blank/composer.json
@@ -0,0 +1,19 @@
+{
+    "name": "magento/theme-frontend-blank",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-theme",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "frontend/Magento/blank"
+            ]
+        ]
+    }
+}
diff --git a/app/design/frontend/Magento/blank/theme.xml b/app/design/frontend/Magento/blank/theme.xml
index 5aaed7f208cb9523ae0e6a078720edd412d1e668..70c8d683829dade35ac07af0a43f3f182ad5856a 100644
--- a/app/design/frontend/Magento/blank/theme.xml
+++ b/app/design/frontend/Magento/blank/theme.xml
@@ -24,7 +24,7 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento Blank</title>
-    <version>0.1.0</version>
+    <version>0.1.0-alpha89</version>
     <media>
         <preview_image>media/preview.jpg</preview_image>
     </media>
diff --git a/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_grid.xml b/app/design/frontend/Magento/blank/web/bootstrap.js
similarity index 68%
rename from app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_grid.xml
rename to app/design/frontend/Magento/blank/web/bootstrap.js
index 82b6532684f19b9c9771821ac39f8644ceaab318..ab200e461797b7537bb85d3d635e5c37aa709580 100644
--- a/app/code/Magento/Connect/view/adminhtml/layout/adminhtml_extension_custom_grid.xml
+++ b/app/design/frontend/Magento/blank/web/bootstrap.js
@@ -1,5 +1,3 @@
-<?xml version="1.0"?>
-<!--
 /**
  * Magento
  *
@@ -22,9 +20,21 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
--->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <container name="root" label="Root" output="1">
-        <block class="Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab\Grid" name="connect_extension_edit_local_package_grid"/>
-    </container>
-</layout>
+require([
+    "jquery",
+    "jquery/jquery-migrate",
+    "jquery/jquery.mobile.custom",
+    "mage/jquery-no-conflict",
+    "js/responsive",
+    "mage/common",
+    "mage/dataPost",
+    "mage/dropdowns",
+    "js/theme",
+    "mage/terms",
+    "Magento_PageCache/js/form-key",
+    "Magento_PageCache/js/msg-box",
+    "Magento_Weee/tax-toggle",
+    "mage/bootstrap"
+],function(jQuery){
+    jQuery.migrateMute = true;
+});
\ No newline at end of file
diff --git a/app/design/frontend/Magento/blank/web/js/navigation-menu.js b/app/design/frontend/Magento/blank/web/js/navigation-menu.js
index 77bd5a7945ed05f8acb1f4657757f4fe0710c6bc..43028888f9959250052974c8b0ca588c111c76c3 100644
--- a/app/design/frontend/Magento/blank/web/js/navigation-menu.js
+++ b/app/design/frontend/Magento/blank/web/js/navigation-menu.js
@@ -22,7 +22,13 @@
  */
 /*jshint jquery:true*/
 
-(function($) {
+define([
+    "jquery",
+    "jquery/template",
+    "matchMedia",
+    "mage/dropdowns",
+    "mage/terms"
+],function($) {
     'use strict';
 
     $.widget('mage.navigationMenu', {
@@ -563,4 +569,4 @@
             }
         }
     });
-})(window.jQuery);
\ No newline at end of file
+});
diff --git a/app/design/frontend/Magento/blank/web/js/responsive.js b/app/design/frontend/Magento/blank/web/js/responsive.js
index fb7c54441cac4192bf5fcd402be7c2fb6f4262e4..2c16216b8fb26778206d6429615494de0204307b 100644
--- a/app/design/frontend/Magento/blank/web/js/responsive.js
+++ b/app/design/frontend/Magento/blank/web/js/responsive.js
@@ -21,11 +21,16 @@
  * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-;
-(function($) {
+define([
+    "jquery",
+    "matchMedia",
+    "mage/zoom",
+    "mage/gallery",
+    "mage/tabs"
+],function($) {
     'use strict';
 
-    $(document).ready(function(){
+    $(function(){
         mediaCheck({
             media: '(min-width: 768px)',
             // Switch to Desktop Version
@@ -92,4 +97,4 @@
 
         });
     });
-})(window.jQuery);
+});
diff --git a/app/design/frontend/Magento/blank/web/js/theme.js b/app/design/frontend/Magento/blank/web/js/theme.js
index d23207ae1ca5cd306ebd79275bd316d2e94e0488..8bd0083909d4963daa76b2ac884957b5519f74a2 100644
--- a/app/design/frontend/Magento/blank/web/js/theme.js
+++ b/app/design/frontend/Magento/blank/web/js/theme.js
@@ -20,13 +20,13 @@
  * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-;
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+],function($) {
     'use strict';
 
-    $(document).ready(function() {
-
+    $(function() {
         if ($('body').hasClass('checkout-cart-index')) {
             if ($('#co-shipping-method-form .fieldset.rates').length > 0 && $('#co-shipping-method-form .fieldset.rates :checked').length === 0 ) {
                 $("#block-shipping").on("collapsiblecreate" ,function() {
@@ -41,4 +41,4 @@
         }
     });
 
-})(window.jQuery);
+});
diff --git a/app/design/frontend/Magento/plushe/composer.json b/app/design/frontend/Magento/plushe/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..c4afa8135cecd9d730d247c142d434c3fc46bfd5
--- /dev/null
+++ b/app/design/frontend/Magento/plushe/composer.json
@@ -0,0 +1,20 @@
+{
+    "name": "magento/theme-frontend-plushe",
+    "description": "N/A",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "magento/theme-frontend-blank": "0.1.0-alpha89",
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-theme",
+    "version": "0.1.0-alpha89",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "frontend/Magento/plushe"
+            ]
+        ]
+    }
+}
diff --git a/app/design/frontend/Magento/plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml
index 8514bf3b331996e5ea9084b26f4b57d4b650976b..9608883c3430dc6aaf6fa53509076f5db27a2045 100644
--- a/app/design/frontend/Magento/plushe/theme.xml
+++ b/app/design/frontend/Magento/plushe/theme.xml
@@ -24,7 +24,7 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento Plushe</title>
-    <version>0.1.0</version>
+    <version>0.1.0-alpha89</version>
     <parent>Magento/blank</parent>
     <media>
         <preview_image>media/preview.jpg</preview_image>
diff --git a/app/design/install/Magento/basic/theme.xml b/app/design/install/Magento/basic/theme.xml
index fbb0258f6c08714df59ef6d701a84966989df635..29222ce975316922eb7b41cb4674b922f4fd690a 100644
--- a/app/design/install/Magento/basic/theme.xml
+++ b/app/design/install/Magento/basic/theme.xml
@@ -24,5 +24,5 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento Basic</title>
-    <version>0.1.0</version>
+    <version>0.1.0-alpha89</version>
 </theme>
diff --git a/app/design/install/Magento/basic/web/bootstrap.js b/app/design/install/Magento/basic/web/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..03eeff549bdb0da689c202e7c885747f23eab5d6
--- /dev/null
+++ b/app/design/install/Magento/basic/web/bootstrap.js
@@ -0,0 +1,29 @@
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+ require([
+    "jquery",
+    "jquery/jquery-migrate"
+ ], function(jQuery){
+    jQuery.migrateMute = true;
+ })
\ No newline at end of file
diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..369fff120500cda91586750b605c136c89839aa0
--- /dev/null
+++ b/app/i18n/magento/de_de/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-de_de",
+    "description": "German (Germany) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/de_de"
+            ]
+        ]
+    }
+}
diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..4de155f58c0e9d2f64037f313b7cdfa4d5c7e90b
--- /dev/null
+++ b/app/i18n/magento/en_us/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-en_us",
+    "description": "English (United States) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/en_us"
+            ]
+        ]
+    }
+}
diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..bffb5ff0a5693bbde44c37ed28cc3c7220eb77fa
--- /dev/null
+++ b/app/i18n/magento/es_es/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-es_es",
+    "description": "Spanish (Spain) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/es_es"
+            ]
+        ]
+    }
+}
diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..84b0844846783d46f3d8054e060d83a0819123cd
--- /dev/null
+++ b/app/i18n/magento/fr_fr/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-fr_fr",
+    "description": "French (France) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/fr_fr"
+            ]
+        ]
+    }
+}
diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..e7cf886210a4e0e4f32954c03f45992ba4e9ba87
--- /dev/null
+++ b/app/i18n/magento/nl_nl/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-nl_nl",
+    "description": "Dutch (Netherlands) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/nl_nl"
+            ]
+        ]
+    }
+}
diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..9c92457ab85b6566553c8481b827954dbd697fb6
--- /dev/null
+++ b/app/i18n/magento/pt_br/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-pt_br",
+    "description": "Portuguese (Brazil) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/pt_br"
+            ]
+        ]
+    }
+}
diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..493ff18be0ae8a7e42014aedb8f513f42f7463bb
--- /dev/null
+++ b/app/i18n/magento/zh_cn/composer.json
@@ -0,0 +1,18 @@
+{
+    "name": "magento/language-zh_cn",
+    "description": "Chinese (China) language",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "magento/framework": "0.1.0-alpha89",
+        "magento/magento-composer-installer": "*"
+    },
+    "type": "magento2-language",
+    "extra": {
+        "map": [
+            [
+                "*",
+                "magento/zh_cn"
+            ]
+        ]
+    }
+}
diff --git a/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php b/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php
index 76198d9674d088d82edf86dfe3b2a032f7b2dd45..73908d9b795d591ef4082e6fc7caf99d473f35eb 100755
--- a/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php
+++ b/dev/tests/functional/lib/Mtf/Constraint/AbstractAssertForm.php
@@ -109,7 +109,7 @@ abstract class AbstractAssertForm extends AbstractConstraint
 
         foreach ($data as $key => $value) {
             if (is_array($value)) {
-                $arrayValues[$key] = $this->dataSort($value);
+                $arrayValues[$key] = $this->sortData($value);
             } else {
                 $scalarValues[$key] = $value;
             }
@@ -181,10 +181,10 @@ abstract class AbstractAssertForm extends AbstractConstraint
 
         if ($key) {
             $data[$key] = $order ? $this->sortMultidimensionalArray($data[$key], $order) : $data[$key];
-            $data[$key] = $nextPath ? $this->sortData($data[$key], $nextPath) : $data[$key];
+            $data[$key] = $nextPath ? $this->sortDataByPath($data[$key], $nextPath) : $data[$key];
         } else {
             $data = $this->sortMultidimensionalArray($data, $order);
-            $data = $nextPath ? $this->sortData($data, $nextPath) : $data;
+            $data = $nextPath ? $this->sortDataByPath($data, $nextPath) : $data;
         }
 
         return $data;
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php
index c2c6e9fad223a2723f603957be8f478101488c4d..0a4f03536e7a10c020a04bda6e54cb4e61518423 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php
@@ -34,6 +34,7 @@ use Mtf\Client\Element\Locator;
  * Basic grid actions
  *
  * @SuppressWarnings(PHPMD.NumberOfChildren)
+ * @SuppressWarnings(PHPMD.TooManyFields)
  */
 abstract class Grid extends Block
 {
@@ -42,7 +43,7 @@ abstract class Grid extends Block
      *
      * @var array
      */
-    protected $filters = array();
+    protected $filters = [];
 
     /**
      * Locator value for 'Search' button
@@ -100,6 +101,13 @@ abstract class Grid extends Block
      */
     protected $massactionSelect = '[id*=massaction-select]';
 
+    /**
+     * Massaction dropdown
+     *
+     * @var string
+     */
+    protected $massactionAction = '#massaction-select';
+
     /**
      * Massaction 'Submit' button
      *
@@ -135,6 +143,13 @@ abstract class Grid extends Block
      */
     protected $waitForSelectorVisible = true;
 
+    /**
+     * Selector for status select
+     *
+     * @var string
+     */
+    protected $status = '[name="status"]';
+
     /**
      * Get backend abstract block
      *
@@ -247,34 +262,44 @@ abstract class Grid extends Block
     /**
      * Perform selected massaction over checked items
      *
-     * @param string $actionType
      * @param array $items
-     * @param bool $acceptAlert
+     * @param array|string $action
+     * @param bool $acceptAlert [optional]
+     * @param string $massActionSelection [optional]
+     * @return void
      */
-    protected function massaction($actionType, array $items = array(), $acceptAlert = false)
+    public function massaction(array $items, $action, $acceptAlert = false, $massActionSelection = '')
     {
-        if ($items) {
-            foreach ($items as $item) {
-                $this->searchAndSelect($item);
-            }
-        } else {
-            $this->_rootElement->find($this->selectAll, Locator::SELECTOR_CSS)->click();
+        if (!is_array($action)) {
+            $action = [$action => '-'];
+        }
+        foreach ($items as $item) {
+            $this->searchAndSelect($item);
+        }
+        if ($massActionSelection) {
+            $this->_rootElement->find($this->massactionAction, Locator::SELECTOR_CSS, 'select')
+                ->setValue($massActionSelection);
         }
+        $actionType = key($action);
         $this->_rootElement->find($this->massactionSelect, Locator::SELECTOR_CSS, 'select')->setValue($actionType);
-        $this->_rootElement->find($this->massactionSubmit, Locator::SELECTOR_CSS)->click();
-        if ($acceptAlert) {
-            $this->_rootElement->acceptAlert();
+        if (isset($action[$actionType]) && $action[$actionType] != '-') {
+            $this->_rootElement->find($this->status, Locator::SELECTOR_CSS, 'select')->setValue($action[$actionType]);
         }
+        $this->massActionSubmit($acceptAlert);
     }
 
     /**
-     * Delete selected items in grid
+     * Submit mass actions
      *
-     * @param array $items
+     * @param bool $acceptAlert
+     * @return void
      */
-    public function delete($items = array())
+    protected function massActionSubmit($acceptAlert)
     {
-        $this->massaction('Delete', $items, true);
+        $this->_rootElement->find($this->massactionSubmit, Locator::SELECTOR_CSS)->click();
+        if ($acceptAlert) {
+            $this->_rootElement->acceptAlert();
+        }
     }
 
     /**
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Handler/Conditions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Handler/Conditions.php
index bc1651bbea52e383ac035b82062bed0fe1072efd..11728a48657f2119b8f9d49f133729b170b66824 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/Handler/Conditions.php
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Handler/Conditions.php
@@ -70,6 +70,7 @@ abstract class Conditions extends Curl
             'is' => '==',
             'is not' => '!=',
             'equal to' => '==',
+            'matches' => '==',
         ],
         'value_type' => [
             'same_as' => 'the Same as Matched Product Categories',
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php
index b054a40a8a2b0ba514a7d0b5f8512cee629b1501..d92d5f7f1c91cfda0f750c8c9421f834d92a03a8 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/CatalogProductBundle/Price.php
@@ -181,7 +181,10 @@ class Price implements FixtureInterface
                 'cart_price' => '80.00'
             ],
             'default_fixed' => [
-                'compare_price' => '755.00'
+                'compare_price' => [
+                    'price_from' => '755.00',
+                    'price_to' => '756.00'
+                ],
             ],
             'default_dynamic' => [
                 'compare_price' => [
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php
index 4b628be44b590307fb82c8214b8a6714181da763..6733df818beb91fe7d1acd5bd34d14a10dfc06ac 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php
@@ -78,6 +78,6 @@ class Grid extends ParentGrid
      */
     public function updateAttributes(array $items = [])
     {
-        $this->massaction('Update Attributes', $items);
+        $this->massaction($items, 'Update Attributes');
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductGrid.php
index 3dd66b4c658bea2a146ff26dfdf664e02ab5e6ec..6f026ca74a90d86e8bdb9655c138e32db1317c0d 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductGrid.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Backend/ProductGrid.php
@@ -63,6 +63,6 @@ class ProductGrid extends Grid
      */
     public function updateAttributes(array $items = array())
     {
-        $this->massaction('Update Attributes', $items);
+        $this->massaction($items, 'Update Attributes');
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php
index 6b984e17225a0c183e6a3366215f6e1f1832f37b..4c91657e1a66da780b990d10bc73967a6cdbf086 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php
@@ -157,7 +157,7 @@ class View extends Block
      *
      * @var string
      */
-    protected $priceBlock = '.product-info-main .price-box';
+    protected $priceBlock = '//*[@class="product-info-main"]//*[contains(@class,"price-box")]';
 
     /**
      * 'Add to Compare' button
@@ -185,7 +185,10 @@ class View extends Block
      */
     protected function getPriceBlock()
     {
-        return Factory::getBlockFactory()->getMagentoCatalogProductPrice($this->_rootElement->find($this->priceBlock));
+        return $this->blockFactory->create(
+            'Magento\Catalog\Test\Block\Product\Price',
+            ['element' => $this->_rootElement->find($this->priceBlock, Locator::SELECTOR_XPATH)]
+        );
     }
 
     /**
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeInGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeInGrid.php
index eebd8dbfc5f57ae2641d61a966c9f49179123b36..39ee0e5e143883f231e62a974d51d69c8af750cc 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeInGrid.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeInGrid.php
@@ -25,9 +25,12 @@
 namespace Magento\Catalog\Test\Constraint;
 
 use Mtf\Constraint\AbstractConstraint;
+use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeIndex;
 
 /**
  * Class AssertProductAttributeInGrid
+ * Assert that created product attribute is found in grid
  */
 class AssertProductAttributeInGrid extends AbstractConstraint
 {
@@ -39,18 +42,29 @@ class AssertProductAttributeInGrid extends AbstractConstraint
     protected $severeness = 'low';
 
     /**
+     * Assert that created product attribute is found in grid
+     *
+     * @param CatalogProductAttribute $attribute
+     * @param CatalogProductAttributeIndex $attributeIndexPage
      * @return void
      */
-    public function processAssert()
+    public function processAssert(CatalogProductAttribute $attribute, CatalogProductAttributeIndex $attributeIndexPage)
     {
-        //
+        $attributeIndexPage->open();
+        $code = $attribute->getAttributeCode();
+        \PHPUnit_Framework_Assert::assertTrue(
+            $attributeIndexPage->getGrid()->isRowVisible(['attribute_code' => $code]),
+            'Attribute with attribute code "' . $code . '" is absent in attribute grid.'
+        );
     }
 
     /**
+     * Returns a string representation of the object
+     *
      * @return string
      */
     public function toString()
     {
-        //
+        return 'Product attribute is present in attribute grid.';
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCompareBlockOnCmsPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCompareBlockOnCmsPage.php
index 1ac1b0e824639b5cedece22fea2dd41c1deef35d..b5229b9b501025439b7f974326f01f95bc930ebd 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCompareBlockOnCmsPage.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCompareBlockOnCmsPage.php
@@ -53,7 +53,7 @@ class AssertProductCompareBlockOnCmsPage extends AbstractConstraint
      */
     public function processAssert(array $products, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory, Browser $browser)
     {
-        $newCmsPage = $fixtureFactory->createByCode('cmsPage', ['dataSet' => 'with_compare']);
+        $newCmsPage = $fixtureFactory->createByCode('cmsPage', ['dataSet' => '3_column_template']);
         $newCmsPage->persist();
         $browser->open($_ENV['app_frontend_url'] . $newCmsPage->getIdentifier());
         foreach ($products as &$product) {
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertUsedSuperAttributeImpossibleDeleteMessages.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertUsedSuperAttributeImpossibleDeleteMessages.php
new file mode 100644
index 0000000000000000000000000000000000000000..71887cf4439a0c5f6757dda89c4b130a9b825dbc
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertUsedSuperAttributeImpossibleDeleteMessages.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew;
+
+/**
+ * Class AssertUsedSuperAttributeImpossibilityDeleteMessages
+ * Assert that it's impossible to delete configurable attribute that is used in created configurable product
+ */
+class AssertUsedSuperAttributeImpossibleDeleteMessages extends AbstractConstraint
+{
+    /**
+     * Impossible to delete message
+     */
+    const ERROR_DELETE_MESSAGE = 'This attribute is used in configurable products.';
+
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that it's impossible to delete configurable attribute that is used in created configurable product
+     *
+     * @param CatalogProductAttributeNew $newPage
+     * @return void
+     */
+    public function processAssert(CatalogProductAttributeNew $newPage)
+    {
+        \PHPUnit_Framework_Assert::assertEquals(
+            self::ERROR_DELETE_MESSAGE,
+            $newPage->getMessagesBlock()->getErrorMessages(),
+            'Wrong impossible to delete message is not displayed.'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Error delete message is present while deleting assigned configurable attribute.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php
index f63463d550d29b3bb38d290fe3b75ccf24a4655f..c9de97be2d19a83bfccf00425f21519ffa537251 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php
@@ -60,6 +60,10 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface
             'Yes' => 1,
             'No' => 0
         ],
+        'use_config_manage_stock' => [
+            'Yes' => 1,
+            'No' => 0
+        ],
         'is_virtual' => [
             'Yes' => 1
         ],
@@ -180,9 +184,48 @@ class Curl extends AbstractCurl implements CatalogProductSimpleInterface
             $fields['attribute_set_id'] = $attributeSetId;
         }
 
+        $fields = $this->prepareStockData($fields);
+
         return $prefix ? [$prefix => $fields] : $fields;
     }
 
+    /**
+     * Preparation of stock data
+     *
+     * @param array $fields
+     * @return array
+     *
+     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+     * @SuppressWarnings(PHPMD.NPathComplexity)
+     */
+    protected function prepareStockData(array $fields)
+    {
+        if (isset($fields['quantity_and_stock_status']) && !is_array($fields['quantity_and_stock_status'])) {
+            $fields['quantity_and_stock_status'] = [
+                'qty' => $fields['qty'],
+                'is_in_stock' => $fields['quantity_and_stock_status']
+            ];
+        }
+
+        if (!isset($fields['stock_data']['is_in_stock'])) {
+            $fields['stock_data']['is_in_stock'] = isset($fields['quantity_and_stock_status']['is_in_stock'])
+                ? $fields['quantity_and_stock_status']['is_in_stock']
+                : (isset($fields['inventory_manage_stock']) ? $fields['inventory_manage_stock'] : null);
+        }
+        if (!isset($fields['stock_data']['qty'])) {
+            $fields['stock_data']['qty'] = isset($fields['quantity_and_stock_status']['qty'])
+                ? $fields['quantity_and_stock_status']['qty']
+                : null;
+        }
+
+        if (!isset($fields['stock_data']['manage_stock'])) {
+            $fields['stock_data']['manage_stock'] = (int)(!empty($fields['stock_data']['qty'])
+                || !empty($fields['stock_data']['is_in_stock']));
+        }
+
+        return $this->filter($fields);
+    }
+
     /**
      * Preparation of tier price data
      *
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php
index a70c9ab63f63f38f238f91c3a862e7e9dab64ba3..0018ecd16ad4dca7707aeb22fd768582c02503b9 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.php
@@ -35,6 +35,12 @@ class CatalogProductAttributeNew extends BackendPage
     const MCA = 'catalog/product_attribute/new';
 
     protected $_blocks = [
+        'messagesBlock' => [
+            'name' => 'messagesBlock',
+            'class' => 'Magento\Core\Test\Block\Messages',
+            'locator' => '#messages',
+            'strategy' => 'css selector',
+        ],
         'pageActions' => [
             'name' => 'pageActions',
             'class' => 'Magento\Backend\Test\Block\FormPageActions',
@@ -49,6 +55,14 @@ class CatalogProductAttributeNew extends BackendPage
         ],
     ];
 
+    /**
+     * @return \Magento\Core\Test\Block\Messages
+     */
+    public function getMessagesBlock()
+    {
+        return $this->getBlockInstance('messagesBlock');
+    }
+
     /**
      * @return \Magento\Backend\Test\Block\FormPageActions
      */
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml
index 7d9ab62e855a3f7c3a24ce183f2e97ef6b5d45d0..ca42ccf4f1f26ef1a249d086963d46f3a6f35bb4 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml
@@ -24,6 +24,12 @@
  */
 -->
 <page mca="catalog/product_attribute/new">
+    <block>
+        <name>messagesBlock</name>
+        <class>Magento\Core\Test\Block\Messages</class>
+        <locator>#messages</locator>
+        <strategy>css selector</strategy>
+    </block>
     <block>
         <name>pageActions</name>
         <class>Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\FormPageActions</class>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..d434beda7b641e7a53d5004ee3d20c0ed2aa393d
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.php
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Test\TestCase\ProductAttribute;
+
+use Mtf\TestCase\Injectable;
+use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeIndex;
+use Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable;
+
+/**
+ * Test Creation for Delete Used in Configurable ProductAttribute
+ *
+ * Test Flow:
+ *
+ * Precondition:
+ * 1. Configurable product is created.
+ *
+ * Steps:
+ * 1. Log in as default admin user.
+ * 2. Go to Stores > Attributes > Product.
+ * 3. Search product attribute in grid by given data.
+ * 4. Open this attribute by clicking.
+ * 5. Click on the "Delete Attribute" button.
+ * 6. Perform asserts.
+ *
+ * @group Product_Attributes_(MX)
+ * @ZephyrId MAGETWO-26652
+ */
+class DeleteUsedInConfigurableProductAttributeTest extends Injectable
+{
+    /**
+     * Catalog product attribute index page
+     *
+     * @var CatalogProductAttributeIndex
+     */
+    protected $attributeIndex;
+
+    /**
+     * Catalog product attribute new page
+     *
+     * @var CatalogProductAttributeNew
+     */
+    protected $attributeNew;
+
+    /**
+     * Injection data
+     *
+     * @param CatalogProductAttributeIndex $attributeIndex
+     * @param CatalogProductAttributeNew $attributeNew
+     * @return void
+     */
+    public function __inject(CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)
+    {
+        $this->attributeIndex = $attributeIndex;
+        $this->attributeNew = $attributeNew;
+    }
+
+    /**
+     * Run Delete used in configurable product attribute test
+     *
+     * @param CatalogProductConfigurable $product
+     * @return array
+     */
+    public function test(CatalogProductConfigurable $product)
+    {
+        // Precondition
+        $product->persist();
+        /** @var CatalogProductAttribute $attribute */
+        $attribute = $product->getConfigurableAttributesData()['attributes'][0];
+
+        // Steps
+        $this->attributeIndex->open();
+        $this->attributeIndex->getGrid()->searchAndOpen(['attribute_code' => $attribute->getAttributeCode()]);
+        $this->attributeNew->getPageActions()->delete();
+
+        return ['attribute' => $attribute];
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest/test.csv b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0641a3d880d3d3b5e32e32fc1947b9691985edf0
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest/test.csv
@@ -0,0 +1,2 @@
+"product/dataSet";"constraint"
+"default_one_variation";"assertUsedSuperAttributeImpossibleDeleteMessages, assertProductAttributeInGrid, assertConfigurableProductForm"
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/constraint.xml
index f4694337a906207d69b6a175435dd881e57c0f36..b709c5df439c1379af6f21c8d7e6d9046c0ac68f 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/constraint.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/global/constraint.xml
@@ -364,18 +364,6 @@
     <assertProductNotInGrid module="Magento_Catalog">
         <severeness>low</severeness>
     </assertProductNotInGrid>
-    <assertProductTemplateSuccessDeleteMessage module="Magento_Catalog">
-        <severeness>high</severeness>
-    </assertProductTemplateSuccessDeleteMessage>
-    <assertProductTemplateNotInGrid module="Magento_Catalog">
-        <severeness>low</severeness>
-    </assertProductTemplateNotInGrid>
-    <assertProductNotInGrid module="Magento_Catalog">
-        <severeness>low</severeness>
-    </assertProductNotInGrid>
-    <assertProductNotSearchableBySku module="Magento_Catalog">
-        <severeness>low</severeness>
-    </assertProductNotSearchableBySku>
     <assertProductCompareItemsLink module="Magento_Catalog">
         <severeness>low</severeness>
     </assertProductCompareItemsLink>
@@ -455,4 +443,19 @@
     <assertProductIsNotVisibleInCompareBlock module="Magento_Catalog">
         <severeness>low</severeness>
     </assertProductIsNotVisibleInCompareBlock>
+    <assertUsedSuperAttributeImpossibleDeleteMessages module="Magento_Catalog">
+        <severeness>high</severeness>
+        <require>
+            <newPage class="Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew" />
+        </require>
+    </assertUsedSuperAttributeImpossibleDeleteMessages>
+    <assertProductTemplateSuccessDeleteMessage module="Magento_Catalog">
+        <severeness>high</severeness>
+    </assertProductTemplateSuccessDeleteMessage>
+    <assertProductTemplateNotInGrid module="Magento_Catalog">
+        <severeness>low</severeness>
+    </assertProductTemplateNotInGrid>
+    <assertProductNotSearchableBySku module="Magento_Catalog">
+        <severeness>low</severeness>
+    </assertProductNotSearchableBySku>
 </constraint>
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchSynonymMassActionNotOnFrontend.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchSynonymMassActionNotOnFrontend.php
new file mode 100644
index 0000000000000000000000000000000000000000..1d5c526439dfb44c8faf5f24409765aadee85870
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchSynonymMassActionNotOnFrontend.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Client\Browser;
+use Magento\Cms\Test\Page\CmsIndex;
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+
+/**
+ * Class AssertSearchSynonymMassActionNotOnFrontend
+ * Assert that you will be not redirected to url from dataset after mass delete search term
+ */
+class AssertSearchSynonymMassActionNotOnFrontend extends AbstractConstraint
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that you will be not redirected to url from dataset after mass delete search term
+     *
+     * @param array $searchTerms
+     * @param CmsIndex $cmsIndex
+     * @param Browser $browser
+     * @param AssertSearchSynonymNotOnFrontend $assertSearchSynonymNotOnFrontend
+     * @return void
+     */
+    public function processAssert(
+        array $searchTerms,
+        CmsIndex $cmsIndex,
+        Browser $browser,
+        AssertSearchSynonymNotOnFrontend $assertSearchSynonymNotOnFrontend
+    ) {
+        foreach ($searchTerms as $term) {
+            $assertSearchSynonymNotOnFrontend->processAssert($cmsIndex, $browser, $term);
+        }
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'All search terms were successfully removed (redirect by the synonym was not performed).';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchSynonymNotOnFrontend.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchSynonymNotOnFrontend.php
new file mode 100644
index 0000000000000000000000000000000000000000..fa7182397bfcd7a1d5ce839d0982ca929565dc85
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchSynonymNotOnFrontend.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Client\Browser;
+use Magento\Cms\Test\Page\CmsIndex;
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+
+/**
+ * Class AssertSearchSynonymNotOnFrontend
+ * Assert that you will be not redirected to url from dataset
+ */
+class AssertSearchSynonymNotOnFrontend extends AbstractConstraint
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that you will be not redirected to url from dataset
+     *
+     * @param CmsIndex $cmsIndex
+     * @param CatalogSearchQuery $searchTerm
+     * @param Browser $browser
+     * @return void
+     */
+    public function processAssert(CmsIndex $cmsIndex, Browser $browser, CatalogSearchQuery $searchTerm)
+    {
+        $cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
+        \PHPUnit_Framework_Assert::assertNotEquals(
+            $browser->getUrl(),
+            $searchTerm->getRedirect(),
+            'Url in the browser corresponds to Url in fixture (redirect has been performed).'
+            . PHP_EOL . 'Search term: "' . $searchTerm->getQueryText() . '"'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Search term was successfully removed (redirect by the synonym was not performed).';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermInGrid.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermInGrid.php
index 51950166cb8e3bb982a46c328ddf0134adf10875..9fec91cdc4116f6f2a505f3535b255a2d901b106 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermInGrid.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermInGrid.php
@@ -71,7 +71,7 @@ class AssertSearchTermInGrid extends AbstractConstraint
         $grid->search($filters);
         unset($filters['store_id']);
         \PHPUnit_Framework_Assert::assertTrue(
-            $grid->isRowVisible($filters),
+            $grid->isRowVisible($filters, false),
             'Row terms according to the filters is not found.'
         );
     }
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermMassActionNotOnFrontend.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermMassActionNotOnFrontend.php
new file mode 100644
index 0000000000000000000000000000000000000000..928ae756166db114e6716283648e380ed1758790
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermMassActionNotOnFrontend.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Client\Browser;
+use Magento\Cms\Test\Page\CmsIndex;
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+
+/**
+ * Class AssertSearchTermMassActionNotOnFrontend
+ * Assert that after mass delete a search term not redirect to url in dataset
+ */
+class AssertSearchTermMassActionNotOnFrontend extends AbstractConstraint
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that after mass delete a search term not redirect to url in dataset
+     *
+     * @param array $searchTerms
+     * @param CmsIndex $cmsIndex
+     * @param Browser $browser
+     * @param AssertSearchTermNotOnFrontend $assertSearchTermNotOnFrontend
+     * @return void
+     */
+    public function processAssert(
+        array $searchTerms,
+        CmsIndex $cmsIndex,
+        Browser $browser,
+        AssertSearchTermNotOnFrontend $assertSearchTermNotOnFrontend
+    ) {
+        foreach ($searchTerms as $term) {
+            /** @var CatalogSearchQuery $term */
+            $assertSearchTermNotOnFrontend->processAssert($cmsIndex, $browser, $term);
+        }
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'All search terms were successfully removed (redirects to the specified URL was not performed).';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermMassActionsNotInGrid.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermMassActionsNotInGrid.php
new file mode 100644
index 0000000000000000000000000000000000000000..1164548df989e92b0383c22c4a86cd7d755b7f91
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermMassActionsNotInGrid.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
+
+/**
+ * Class AssertSearchTermMassActionsNotInGrid
+ * Assert that after mass delete search terms on grid page are not displayed
+ */
+class AssertSearchTermMassActionsNotInGrid extends AbstractConstraint
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that after mass delete search terms on grid page are not displayed
+     *
+     * @param array $searchTerms
+     * @param CatalogSearchIndex $indexPage
+     * @param AssertSearchTermNotInGrid $assertSearchTermNotInGrid
+     * @return void
+     */
+    public function processAssert(
+        array $searchTerms,
+        CatalogSearchIndex $indexPage,
+        AssertSearchTermNotInGrid $assertSearchTermNotInGrid
+    ) {
+        foreach ($searchTerms as $term) {
+            /** @var CatalogSearchQuery $term */
+            $assertSearchTermNotInGrid->processAssert($indexPage, $term);
+        }
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Search terms were not found in grid.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermNotInGrid.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermNotInGrid.php
new file mode 100644
index 0000000000000000000000000000000000000000..77c7c4476d4c7b1afcdf4992fc902597c39ad84a
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermNotInGrid.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
+
+/**
+ * Class AssertSearchTermNotInGrid
+ * Assert that after delete a search term on grid page not displayed
+ */
+class AssertSearchTermNotInGrid extends AbstractConstraint
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that after delete a search term on grid page not displayed
+     *
+     * @param CatalogSearchIndex $indexPage
+     * @param CatalogSearchQuery $searchTerm
+     * @return void
+     */
+    public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchQuery $searchTerm)
+    {
+        $queryText = $searchTerm->getQueryText();
+        $grid = $indexPage->open()->getGrid();
+        $filters = [
+            'search_query' => $queryText,
+            'store_id' => $searchTerm->getStoreId(),
+            'results_from' => $searchTerm->getNumResults(),
+            'popularity_from' => $searchTerm->getPopularity(),
+            'synonym_for' => $searchTerm->getSynonymFor(),
+            'redirect' => $searchTerm->getRedirect(),
+            'display_in_terms' => strtolower($searchTerm->getDisplayInTerms())
+        ];
+
+        $grid->search($filters);
+        unset($filters['store_id']);
+        \PHPUnit_Framework_Assert::assertFalse(
+            $grid->isRowVisible($filters, false),
+            'Search term "' . $queryText . '" was found in grid.'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Search term was not found in grid.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermNotOnFrontend.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermNotOnFrontend.php
new file mode 100644
index 0000000000000000000000000000000000000000..5aa900893ac14e8cb728e71ff462a2e1c44b42f7
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermNotOnFrontend.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Client\Browser;
+use Magento\Cms\Test\Page\CmsIndex;
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+
+/**
+ * Class AssertSearchTermNotOnFrontend
+ * Assert that after delete a search term not redirect to url in dataset
+ */
+class AssertSearchTermNotOnFrontend extends AbstractConstraint
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that after delete a search term not redirect to url in dataset
+     *
+     * @param CmsIndex $cmsIndex
+     * @param CatalogSearchQuery $searchTerm
+     * @param Browser $browser
+     * @return void
+     */
+    public function processAssert(CmsIndex $cmsIndex, Browser $browser, CatalogSearchQuery $searchTerm)
+    {
+        $queryText = $searchTerm->getQueryText();
+        $cmsIndex->open()->getSearchBlock()->search($queryText);
+        \PHPUnit_Framework_Assert::assertNotEquals(
+            $browser->getUrl(),
+            $searchTerm->getRedirect(),
+            'Url in the browser corresponds to Url in fixture (redirect has been performed).'
+            . PHP_EOL . 'Search term: "' . $queryText . '"'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Search term was successfully removed (redirects to the specified URL was not performed).';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermSuccessDeleteMessage.php
new file mode 100644
index 0000000000000000000000000000000000000000..12d6fc21a96d395549c7087da87eed29f058ba3c
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermSuccessDeleteMessage.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
+
+/**
+ * Class AssertSearchTermSuccessDeleteMessage
+ * Assert that success message is displayed after search term deleted
+ */
+class AssertSearchTermSuccessDeleteMessage extends AbstractConstraint
+{
+    /**
+     * Text value to be checked
+     */
+    const SUCCESS_DELETE_MESSAGE = 'You deleted the search.';
+
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that success message is displayed after search term deleted
+     *
+     * @param CatalogSearchIndex $indexPage
+     * @return void
+     */
+    public function processAssert(CatalogSearchIndex $indexPage)
+    {
+        $actualMessage = $indexPage->getMessagesBlock()->getSuccessMessages();
+        \PHPUnit_Framework_Assert::assertEquals(
+            self::SUCCESS_DELETE_MESSAGE,
+            $actualMessage,
+            'Wrong success message is displayed.'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Search term success delete message is present.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermSuccessMassDeleteMessage.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermSuccessMassDeleteMessage.php
new file mode 100644
index 0000000000000000000000000000000000000000..a8887ef76fe27310d102d075624374c1700fdeea
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertSearchTermSuccessMassDeleteMessage.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
+
+/**
+ * Class AssertSearchTermSuccessMassDeleteMessage
+ * Assert that success message is displayed after search terms were mass deleted
+ */
+class AssertSearchTermSuccessMassDeleteMessage extends AbstractConstraint
+{
+    /**
+     * Text value to be checked
+     */
+    const SUCCESS_MESSAGE = 'Total of %d record(s) were deleted';
+
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that success message is displayed after search terms were mass deleted
+     *
+     * @param array $searchTerms
+     * @param CatalogSearchIndex $indexPage
+     * @return void
+     */
+    public function processAssert(array $searchTerms, CatalogSearchIndex $indexPage)
+    {
+        $actualMessage = $indexPage->getMessagesBlock()->getSuccessMessages();
+        $successMessages = sprintf(self::SUCCESS_MESSAGE, count($searchTerms));
+        \PHPUnit_Framework_Assert::assertEquals(
+            $successMessages,
+            $actualMessage,
+            'Wrong success message is displayed.'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Search terms success delete message is present.';
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Backup/BackupException.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/CatalogSearchQueryInterface.php
similarity index 81%
rename from downloader/lib/Magento/Framework/Backup/BackupException.php
rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/CatalogSearchQueryInterface.php
index 040f15ab6fc69e798ec6dc846ed8beabb6d95c8c..7dd696fee0a1db1db29162736cd7cd029f1fb3b0 100644
--- a/downloader/lib/Magento/Framework/Backup/BackupException.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/CatalogSearchQueryInterface.php
@@ -22,13 +22,14 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\CatalogSearch\Test\Handler\CatalogSearchQuery;
+
+use Mtf\Handler\HandlerInterface;
+
 /**
- * \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Interface CatalogSearchQueryInterface
  */
-namespace Magento\Framework\Backup;
-
-class BackupException extends \Magento\Framework\Exception
+interface CatalogSearchQueryInterface extends HandlerInterface
 {
+    //
 }
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
new file mode 100644
index 0000000000000000000000000000000000000000..94b3ec11621c0fb58f0a09c13d9f34fb50ecd0a3
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\Handler\CatalogSearchQuery;
+
+use Mtf\System\Config;
+use Mtf\Fixture\FixtureInterface;
+use Mtf\Util\Protocol\CurlInterface;
+use Mtf\Util\Protocol\CurlTransport;
+use Mtf\Util\Protocol\CurlTransport\BackendDecorator;
+use Mtf\Handler\Curl as AbstractCurl;
+
+/**
+ * Class Curl
+ * Create new search term via curl
+ */
+class Curl extends AbstractCurl implements CatalogSearchQueryInterface
+{
+    /**
+     * Mapping values for data.
+     *
+     * @var array
+     */
+    protected $mappingData = [
+        'display_in_terms' => [
+            'No' => 0,
+        ],
+        'store_id' => [
+            'Main Website/Main Website Store/Default Store View' => 1
+        ]
+    ];
+
+    /**
+     * Post request for creating search term
+     *
+     * @param FixtureInterface $fixture|null [optional]
+     * @return array
+     * @throws \Exception
+     */
+    public function persist(FixtureInterface $fixture = null)
+    {
+        $data = $this->replaceMappingData($fixture->getData());
+        $this->addNewSearchTerm($data);
+
+        return ['id' => $this->getNewSearchTermId($data['query_text'])];
+    }
+
+    /**
+     * Add new search term
+     *
+     * @param array $data
+     */
+    protected function addNewSearchTerm(array $data)
+    {
+        $url = $_ENV['app_backend_url'] . 'catalog/search/save';
+        $curl = new BackendDecorator(new CurlTransport(), new Config);
+        $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
+        $curl->read();
+        $curl->close();
+    }
+
+    /**
+     * Getting search term id
+     *
+     * @param string $queryText
+     * @return int
+     * @throws \Exception
+     */
+    protected function getNewSearchTermId($queryText)
+    {
+        $filter = base64_encode('search_query=' . $queryText);
+        $url = $_ENV['app_backend_url'] . 'catalog/search/index/filter/' . $filter;
+        $curl = new BackendDecorator(new CurlTransport(), new Config);
+        $curl->write(CurlInterface::GET, $url, '1.0');
+        $response = $curl->read();
+        $curl->close();
+
+        if (!preg_match('#search/edit/id/(\d+)/"#', $response, $matches)) {
+            throw new \Exception('Search term not found in grid!');
+        }
+
+        return (int)$matches[1];
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php
index 65382917327be175741e637deb0c818b35447a84..d911edb43613a7e15fd392ea66abac4b2ef5f1ee 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.php
@@ -49,7 +49,7 @@ class CatalogSearchIndex extends BackendPage
         'messagesBlock' => [
             'name' => 'messagesBlock',
             'class' => 'Magento\Core\Test\Block\Messages',
-            'locator' => '.page-main-actions',
+            'locator' => '#messages',
             'strategy' => 'css selector',
         ],
     ];
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml
index a1edd489ab49dc4f94eec0cdf921014d85c96a9e..f7abfa96eb0685435c9852d8e798dfcc960bdb31 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml
@@ -39,7 +39,7 @@
     <block>
         <name>messagesBlock</name>
         <class>Magento\Core\Test\Block\Messages</class>
-        <locator>.page-main-actions</locator>
+        <locator>#messages</locator>
         <strategy>css selector</strategy>
     </block>
 </page>
diff --git a/downloader/lib/Magento/Framework/Backup/Nomedia.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Repository/CatalogSearchQuery.php
similarity index 55%
rename from downloader/lib/Magento/Framework/Backup/Nomedia.php
rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Repository/CatalogSearchQuery.php
index 804756b7b7cabd88c1c27699e25663bf0337c91e..af6f491ed5886eafe71f483a0e8455ddef13950f 100644
--- a/downloader/lib/Magento/Framework/Backup/Nomedia.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Repository/CatalogSearchQuery.php
@@ -22,35 +22,32 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
+namespace Magento\CatalogSearch\Test\Repository;
+
+use Mtf\Repository\AbstractRepository;
+
 /**
- * Class to work system backup that excludes media folder
- *
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Class CatalogSearchQuery
+ * Data for creation Search Term
  */
-namespace Magento\Framework\Backup;
-
-class Nomedia extends \Magento\Framework\Backup\Media
+class CatalogSearchQuery extends AbstractRepository
 {
     /**
-     * Overlap getType
+     * Construct
      *
-     * @return string
-     * @see \Magento\Framework\Backup\BackupInterface::getType()
-     */
-    public function getType()
-    {
-        return 'nomedia';
-    }
-
-    /**
-     * Add media folder to ignore list
+     * @param array $defaultConfig [optional]
+     * @param array $defaultData [optional]
      *
-     * @return \Magento\Framework\Backup\Media
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    protected function _prepareIgnoreList()
+    public function __construct(array $defaultConfig = [], array $defaultData = [])
     {
-        $rootDir = $this->getRootDir();
-        $this->addIgnorePaths(array($rootDir . '/media', $rootDir . '/pub/media'));
-        return $this;
+        $this->_data['default'] = [
+            'query_text' => ['value' => 'Query text %isolation%'],
+            'store_id' => 'Main Website/Main Website Store/Default Store View',
+            'synonym_for' => 'Synonym word %isolation%',
+            'redirect' => 'http://example.com/',
+            'display_in_terms' => 'No'
+        ];
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php
index bf3c3b0703beab9a11ad727ecd363dce0a8d5d80..05e7f3cd59386a17f8b04bf200e2714018060920 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php
@@ -45,7 +45,7 @@ use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
  * 7. Save the Search Term
  * 8. Perform all assertions
  *
- * @group Search Terms (MX)
+ * @group Search_Terms_(MX)
  * @ZephyrId MAGETWO-26165
  */
 class CreateSearchTermEntityTest extends Injectable
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..ea0032023fe8ed6f402a1f7d638de993c0697084
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\TestCase;
+
+use Mtf\TestCase\Injectable;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchEdit;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
+
+/**
+ * Test Creation for DeleteSearchTermEntity
+ *
+ * Test Flow:
+ *
+ * Preconditions:
+ * 1. Product is created
+ *
+ * Steps:
+ * 1. Go to backend as admin user
+ * 2. Navigate to Marketing>SEO & Search>Search
+ * 3. Search and open Search Term by "Search Query"
+ * 4. Click "Delete Search" button
+ * 5. Perform all assertions
+ *
+ * @group Search_Terms_(MX)
+ * @ZephyrId MAGETWO-26491
+ */
+class DeleteSearchTermEntityTest extends Injectable
+{
+    /**
+     * Search term page
+     *
+     * @var CatalogSearchIndex
+     */
+    protected $indexPage;
+
+    /**
+     * Search term edit page
+     *
+     * @var CatalogSearchEdit
+     */
+    protected $editPage;
+
+    /**
+     * Inject pages
+     *
+     * @param CatalogSearchIndex $indexPage
+     * @param CatalogSearchEdit $editPage
+     * @return void
+     */
+    public function __inject(CatalogSearchIndex $indexPage, CatalogSearchEdit $editPage)
+    {
+        $this->indexPage = $indexPage;
+        $this->editPage = $editPage;
+    }
+
+    /**
+     * Run delete search term entity test
+     *
+     * @param CatalogSearchQuery $searchTerm
+     * @return void
+     */
+    public function test(CatalogSearchQuery $searchTerm)
+    {
+        // Preconditions
+        $searchTerm->persist();
+        $searchText = $searchTerm->getQueryText();
+        // Steps
+        $this->indexPage->open();
+        $this->indexPage->getGrid()->searchAndOpen(['search_query' => $searchText]);
+        $this->editPage->getFormPageActions()->delete();
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..21e837989df15edefe9ca39d0ac3445187ed0022
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/DeleteSearchTermEntityTest/test.csv
@@ -0,0 +1,2 @@
+"searchTerm/dataSet";"constraint"
+"default";"assertSearchTermSuccessDeleteMessage, assertSearchTermNotInGrid, assertSearchTermNotOnFrontend, assertSearchSynonymNotOnFrontend"
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php
index e7beddab532a7574f8d873943c42157e235cfce7..630d557ed7cb9b1ddb65c71cc4a5d3f5778643f4 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php
@@ -48,7 +48,7 @@ use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
  * 7. Save the Search Term
  * 8. Perform all assertions
  *
- * @group Search Terms (MX)
+ * @group Search_Terms_(MX)
  * @ZephyrId MAGETWO-26100
  */
 class EditSearchTermEntityTest extends Injectable
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
index c6941e465c76df0ca1bbebdf41f6eb5910c7fddc..28764fb922a2796f412131a71be1b6ff47881f7b 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
@@ -1,2 +1,2 @@
 "searchTerm/data/query_text/value";"searchTerm/data/store_id";"searchTerm/data/num_results";"searchTerm/data/popularity";"searchTerm/data/synonym_for";"searchTerm/data/redirect";"searchTerm/data/display_in_terms";"constraint"
-"catalogProductSimple::getSku";"Main Website/Main Website Store/Default Store View";1;20;"simple";"http://example.com/";"No";"assertSearchTermForm, assertSearchTermInGrid, assertSearchTermOnFrontend"
+"catalogProductSimple::getSku";"Main Website/Main Website Store/Default Store View";1;20;"simple";"http://example.com/";"No";"assertSearchTermSuccessSaveMessage, assertSearchTermForm, assertSearchTermInGrid, assertSearchTermOnFrontend"
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..f3c2ac35fb811a422e603e9f55f15852f492e51b
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogSearch\Test\TestCase;
+
+use Mtf\TestCase\Injectable;
+use Mtf\Fixture\FixtureFactory;
+use Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery;
+use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
+
+/**
+ * Test Creation for MassDeleteSearchTermEntity
+ *
+ * Test Flow:
+ *
+ * Preconditions:
+ * 1. Search terms is created
+ *
+ * Steps:
+ * 1. Go to backend as admin user
+ * 2. Navigate to Marketing>SEO & Search>Search
+ * 3. Select search terms created in preconditions
+ * 4. Select delete from mass-action
+ * 5. Submit form
+ * 6. Perform all assertions
+ *
+ * @group Search_Terms_(MX)
+ * @ZephyrId MAGETWO-26599
+ */
+class MassDeleteSearchTermEntityTest extends Injectable
+{
+    /**
+     * Search term page
+     *
+     * @var CatalogSearchIndex
+     */
+    protected $indexPage;
+
+    /**
+     * Inject page
+     *
+     * @param CatalogSearchIndex $indexPage
+     * @return void
+     */
+    public function __inject(CatalogSearchIndex $indexPage)
+    {
+        $this->indexPage = $indexPage;
+    }
+
+    /**
+     * Run mass delete search term entity test
+     *
+     * @param string $searchTerms
+     * @param FixtureFactory $fixtureFactory
+     * @return array
+     */
+    public function test($searchTerms, FixtureFactory $fixtureFactory)
+    {
+        // Preconditions
+        $result = [];
+        $deleteSearchTerms = [];
+        $searchTerms = array_map('trim', explode(',', $searchTerms));
+        foreach ($searchTerms as $term) {
+            list($fixture, $dataSet) = explode('::', $term);
+            $term = $fixtureFactory->createByCode($fixture, ['dataSet' => $dataSet]);
+            /** @var CatalogSearchQuery $term */
+            $term->persist();
+            $deleteSearchTerms[] = ['search_query' => $term->getQueryText()];
+            $result['searchTerms'][] = $term;
+        }
+
+        // Steps
+        $this->indexPage->open();
+        $this->indexPage->getGrid()->massaction($deleteSearchTerms, 'Delete', true);
+
+        return $result;
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..40691a794424f137bb931c570ee3f43e6ee8ec87
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/MassDeleteSearchTermEntityTest/test.csv
@@ -0,0 +1,2 @@
+"searchTerms";"constraint"
+"catalogSearchQuery::default,catalogSearchQuery::default,catalogSearchQuery::default";"assertSearchTermSuccessMassDeleteMessage, assertSearchTermMassActionsNotInGrid, assertSearchTermMassActionNotOnFrontend, assertSearchSynonymMassActionNotOnFrontend"
diff --git a/app/code/Magento/Connect/etc/adminhtml/routes.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/curl/di.xml
similarity index 75%
rename from app/code/Magento/Connect/etc/adminhtml/routes.xml
rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/curl/di.xml
index 7d850cdb949d1feb9bcfadc7c97c81217de0bc7e..3642ead873319427fc75769873e034b0707992fe 100644
--- a/app/code/Magento/Connect/etc/adminhtml/routes.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/curl/di.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" ?>
 <!--
 /**
  * Magento
@@ -23,10 +23,6 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
-    <router id="admin">
-        <route id="adminhtml">
-            <module name="Magento_Connect" before="Magento_Adminhtml" />
-        </route>
-    </router>
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
+    <preference for="Magento\CatalogSearch\Test\Handler\CatalogSearchQuery\CatalogSearchQueryInterface" type="\Magento\CatalogSearch\Test\Handler\CatalogSearchQuery\Curl" />
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/constraint.xml
index dbe33dd650d840b1b547d5e3cddb6cecf31910c0..aba16be28cba2682c185858fe7d4607244e9450c 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/constraint.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/global/constraint.xml
@@ -58,7 +58,6 @@
         <severeness>high</severeness>
         <require>
             <indexPage class="Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex" />
-            <editPage class="Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchEdit" />
             <searchTerm class="Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery" />
         </require>
     </assertSearchTermInGrid>
@@ -84,4 +83,59 @@
             <browser class="Mtf\Client\Browser" />
         </require>
     </assertSearchTermSynonymOnFrontend>
+    <assertSearchTermSuccessDeleteMessage module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <indexPage class="Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex" />
+        </require>
+    </assertSearchTermSuccessDeleteMessage>
+    <assertSearchTermNotInGrid module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <indexPage class="Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex" />
+            <searchTerm class="Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery" />
+        </require>
+    </assertSearchTermNotInGrid>
+    <assertSearchTermNotOnFrontend module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <searchTerm class="Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery" />
+            <cmsIndex class="Magento\Cms\Test\Page\CmsIndex" />
+            <browser class="Mtf\Client\Browser" />
+        </require>
+    </assertSearchTermNotOnFrontend>
+    <assertSearchSynonymNotOnFrontend module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <searchTerm class="Magento\CatalogSearch\Test\Fixture\CatalogSearchQuery" />
+            <cmsIndex class="Magento\Cms\Test\Page\CmsIndex" />
+            <browser class="Mtf\Client\Browser" />
+        </require>
+    </assertSearchSynonymNotOnFrontend>
+    <assertSearchTermSuccessMassDeleteMessage module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <indexPage class="Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex" />
+        </require>
+    </assertSearchTermSuccessMassDeleteMessage>
+    <assertSearchTermMassActionsNotInGrid module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <indexPage class="Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex" />
+        </require>
+    </assertSearchTermMassActionsNotInGrid>
+    <assertSearchTermMassActionNotOnFrontend module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <cmsIndex class="Magento\Cms\Test\Page\CmsIndex" />
+            <browser class="Mtf\Client\Browser" />
+        </require>
+    </assertSearchTermMassActionNotOnFrontend>
+    <assertSearchSynonymMassActionNotOnFrontend module="Magento_CatalogSearch">
+        <severeness>high</severeness>
+        <require>
+            <cmsIndex class="Magento\Cms\Test\Page\CmsIndex" />
+            <browser class="Mtf\Client\Browser" />
+        </require>
+    </assertSearchSynonymMassActionNotOnFrontend>
 </constraint>
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php
index 077fd260ce1dee83644238848c0c3fdfcec3cf6a..670f92cb6f60341a9c06b6c44daf74d555d5ecbf 100644
--- a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php
@@ -67,7 +67,7 @@ class Curl extends Conditions implements CmsPageInterface
      *
      * @var string
      */
-    protected $url = 'admin/cms_page/save/back/edit/active_tab/main_section/';
+    protected $url = 'admin/cms_page/save/active_tab/main_section/';
 
     /**
      * Post request for creating a cms page
@@ -79,21 +79,32 @@ class Curl extends Conditions implements CmsPageInterface
     public function persist(FixtureInterface $fixture = null)
     {
         $url = $_ENV['app_backend_url'] . $this->url;
-        $data = $this->replaceMappingData($fixture->getData());
-        $data['stores'] = [$data['store_id']];
-        unset($data['store_id']);
-        $curl = new BackendDecorator(new CurlTransport(), new Config);
+        $data = $this->prepareData($this->replaceMappingData($fixture->getData()));
+        $curl = new BackendDecorator(new CurlTransport(), new Config());
         $curl->addOption(CURLOPT_HEADER, 1);
         $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
         $response = $curl->read();
         $curl->close();
-
         if (!strpos($response, 'data-ui-id="messages-message-success"')) {
             throw new \Exception("Cms page entity creating by curl handler was not successful! Response: $response");
         }
-
         preg_match("~page_id\/(\d*?)\/~", $response, $matches);
         $id = isset($matches[1]) ? $matches[1] : null;
+
         return ['page_id' => $id];
     }
+
+    /**
+     * Prepare data
+     *
+     * @param array $data
+     * @return array
+     */
+    protected function prepareData(array $data)
+    {
+        $data['stores'] = [$data['store_id']];
+        unset($data['store_id']);
+        $data['content'] = $data['content']['content'];
+        return $data;
+    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php
index 934ef479b7109f8213fb4344305de916c962be02..fb88f79d8b916e4d22e2d6e307c91d29e6134e10 100644
--- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php
@@ -88,6 +88,12 @@ class CmsIndex extends FrontendPage
             'locator' => '#maincontent',
             'strategy' => 'css selector',
         ],
+        'currencyBlock' => [
+            'name' => 'currencyBlock',
+            'class' => 'Magento\Directory\Test\Block\Currency\Switcher',
+            'locator' => '.switcher.currency',
+            'strategy' => 'css selector',
+        ],
     ];
 
     /**
@@ -153,6 +159,7 @@ class CmsIndex extends FrontendPage
     {
         return $this->getBlockInstance('compareProductsBlock');
     }
+
     /**
      * @return \Magento\Cms\Test\Block\Page
      */
@@ -160,4 +167,12 @@ class CmsIndex extends FrontendPage
     {
         return $this->getBlockInstance('mainContentBlock');
     }
+
+    /**
+     * @return \Magento\Directory\Test\Block\Currency\Switcher
+     */
+    public function getCurrencyBlock()
+    {
+        return $this->getBlockInstance('currencyBlock');
+    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
index 57462d1fde391df156ce03d5929ed350c928481a..bab5c732db6c0bc0dcb4b2d3acd67a67de475806 100644
--- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
@@ -72,4 +72,10 @@
         <locator>.sidebar.sidebar-additional</locator>
         <strategy>css selector</strategy>
     </block>
+    <block>
+        <name>currencyBlock</name>
+        <class>Magento\Directory\Test\Block\Currency\Switcher</class>
+        <locator>.switcher.currency</locator>
+        <strategy>css selector</strategy>
+    </block>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Options.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Options.xml
index 05c31e62d000cfcd3014e7097e8086b1b2509d66..94b0ab23542ab04a29f02890e8a6b46ae9d6d522 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Options.xml
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Options.xml
@@ -29,7 +29,7 @@
             <selector>[name$='[pricing_value]']</selector>
         </pricing_value>
         <include>
-            <selector>[name$='[include]']</selector>
+            <selector>[type="checkbox"][name$='[include]']</selector>
             <input>checkbox</input>
         </include>
     </fields>
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
new file mode 100644
index 0000000000000000000000000000000000000000..d7320695a13320571d784012073180f5e9321b03
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
@@ -0,0 +1,122 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\ConfigurableProduct\Test\Constraint;
+
+use Mtf\Fixture\FixtureInterface;
+use Magento\Catalog\Test\Constraint\AssertProductForm;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
+use Magento\ConfigurableProduct\Test\Page\Adminhtml\CatalogProductEdit;
+
+/**
+ * Class AssertConfigurableProductForm
+ * Assert that displayed product data on edit page equals passed from fixture
+ */
+class AssertConfigurableProductForm extends AssertProductForm
+{
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that displayed product data on edit page equals passed from fixture
+     *
+     * @param FixtureInterface $product
+     * @param CatalogProductIndex $productGrid
+     * @param CatalogProductEdit $productPage
+     * @return void
+     */
+    public function processAssert(
+        FixtureInterface $product,
+        CatalogProductIndex $productGrid,
+        CatalogProductEdit $productPage
+    ) {
+        $productGrid->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
+
+        $form = $productPage->getForm();
+        $formData = $form->getData($product);
+        foreach (array_keys($formData['configurable_attributes_data']['matrix']) as $key) {
+            unset($formData['configurable_attributes_data']['matrix'][$key]['price']);
+        }
+
+        $fixtureData = $this->prepareFixtureData($product->getData());
+        $attributes = $fixtureData['configurable_attributes_data']['attributes_data'];
+        $matrix = $fixtureData['configurable_attributes_data']['matrix'];
+        unset($fixtureData['configurable_attributes_data'], $fixtureData['id']);
+
+        $fixtureData['configurable_attributes_data']['attributes_data'] = $this->prepareAttributes($attributes);
+        $fixtureData['configurable_attributes_data']['matrix'] = $this->prepareMatrix($matrix);
+
+        $errors = $this->verifyData($fixtureData, $formData);
+        \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
+    }
+
+    /**
+     * Preparing data attributes fixture
+     *
+     * @param array $fixtureAttribute
+     * @return array
+     */
+    protected function prepareAttributes(array $fixtureAttribute)
+    {
+        foreach ($fixtureAttribute as &$attribute) {
+            unset($attribute['id'], $attribute['label'], $attribute['code']);
+            foreach ($attribute['options'] as &$option) {
+                $option['pricing_value'] = number_format($option['pricing_value'], 4);
+                unset($option['id']);
+            }
+        }
+
+        return $fixtureAttribute;
+    }
+
+    /**
+     * Preparing data matrix fixture
+     *
+     * @param array $fixtureMatrix
+     * @return array
+     */
+    protected function prepareMatrix(array $fixtureMatrix)
+    {
+        foreach ($fixtureMatrix as &$matrix) {
+            $matrix['display'] = 'Yes';
+            unset($matrix['configurable_attribute'], $matrix['associated_product_ids']);
+        }
+
+        return $fixtureMatrix;
+    }
+
+    /**
+     * Returns a string representation of the object
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Form data equal the configurable product data.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php
index db8340d3116829bba22fa20da4d28c28e506174a..540fb18b09dafc92769d3c9eea91cca9c98f1732 100755
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertProductAttributeIsConfigurable.php
@@ -77,7 +77,7 @@ class AssertProductAttributeIsConfigurable extends AbstractConstraint
                 'dataSet' => 'default',
                 'data' => [
                     'configurable_attributes_data' => [
-                        'preset' => 'one_variations',
+                        'preset' => 'one_variation',
                         'attributes' => [
                             $this->attribute
                         ]
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable/ConfigurableAttributesData.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable/ConfigurableAttributesData.php
index bbcc25bee46541bc73b0d382e1cd78693d7591a6..f3914dfe8b3608170389f96adab6d1861614346b 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable/ConfigurableAttributesData.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/CatalogProductConfigurable/ConfigurableAttributesData.php
@@ -533,7 +533,7 @@ class ConfigurableAttributesData implements FixtureInterface
                     ]
                 ]
             ],
-            'one_variations' => [
+            'one_variation' => [
                 'attributes_data' => [
                     [
                         'id' => '%id%',
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/CatalogProductConfigurable.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/CatalogProductConfigurable.php
index b1d345f0c632c4a6e7cb0d64072996a093f6b5ab..b7a8498137d9cccfed669a534ccf2d8c3de57f2b 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/CatalogProductConfigurable.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/CatalogProductConfigurable.php
@@ -58,5 +58,22 @@ class CatalogProductConfigurable extends AbstractRepository
             'website_ids' => ['Main Website'],
             'attribute_set_id' => ['dataSet' => 'default'],
         ];
+
+        $this->_data['default_one_variation'] = [
+            'name' => 'Test configurable product %isolation%',
+            'sku' => 'sku_test_configurable_product_%isolation%',
+            'price' => ['value' => 120.00],
+            'weight' => 30.0000,
+            'status' => 'Product online',
+            'visibility' => 'Catalog, Search',
+            'tax_class_id' => ['dataSet' => 'Taxable Goods'],
+            'url_key' => 'test-configurable-product-%isolation%',
+            'configurable_attributes_data' => ['preset' => 'one_variation'],
+            'quantity_and_stock_status' => [
+                'is_in_stock' => 'In Stock',
+            ],
+            'website_ids' => ['Main Website'],
+            'attribute_set_id' => ['dataSet' => 'default'],
+        ];
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/constraint.xml
index c480d4f9194f825ee349754c8601fff750b633ba..242fa89249052907126ed777349fe6eb4a0b25e8 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/constraint.xml
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/etc/global/constraint.xml
@@ -71,4 +71,12 @@
             <product class="Mtf\Fixture\FixtureInterface" />
         </require>
     </assertProductConfigurableDuplicateForm>
+    <assertConfigurableProductForm module="Magento_ConfigurableProduct">
+        <severeness>high</severeness>
+        <require>
+            <productGrid class="Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex" />
+            <productPage class="Magento\ConfigurableProduct\Test\Page\Adminhtml\CatalogProductEdit" />
+            <product class="Mtf\Fixture\FixtureInterface" />
+        </require>
+    </assertConfigurableProductForm>
 </constraint>
diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/constraint.xml
old mode 100644
new mode 100755
index 723b85002f691a2e16af3d56dfe863bee6fca1f9..2beb36c540465eb881f727fadbc352ba83f9fa47
--- a/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/constraint.xml
+++ b/dev/tests/functional/tests/app/Magento/Core/Test/etc/global/constraint.xml
@@ -39,9 +39,6 @@
     <assertCustomVariableInGrid module="Magento_Core">
         <severeness>low</severeness>
     </assertCustomVariableInGrid>
-    <assertCustomVariableInPageStoreview module="Magento_Core">
-        <severeness>low</severeness>
-    </assertCustomVariableInPageStoreview>
     <assertCustomVariableNotInCmsPageForm module="Magento_Core">
         <severeness>low</severeness>
     </assertCustomVariableNotInCmsPageForm>
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php
index 1ba74da67453a686fcaf7632cd7f1a64d35d31a2..060586f3d12f965de5842546e46a6a807202e8f4 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php
@@ -38,7 +38,7 @@ class AddressesDefault extends Block
      *
      * @var string
      */
-    protected $changeBillingAddressSelector = '.box.address.billing .subtitle a';
+    protected $changeBillingAddressSelector = '.box-address-billing a';
 
     /**
      * Click on address book menu item
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.xml
index 0dad9cbefbe0de6260968a7864d53eedcb502487..d66a07bdd7a816252b19a56e4c58cca55442ff23 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.xml
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.xml
@@ -87,5 +87,13 @@
             <selector>#address_form_container [aria-hidden="false"] [name^="address"][name$="[vat_id]"]</selector>
             <strategy>css selector</strategy>
         </vat_id>
+        <default_billing>
+            <selector>#address_list [aria-selected="true"] [name^="account"][name$="[default_billing]"]</selector>
+            <input>checkbox</input>
+        </default_billing>
+        <default_shipping>
+            <selector>#address_list [aria-selected="true"] [name^="account"][name$="[default_shipping]"]</selector>
+            <input>checkbox</input>
+        </default_shipping>
     </fields>
 </mapping>
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.php
index 2186040256bb2a0c8de4b258ea3f0c017ecbc96d..32fe5165259910e63f69de7fa7d4eb3677d244d0 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.php
@@ -64,6 +64,22 @@ class AddressInjectable extends InjectableFixture
         'input' => 'text',
     ];
 
+    protected $default_billing = [
+        'attribute_code' => 'default_billing',
+        'backend_type' => 'varchar',
+        'is_required' => '1',
+        'default_value' => '',
+        'input' => 'checkbox',
+    ];
+
+    protected $default_shipping = [
+        'attribute_code' => 'default_shipping',
+        'backend_type' => 'varchar',
+        'is_required' => '1',
+        'default_value' => '',
+        'input' => 'checkbox',
+    ];
+
     protected $company = [
         'attribute_code' => 'company',
         'backend_type' => 'varchar',
@@ -213,6 +229,16 @@ class AddressInjectable extends InjectableFixture
         return $this->getData('city');
     }
 
+    public function getDefaultShipping()
+    {
+        return $this->getData('default_shipping');
+    }
+
+    public function getDefaultBilling()
+    {
+        return $this->getData('default_billing');
+    }
+
     public function getCompany()
     {
         return $this->getData('company');
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml
index 7ada27bda81827ef969c694f67e72e56a4a7be03..3ec12ccf222c5c0e42cedf18a9fd9fd4252546ff 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/AddressInjectable.xml
@@ -162,6 +162,20 @@
             <default_value></default_value>
             <input>text</input>
         </vat_request_success>
+        <default_billing>
+            <attribute_code>default_billing</attribute_code>
+            <backend_type>int</backend_type>
+            <is_required>0</is_required>
+            <default_value></default_value>
+            <input>checkbox</input>
+        </default_billing>
+        <default_shipping>
+            <attribute_code>default_shipping</attribute_code>
+            <backend_type>int</backend_type>
+            <is_required>0</is_required>
+            <default_value></default_value>
+            <input>checkbox</input>
+        </default_shipping>
     </fields>
     <repository_class>Magento\Customer\Test\Repository\AddressInjectable</repository_class>
     <handler_interface>Magento\Customer\Test\Handler\AddressInjectable\AddressInjectableInterface</handler_interface>
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.php
index 9ce23bf3c5fa426086b4f83a0f34ebf79e22c022..8487b1605c533d578a1e4701421ebfe3c65a412a 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.php
@@ -28,9 +28,15 @@ use Mtf\Fixture\InjectableFixture;
 
 /**
  * Class CustomerGroupInjectable
+ * CustomerGroupInjectable fixture
  */
 class CustomerGroupInjectable extends InjectableFixture
 {
+    /**
+     * @var string
+     */
+    protected $repositoryClass = 'Magento\Customer\Test\Repository\CustomerGroupInjectable';
+
     /**
      * @var string
      */
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.xml
index cbfd09e31bb4a3f4966686fadd93fd40adeba38b..89d06afff2a810a458146adb4f90c59327d36fd8 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.xml
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/CustomerGroupInjectable.xml
@@ -48,4 +48,6 @@
             <backend_type>virtual</backend_type>
         </customer_group_id>
     </fields>
+    <repository_class>Magento\Customer\Test\Repository\CustomerGroupInjectable</repository_class>
+    <handler_interface>Magento\Customer\Test\Handler\CustomerGroupInjectable\CustomerGroupInjectableInterface</handler_interface>
 </fixture>
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/RemoveCustomerGroup.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/RemoveCustomerGroup.php
index 7ae7cba71c6effcb667e2e2bd0f048f25f4c68cb..e8c476e5edd0b3a5e3dce837b1f1bd0c8b0174db 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/RemoveCustomerGroup.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Curl/RemoveCustomerGroup.php
@@ -31,6 +31,10 @@ use Mtf\Util\Protocol\CurlInterface;
 use Mtf\Util\Protocol\CurlTransport\BackendDecorator;
 use Mtf\System\Config;
 
+/**
+ * Class RemoveCustomerGroup
+ * Curl handler for remove customer group
+ */
 class RemoveCustomerGroup extends Curl
 {
     /**
@@ -48,14 +52,14 @@ class RemoveCustomerGroup extends Curl
      */
     public function persist(FixtureInterface $fixture = null)
     {
-        /** @var \Magento\Customer\Test\Fixture\VatGroup $fixture*/
+        /** @var \Magento\Customer\Test\Fixture\VatGroup $fixture */
         $groups = $fixture->getGroupsIds();
         $curl = new BackendDecorator(new CurlTransport(), new Config);
         $curl->addOption(CURLOPT_HEADER, 1);
         $response = '';
         foreach ($groups as $groupId) {
             $url = sprintf($_ENV['app_backend_url'] . $this->deleteUrl, $groupId);
-            $curl->write(CurlInterface::GET, $url, '1.0', array());
+            $curl->write(CurlInterface::GET, $url, '1.0', []);
             $response = $curl->read();
         }
         $curl->close();
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php
index a09398a43b73ee4e7079797ef09b7b3d7711b682..27d010103aa080073dbf2d64b0c94b239606e9e4 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php
@@ -29,6 +29,10 @@ use Mtf\Page\Page;
 use Mtf\Factory\Factory;
 use Mtf\Client\Element\Locator;
 
+/**
+ * Class DefaultAddress
+ * Default address page
+ */
 class DefaultAddress extends Page
 {
     /**
@@ -41,7 +45,7 @@ class DefaultAddress extends Page
      *
      * @var string
      */
-    protected $defaultAddressesSelector = '.column.main .default div.content';
+    protected $defaultAddressesSelector = '.block-addresses-default .box-address-billing';
 
     /**
      * Get default addresses block
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php
new file mode 100644
index 0000000000000000000000000000000000000000..e4c8cf15c191dd88619b3d8c7802070faf76d32c
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/AddressInjectable.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Customer\Test\Repository;
+
+use Mtf\Repository\AbstractRepository;
+
+/**
+ * Class AddressInjectable
+ * Customer address repository
+ */
+class AddressInjectable extends AbstractRepository
+{
+    /**
+     * @param array $defaultConfig
+     * @param array $defaultData
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function __construct(array $defaultConfig = [], array $defaultData = [])
+    {
+        $this->_data['default_US_address'] = [
+            'company' => 'Magento %isolation%',
+            'street' => '6161 West Centinela Avenue',
+            'city' => 'Culver City',
+            'region_id' => 'California',
+            'postcode' => '90230',
+            'country_id' => 'United States',
+            'telephone' => '555-55-555-55',
+            'default_billing' => 'Yes',
+            'default_shipping' => 'Yes',
+        ];
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.php
new file mode 100644
index 0000000000000000000000000000000000000000..3d08c083dbf20034542aaa636cc4b05f3828ff21
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Customer\Test\Repository;
+
+use Mtf\Repository\AbstractRepository;
+
+/**
+ * Class CustomerGroupInjectable
+ * CustomerGroup repository
+ */
+class CustomerGroupInjectable extends AbstractRepository
+{
+    /**
+     * @param array $defaultConfig
+     * @param array $defaultData
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function __construct(array $defaultConfig = [], array $defaultData = [])
+    {
+        $this->_data['General'] = [
+            'customer_group_id' => '1',
+            'customer_group_code' => 'General',
+            'tax_class_id' => ['dataSet' => 'Retail Customer'],
+        ];
+
+        $this->_data['Retailer'] = [
+            'customer_group_id' => '3',
+            'customer_group_code' => 'Retailer',
+            'tax_class_id' => ['dataSet' => 'Retail Customer'],
+        ];
+
+        $this->_data['Wholesale'] = [
+            'customer_group_id' => '2',
+            'customer_group_code' => 'Wholesale',
+            'tax_class_id' => ['dataSet' => 'Retail Customer'],
+        ];
+
+        $this->_data['All Customer Groups'] = [
+            'customer_group_id' => '0',
+            'customer_group_code' => 'All Customer Groups',
+        ];
+
+        $this->_data['NOT LOGGED IN'] = [
+            'customer_group_id' => '0',
+            'customer_group_code' => 'NOT LOGGED IN',
+            'tax_class_id' => ['dataSet' => 'Retail Customer'],
+        ];
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php
index 85e4d3cf880f2437935b41709d10408416e9e746..44d0c2fc12a82b57f57d352b0f1a5f1819afa0b7 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php
@@ -56,6 +56,7 @@ class CustomerInjectable extends AbstractRepository
             'password_confirmation' => '123123q',
             'dob' => '01/01/1990',
             'gender' => 'Male',
+            'group_id' => 'General',
         ];
 
         $this->_data['johndoe_retailer'] = [
diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/CatalogProductDownloadable.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/CatalogProductDownloadable.php
index cee9b2e3e56186ae0a9ea354731905d1812a72b0..40a4780c22562a4995d72789ef7d4c2f0e8bcc83 100644
--- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/CatalogProductDownloadable.php
+++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/CatalogProductDownloadable.php
@@ -102,7 +102,7 @@ class CatalogProductDownloadable extends InjectableFixture
     protected $defaultDataSet = [
         'name' => 'DownloadableProduct_%isolation%',
         'sku' => 'DownloadableProduct_%isolation%',
-        'price' => '100',
+        'price' => ['value' => 100.00],
         'tax_class_id' => ['dataSet' => 'Taxable Goods'],
         'description' => 'This is description for downloadable product',
         'short_description' => 'This is short description for downloadable product',
diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv
index 5e5d12355e27b1b620d4359a09964901576a8d1f..59d2c37991d66c19de9aac686266cab640bbd29d 100755
--- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv
+++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest/testCreateDownloadableProduct.csv
@@ -1,4 +1,4 @@
-product/data/name;product/data/sku;product/data/price;product/data/tax_class_id/dataSet;product/data/quantity_and_stock_status/qty;product/data/quantity_and_stock_status/is_in_stock;product/data/is_virtual;product/data/category;product/data/description;product/data/short_description;product/data/inventory_manage_stock;product/data/inventory_qty;product/data/stock_data_use_config_min_qty;product/data/stock_data_min_qty;product/data/downloadable_sample/preset;product/data/downloadable_links/preset;product/data/custom_options/preset;product/data/special_price;product/data/group_price/preset;product/data/tier_price/preset;constraint
+product/data/name;product/data/sku;product/data/price/value;product/data/tax_class_id/dataSet;product/data/quantity_and_stock_status/qty;product/data/quantity_and_stock_status/is_in_stock;product/data/is_virtual;product/data/category;product/data/description;product/data/short_description;product/data/stock_data/manage_stock;product/data/stock_data/qty;product/data/stock_data/use_config_min_qty;product/data/stock_data/min_qty;product/data/downloadable_sample/preset;product/data/downloadable_links/preset;product/data/custom_options/preset;product/data/special_price;product/data/group_price/preset;product/data/tier_price/preset;constraint
 DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;100;Taxable Goods;1;In Stock;Yes;Default Category;-;-;-;-;-;-;-;default;-;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertProductPage, assertProductInStock
 DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;1;Taxable Goods;10;In Stock;Yes;category %isolation%;-;-;-;-;-;-;default;default;-;-;-;-;assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductVisibleInCategory, assertDownloadableSamplesData, assertDownloadableLinksData
 DownloadableProduct_%isolation%;DownloadableProduct_%isolation%;33;Taxable Goods;10;In Stock;Yes;category %isolation%;-;-;-;-;-;-;-;default;default;-;-;-;assertProductSaveMessage, assertDownloadableProductForm, assertProductCustomOptionsOnProductPage, assertProductVisibleInCategory, assertProductPage, assertDownloadableLinksData
diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest/testUpdateDownloadableProduct.csv b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest/testUpdateDownloadableProduct.csv
index 9476d7b7a89d654a4d61bdba664dcaba86223cef..6d2e795540de0222887704e6530657729598c601 100644
--- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest/testUpdateDownloadableProduct.csv
+++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest/testUpdateDownloadableProduct.csv
@@ -1,4 +1,4 @@
-"product/data/name";"product/data/sku";"product/data/price";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/qty";"product/data/quantity_and_stock_status/is_in_stock";"product/data/is_virtual";"product/data/weight";"product/data/category";"product/data/description";"product/data/short_description";"product/data/inventory_manage_stock";"product/data/inventory_qty";"product/data/stock_data_use_config_min_qty";"product/data/stock_data_min_qty";"product/data/downloadable_sample/preset";"product/data/downloadable_links/preset";"product/data/custom_options/preset";"product/data/special_price";"isRequired";"constraint"
+"product/data/name";"product/data/sku";"product/data/price/value";"product/data/tax_class_id/dataSet";"product/data/quantity_and_stock_status/qty";"product/data/quantity_and_stock_status/is_in_stock";"product/data/is_virtual";"product/data/weight";"product/data/category";"product/data/description";"product/data/short_description";"product/data/inventory_manage_stock";"product/data/inventory_qty";"product/data/stock_data_use_config_min_qty";"product/data/stock_data_min_qty";"product/data/downloadable_sample/preset";"product/data/downloadable_links/preset";"product/data/custom_options/preset";"product/data/special_price";"isRequired";"constraint"
 "DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"55";"Taxable Goods";"10";"In Stock";"Yes";"-";"-";"-";"-";"-";"-";"-";"-";"with_three_samples";"with_three_links";"two_options";"-";"No";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductPage, assertDownloadableLinksData, assertProductInStock, assertProductCustomOptionsOnProductPage, assertProductSearchableBySku"
 "DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"100";"Taxable Goods";"50";"Out of Stock";"Yes";"-";"Default Category";"-";"-";"-";"-";"-";"-";"-";"default";"-";"-";"No";"assertProductSaveMessage, assertProductOutOfStock, assertProductInGrid, assertDownloadableProductForm"
 "DownloadableProduct_%isolation%";"DownloadableProduct_%isolation%";"9999";"Taxable Goods";"123";"-";"Yes";"-";"Default Category";"-";"-";"Yes";"-";"No";"123";"-";"-";"-";"-";"No";"assertProductSaveMessage, assertProductInGrid, assertDownloadableProductForm, assertProductOutOfStock"
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts.php
index 265f133d48040bec7b42adcae5f053edd4a4a5ac..1a5ec63900a241689727a74aba7b75ddc2f862b4 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts.php
@@ -55,6 +55,13 @@ class AssociatedProducts extends Tab
      */
     protected $associatedProductsBlock = '[data-role=grouped-product-grid]';
 
+    /**
+     * Selector for delete button
+     *
+     * @var string
+     */
+    protected $deleteButton = '.delete';
+
     /**
      * Get search grid
      *
@@ -91,6 +98,12 @@ class AssociatedProducts extends Tab
     public function fillFormTab(array $fields, Element $element = null)
     {
         if (isset($fields['associated'])) {
+            $options = $this->_rootElement->find($this->deleteButton)->getElements();
+            if (count($options)) {
+                foreach ($options as $option) {
+                    $option->click();
+                }
+            }
             foreach ($fields['associated']['value']['assigned_products'] as $key => $groupedProduct) {
                 $element->find($this->addNewOption)->click();
                 $searchBlock = $this->getSearchGridBlock();
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php
index 8a7889aaa7dc7632880d24b5dd4b8cc6726d3f85..68c1a4e5f818244bfaafa30b9d0952e76ba5970c 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php
@@ -39,7 +39,7 @@ class ListAssociatedProducts extends Form
      *
      * @var string
      */
-    protected $itemProduct = '//tr[@data-role="row"][%d]';
+    protected $itemProduct = '//tr[@data-role="row"][@class="pointer"][%d]';
 
     /**
      * Getting block products
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Catalog/Product/View.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Catalog/Product/View.php
index 3c0134fa4cfe95bca48430e40d24ed1ee629d99e..437a1c4c92847395752bb14b2d0f32e7356099e6 100755
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Catalog/Product/View.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Catalog/Product/View.php
@@ -37,7 +37,7 @@ class View extends ParentView
      *
      * @var string
      */
-    protected $groupedProductBlock = '.wrapper.table.grouped';
+    protected $groupedProductBlock = '.table-wrapper.grouped';
 
     /**
      * This member holds the class name of the tier price block.
@@ -51,7 +51,7 @@ class View extends ParentView
      *
      * @var string
      */
-    protected $formatSpecialPrice = ".product-info-main tr:nth-child(%row-number%) .price-box";
+    protected $formatSpecialPrice = '//tbody[%row-number%]//*[contains(@class,"price-box")]';
 
     /**
      * Get grouped product block
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.php
index 8137dfa827a54a2a058091f6a65787f95bb36186..a50d70becffb78b0675ca0c45587a57f6a39895c 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.php
@@ -117,6 +117,7 @@ class CatalogProductGrouped extends InjectableFixture
         'is_required' => '0',
         'default_value' => '',
         'input' => 'text',
+        'group' => 'product-details',
         'source' => 'Magento\Catalog\Test\Fixture\CatalogProductSimple\CategoryIds',
     ];
 
@@ -324,6 +325,11 @@ class CatalogProductGrouped extends InjectableFixture
 
     ];
 
+    protected $stock_data = [
+        'attribute_code' => 'stock_data',
+        'group' => 'advanced-inventory'
+    ];
+
     protected $related_tgtr_position_behavior = [
         'attribute_code' => 'related_tgtr_position_behavior',
         'backend_type' => 'int',
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.xml
index 4bd9649b5cd262e88d9d4281d9e52aa9c987e47c..69b7e75c3492c1cd80d4d5c937c0d6f19587c0fc 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.xml
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped.xml
@@ -350,6 +350,10 @@
             <backend_type>virtual</backend_type>
             <source>'Magento\Catalog\Test\Fixture\CatalogProductSimple\Price</source>
         </price>
+        <stock_data>
+            <attribute_code>stock_data</attribute_code>
+            <group>advanced-inventory</group>
+        </stock_data>
     </fields>
     <data_set>
         <sku></sku>
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped/Associated.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped/Associated.php
index 9f0b5ff31f0c41f1d8ef0b8f692501f073639d76..eee73da0d12be440a0779fe3d0083683412db8bc 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped/Associated.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/CatalogProductGrouped/Associated.php
@@ -66,32 +66,31 @@ class Associated implements FixtureInterface
     {
         $this->params = $params;
 
-        if ($data['preset']) {
+        if (isset($data['preset'])) {
             $this->currentPreset = $data['preset'];
             $this->data = $this->getPreset($this->currentPreset);
         }
 
-        if (!empty($this->data['products'])) {
-            $this->data['products'] = is_array($this->data['products'])
-                ? $this->data['products']
-                : explode(',', $this->data['products']);
-            foreach ($this->data['products'] as $key => $product) {
-                list($fixture, $dataSet) = explode('::', $product);
-                /** @var $productFixture InjectableFixture */
-                $productFixture = $fixtureFactory->createByCode($fixture, ['dataSet' => $dataSet]);
-                if (!$productFixture->hasData('id')) {
-                    $productFixture->persist();
-                }
+        $this->data['products'] = isset($data['products']) && $data['products'] != '-'
+            ? explode(',', $data['products'])
+            : $this->data['products'];
 
-                $this->data['products'][$key] = $productFixture;
+        foreach ($this->data['products'] as $key => $product) {
+            list($fixture, $dataSet) = explode('::', $product);
+            /** @var $productFixture InjectableFixture */
+            $productFixture = $fixtureFactory->createByCode($fixture, ['dataSet' => $dataSet]);
+            if (!$productFixture->hasData('id')) {
+                $productFixture->persist();
             }
 
-            $assignedProducts = & $this->data['assigned_products'];
-            foreach (array_keys($assignedProducts) as $key) {
-                $assignedProducts[$key]['name'] = $this->data['products'][$key]->getName();
-                $assignedProducts[$key]['id'] = $this->data['products'][$key]->getId();
-                $assignedProducts[$key]['position'] = $key + 1;
-            }
+            $this->data['products'][$key] = $productFixture;
+        }
+
+        $assignedProducts = & $this->data['assigned_products'];
+        foreach (array_keys($assignedProducts) as $key) {
+            $assignedProducts[$key]['name'] = $this->data['products'][$key]->getName();
+            $assignedProducts[$key]['id'] = $this->data['products'][$key]->getId();
+            $assignedProducts[$key]['position'] = $key + 1;
         }
     }
 
@@ -154,7 +153,47 @@ class Associated implements FixtureInterface
                 ],
                 'products' => [
                     'catalogProductSimple::default',
-                    'catalogProductSimple::default'
+                    'catalogProductSimple::100_dollar_product'
+                ],
+            ],
+            'defaultSimpleProduct_without_qty' => [
+                'assigned_products' => [
+                    [
+                        'id' => '%id%',
+                        'name' => '%item1_simple::getProductName%',
+                        'position' => '%position%',
+                        'qty' => 0,
+                    ],
+                    [
+                        'id' => '%id%',
+                        'name' => '%item1_simple::getProductName%',
+                        'position' => '%position%',
+                        'qty' => 0,
+                    ],
+                ],
+                'products' => [
+                    'catalogProductSimple::default',
+                    'catalogProductSimple::100_dollar_product'
+                ],
+            ],
+            'defaultSimpleProduct_with_specialPrice' => [
+                'assigned_products' => [
+                    [
+                        'id' => '%id%',
+                        'name' => '%item1_simple::getProductName%',
+                        'position' => '%position%',
+                        'qty' => 1,
+                    ],
+                    [
+                        'id' => '%id%',
+                        'name' => '%item1_simple::getProductName%',
+                        'position' => '%position%',
+                        'qty' => 2,
+                    ],
+                ],
+                'products' => [
+                    'catalogProductSimple::withSpecialPrice',
+                    'catalogProductSimple::withSpecialPrice'
                 ],
             ],
             'defaultVirtualProduct' => [
@@ -174,7 +213,7 @@ class Associated implements FixtureInterface
                 ],
                 'products' => [
                     'catalogProductVirtual::default',
-                    'catalogProductVirtual::default'
+                    'catalogProductVirtual::50_dollar_product'
                 ],
             ]
         ];
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/CatalogProductGrouped.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/CatalogProductGrouped.php
index de41d75a51d5c2871673dc5b4a6dfebcc8baa32c..7ab94432e2492f3a88af2034ac29ea0817736839 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/CatalogProductGrouped.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/CatalogProductGrouped.php
@@ -45,7 +45,6 @@ class CatalogProductGrouped extends AbstractRepository
         $this->_data['default'] = [
             'name' => 'Test grouped product %isolation%',
             'sku' => 'sku_test_grouped_product_%isolation%',
-            'weight' => 30.0000,
             'category_ids' => ['presets' => 'default'],
             'associated' => ['preset' => 'defaultSimpleProduct'],
             'status' => 'Product online',
@@ -53,18 +52,32 @@ class CatalogProductGrouped extends AbstractRepository
             'tax_class_id' => ['dataSet' => 'Taxable Goods'],
             'url_key' => 'test-grouped-product-%isolation%',
             'quantity_and_stock_status' => [
-                'qty' => 666.0000,
                 'is_in_stock' => 'In Stock',
             ],
             'website_ids' => ['Main Website'],
             'attribute_set_id' => ['dataSet' => 'default'],
         ];
 
+        $this->_data['grouped_product_out_of_stock'] = [
+            'name' => 'Test grouped product %isolation%',
+            'sku' => 'sku_test_grouped_product_%isolation%',
+            'category_ids' => ['presets' => 'default'],
+            'associated' => ['preset' => 'defaultSimpleProduct'],
+            'status' => 'Product online',
+            'visibility' => 'Catalog, Search',
+            'tax_class_id' => ['dataSet' => 'Taxable Goods'],
+            'url_key' => 'test-grouped-product-%isolation%',
+            'quantity_and_stock_status' => [
+                'is_in_stock' => 'Out of Stock',
+            ],
+            'website_ids' => ['Main Website'],
+            'attribute_set_id' => ['dataSet' => 'default'],
+        ];
+
         $this->_data['grouped_product_with_price'] = [
             'name' => 'Test grouped product %isolation%',
             'sku' => 'sku_test_grouped_product_%isolation%',
             'price' => ['value' => '-', 'preset' => 'starting-560'],
-            'weight' => 30.0000,
             'category_ids' => ['presets' => 'default'],
             'associated' => ['preset' => 'defaultSimpleProduct'],
             'status' => 'Product online',
@@ -72,7 +85,6 @@ class CatalogProductGrouped extends AbstractRepository
             'tax_class_id' => ['dataSet' => 'Taxable Goods'],
             'url_key' => 'test-grouped-product-%isolation%',
             'quantity_and_stock_status' => [
-                'qty' => 666.0000,
                 'is_in_stock' => 'In Stock',
             ],
             'website_ids' => ['Main Website'],
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..fbff0403b2dae61861d8e237819a42ffc2759eb9
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\GroupedProduct\Test\TestCase;
+
+use Mtf\TestCase\Injectable;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
+use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
+use Magento\GroupedProduct\Test\Fixture\CatalogProductGrouped;
+
+/**
+ * Test Creation for Update GroupedProductEntity
+ *
+ * Test Flow:
+ *
+ * Preconditions:
+ * 1. Create Grouped Product.
+ *
+ * Steps:
+ * 1. Login to the backend.
+ * 2. Navigate to Products > Catalog.
+ * 3. Open grouped product from preconditions.
+ * 4. Fill in data according to dataset.
+ * 5. Save the Product.
+ * 6. Perform all assertions.
+ *
+ * @group Grouped_Product_(MX)
+ * @ZephyrId MAGETWO-26462
+ */
+class UpdateGroupedProductEntityTest extends Injectable
+{
+    /**
+     * Page product on backend
+     *
+     * @var CatalogProductIndex
+     */
+    protected $catalogProductIndex;
+
+    /**
+     * Edit page on backend
+     *
+     * @var CatalogProductEdit
+     */
+    protected $catalogProductEdit;
+
+    /**
+     * Filling objects of the class
+     *
+     * @param CatalogProductIndex $catalogProductIndexNewPage
+     * @param CatalogProductEdit $catalogProductEditPage
+     * @return void
+     */
+    public function __inject(
+        CatalogProductIndex $catalogProductIndexNewPage,
+        CatalogProductEdit $catalogProductEditPage
+    ) {
+        $this->catalogProductIndex = $catalogProductIndexNewPage;
+        $this->catalogProductEdit = $catalogProductEditPage;
+    }
+
+    /**
+     * Test update grouped product
+     *
+     * @param CatalogProductGrouped $product
+     * @param CatalogProductGrouped $originalProduct
+     * @return void
+     */
+    public function test(CatalogProductGrouped $product, CatalogProductGrouped $originalProduct)
+    {
+        // Precondition
+        $originalProduct->persist();
+
+        // Steps
+        $this->catalogProductIndex->open();
+        $this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $originalProduct->getSku()]);
+        $this->catalogProductEdit->getForm()->fill($product);
+        $this->catalogProductEdit->getFormAction()->save();
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..892b7ef86617ae0ca5a4c9e1f4c5c89940ab1cb7
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest/test.csv
@@ -0,0 +1,6 @@
+"originalProduct/dataSet";"product/data/name";"product/data/sku";"product/data/quantity_and_stock_status/is_in_stock";"product/data/category_ids/presets";"product/data/associated/products";"product/data/associated/preset";"product/data/description";"product/data/short_description";"constraint"
+"grouped_product_out_of_stock";"GroupedProduct_edited %isolation%";"GroupedProduct_sku_edited %isolation%";"In Stock";"category_%isolation%";"-";"-";"This is edited description for grouped product";"This is edited short description for grouped product";"assertProductSaveMessage, assertProductInStock, assertProductPage"
+"default";"GroupedProduct_edited %isolation%";"GroupedProduct_sku_edited %isolation%";"-";"-";"catalogProductVirtual::default,catalogProductVirtual::50_dollar_product";"defaultVirtualProduct";"-";"-";"assertProductSaveMessage, assertGroupedProductForm"
+"default";"GroupedProduct_edited %isolation%";"GroupedProduct_sku_edited %isolation%";"-";"-";"catalogProductSimple::simple_for_composite_products,catalogProductSimple::default";"defaultSimpleProduct_without_qty";"-";"-";"assertProductSaveMessage, assertGroupedProductsDefaultQty, assertGroupedProductForm"
+"default";"GroupedProduct_edited %isolation%";"GroupedProduct_sku_edited %isolation%";"-";"-";"catalogProductSimple::withSpecialPrice,catalogProductSimple::withSpecialPrice";"defaultSimpleProduct_with_specialPrice";"-";"-";"assertProductSaveMessage, assertSpecialPriceOnGroupedProductPage"
+"default";"GroupedProduct_edited %isolation%";"GroupedProduct_sku_edited %isolation%";"Out of Stock";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductOutOfStock"
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Edit/RatingElement.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Edit/RatingElement.php
new file mode 100644
index 0000000000000000000000000000000000000000..29970a9682137bd91dbe9cc16e435592e7538a98
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Edit/RatingElement.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\Block\Adminhtml\Edit;
+
+use Mtf\Client\Driver\Selenium\Element;
+use Mtf\Client\Element\Locator;
+
+/**
+ * Class RatingElement
+ * Rating typified element
+ */
+class RatingElement extends Element
+{
+    /**
+     * Rating selector
+     *
+     * @var string
+     */
+    protected $rating = './/*[@data-widget="ratingControl"]//label[contains(@for, "%s_%s")]';
+
+    /**
+     * Selector for label of checked rating
+     *
+     * @var string
+     */
+    protected $checkedRating = 'input[id$="_%d"]:checked + label';
+
+    /**
+     * Selector for single rating
+     *
+     * @var string
+     */
+    protected $ratingByNumber = './/*[@id="rating_detail"]//*[contains(@class,"field-rating")][%d]';
+
+    /**
+     * Set rating value
+     *
+     * @param array $value
+     * @return void
+     */
+    public function setValue($value)
+    {
+        foreach ($value as $rating) {
+            $ratingSelector = sprintf($this->rating, $rating['title'], $rating['rating']);
+            $this->find($ratingSelector, Locator::SELECTOR_XPATH)->click();
+        }
+    }
+
+    /**
+     * Get rating vote
+     *
+     * @param Element $rating
+     * @return int
+     */
+    protected function getRatingVote(Element $rating)
+    {
+        $ratingVote = 5;
+        $ratingVoteElement = $rating->find(sprintf($this->checkedRating, $ratingVote));
+        while (!$ratingVoteElement->isVisible() && $ratingVote) {
+            --$ratingVote;
+            $ratingVoteElement = $rating->find(sprintf($this->checkedRating, $ratingVote));
+        }
+
+        return $ratingVote;
+    }
+
+    /**
+     * Get list ratings
+     *
+     * @return array
+     */
+    public function getValue()
+    {
+        $ratings = [];
+
+        $count = 1;
+        $rating = $this->find(sprintf($this->ratingByNumber, $count), Locator::SELECTOR_XPATH);
+        while ($rating->isVisible()) {
+            $ratings[$count] = [
+                'title' => $rating->find('./label/span', Locator::SELECTOR_XPATH)->getText(),
+                'rating' => $this->getRatingVote($rating)
+            ];
+
+            ++$count;
+            $rating = $this->find(sprintf($this->ratingByNumber, $count), Locator::SELECTOR_XPATH);
+        }
+        return $ratings;
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php
index ef1eb3446522c7a359f88e78afbd62cfa4cfe3a8..f295e2c0c8b1086378581f705985f1db5b27e941 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Grid.php
@@ -38,16 +38,36 @@ class Grid extends GridAbstract
      *
      * @var array
      */
-    protected $filters = array(
-        'review_id' => array(
-            'selector' => '#reviwGrid_filter_review_id',
-        ),
-        'title' => array(
-            'selector' => '#reviwGrid_filter_title',
-        ),
-        'status' => array(
-            'selector' => '#reviwGrid_filter_status',
+    protected $filters = [
+        'review_id' => [
+            'selector' => 'input[name="review_id"]',
+        ],
+        'title' => [
+            'selector' => 'input[name="title"]',
+        ],
+        'status' => [
+            'selector' => '.grid select[name="status"]',
             'input' => 'select',
-        ),
-    );
+        ],
+        'nickname' => [
+            'selector' => 'input[name="nickname"]',
+        ],
+        'detail' => [
+            'selector' => 'input[name="detail"]',
+        ],
+        'visible_in' => [
+            'selector' => 'select[name="visible_in"]',
+            'input' => 'selectstore',
+        ],
+        'type' => [
+            'selector' => 'select[name="type"]',
+            'input' => 'select',
+        ],
+        'name' => [
+            'selector' => 'input[name="name"]',
+        ],
+        'sku' => [
+            'selector' => 'input[name="sku"]',
+        ],
+    ];
 }
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php
new file mode 100644
index 0000000000000000000000000000000000000000..458522fd51be70b4653184f949e9a44ada9216ee
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\Block\Adminhtml\Product;
+
+use Magento\Backend\Test\Block\Widget\Grid as ParentGrid;
+
+/**
+ * Class Grid
+ * Review catalog product grid
+ */
+class Grid extends ParentGrid
+{
+    /**
+     * Grid filter selectors
+     *
+     * @var array
+     */
+    protected $filters = [
+        'id' => [
+            'selector' => 'input[name="entity_id"]'
+        ],
+        'name' => [
+            'selector' => 'input[name="name"]'
+        ]
+    ];
+
+    /**
+     * Locator value for link in action column
+     *
+     * @var string
+     */
+    protected $editLink = '.col-entity_id';
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.php
index 62b3e18f9c0039f12842557ccd589e86bccb3250..35d36a5bef66b79462835ecb01ee9ff273ae8dbb 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.php
@@ -24,6 +24,7 @@
 
 namespace Magento\Review\Test\Block\Adminhtml;
 
+use Magento\Review\Test\Fixture\ReviewInjectable;
 use Mtf\Client\Element;
 use Mtf\Client\Element\Locator;
 use Magento\Backend\Test\Block\Widget\Form;
@@ -55,20 +56,6 @@ class ReviewForm extends Form
      */
     protected $saveButton = '[data-ui-id$=save-button-button]';
 
-    /**
-     * Selector for single rating
-     *
-     * @var string
-     */
-    protected $ratingByNumber = './/*[@id="detailed_rating"]//*[contains(@class,"field-rating")][%d]';
-
-    /**
-     * Selector for label of checked rating
-     *
-     * @var string
-     */
-    protected $checkedRating = 'input[id$="_%d"]:checked + label';
-
     /**
      * Get data from 'Posted By' field
      *
@@ -98,46 +85,4 @@ class ReviewForm extends Form
     {
         $this->_rootElement->find($this->status, Locator::SELECTOR_CSS, 'select')->setValue('Approved');
     }
-
-    /**
-     * Get list ratings
-     *
-     * @return array
-     */
-    public function getRatings()
-    {
-        $ratings = [];
-
-        $count = 1;
-        $rating = $this->_rootElement->find(sprintf($this->ratingByNumber, $count), Locator::SELECTOR_XPATH);
-        while ($rating->isVisible()) {
-            $ratings[$count] = [
-                'title' => $rating->find('./label/span', Locator::SELECTOR_XPATH)->getText(),
-                'rating' => $this->getRatingVote($rating)
-            ];
-
-            ++$count;
-            $rating = $this->_rootElement->find(sprintf($this->ratingByNumber, $count), Locator::SELECTOR_XPATH);
-        }
-
-        return $ratings;
-    }
-
-    /**
-     * Get rating vote
-     *
-     * @param Element $rating
-     * @return int
-     */
-    protected function getRatingVote(Element $rating)
-    {
-        $ratingVote = 5;
-        $ratingVoteElement = $rating->find(sprintf($this->checkedRating, $ratingVote));
-        while (!$ratingVoteElement->isVisible() && $ratingVote) {
-            --$ratingVote;
-            $ratingVoteElement = $rating->find(sprintf($this->checkedRating, $ratingVote));
-        }
-
-        return $ratingVote;
-    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml
index 05f0774d009510f3dbb5ddb0d69417c765b03024..6715badc7ae2c17069b4d7ece35afa98676aab35 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml
@@ -28,6 +28,8 @@
         <status_id>
             <input>select</input>
         </status_id>
+        <title />
+        <nickname />
         <select_stores>
             <selector>[name="select_stores[]"]</selector>
             <input>multiselectgrouplist</input>
@@ -35,5 +37,9 @@
         <detail>
             <input>textarea</input>
         </detail>
+        <ratings>
+            <selector>#detailed_rating</selector>
+            <class>Magento\Review\Test\Block\Adminhtml\Edit\RatingElement</class>
+        </ratings>
     </fields>
 </mapping>
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php
index 728efdd2a50f9570579656edcfe458b600a87130..bf8afb977c4a55f61bb862545b77f2a9b75613e0 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInProductPage.php
@@ -32,6 +32,7 @@ use Mtf\Constraint\AbstractConstraint;
 
 /**
  * Class AssertProductRatingInProductPage
+ * Assert that product rating is displayed on product review(frontend)
  */
 class AssertProductRatingInProductPage extends AbstractConstraint
 {
@@ -57,10 +58,13 @@ class AssertProductRatingInProductPage extends AbstractConstraint
         ReviewInjectable $review = null,
         Rating $productRating = null
     ) {
+        $product = $review === null ? $product : $review->getDataFieldConfig('entity_id')['source']->getEntity();
         $catalogProductView->init($product);
         $catalogProductView->open();
-        $catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
-
+        $reviewSummaryBlock = $catalogProductView->getReviewSummaryBlock();
+        if ($reviewSummaryBlock->isVisible()) {
+            $reviewSummaryBlock->getAddReviewLink()->click();
+        }
         $rating = $productRating ? $productRating : $review->getDataFieldConfig('ratings')['source']->getRatings()[0];
         $reviewForm = $catalogProductView->getReviewFormBlock();
         \PHPUnit_Framework_Assert::assertTrue(
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php
index d19aea6948b2bc1a1e3dae47d7f505b21c297f99..dc2daef11885a58240e5c075fd7301061d96e83f 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInProductPage.php
@@ -26,6 +26,7 @@ namespace Magento\Review\Test\Constraint;
 
 use Magento\Catalog\Test\Page\Product\CatalogProductView;
 use Magento\Catalog\Test\Fixture\CatalogProductSimple;
+use Magento\Review\Test\Fixture\ReviewInjectable;
 use Magento\Review\Test\Fixture\Rating;
 use Mtf\Constraint\AbstractConstraint;
 
@@ -46,14 +47,17 @@ class AssertProductRatingNotInProductPage extends AbstractConstraint
      *
      * @param CatalogProductView $catalogProductView
      * @param CatalogProductSimple $product
+     * @param ReviewInjectable $review
      * @param Rating $productRating
      * @return void
      */
     public function processAssert(
         CatalogProductView $catalogProductView,
         CatalogProductSimple $product,
-        Rating $productRating
+        Rating $productRating,
+        ReviewInjectable $review = null
     ) {
+        $product = $review === null ? $product : $review->getDataFieldConfig('entity_id')['source']->getEntity();
         $catalogProductView->init($product);
         $catalogProductView->open();
         $catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingOnReviewPage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingOnReviewPage.php
index 6211b78e4ba0fb7d44214a0db69a5e7c24bc37fb..211322cd60ec07443fd065f729f0264aa9010d38 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingOnReviewPage.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingOnReviewPage.php
@@ -66,8 +66,8 @@ class AssertProductRatingOnReviewPage extends AbstractAssertForm
             $review->hasData('ratings') ? $review->getRatings() : []
         );
         $ratingReview = $this->sortDataByPath($ratingReview, '::title');
-        $ratingForm = $reviewEdit->getReviewForm()->getRatings();
-        $ratingForm = $this->sortDataByPath($ratingForm, '::title');
+        $ratingForm = $reviewEdit->getReviewForm()->getData();
+        $ratingForm = $this->sortDataByPath($ratingForm['ratings'], '::title');
         $error = $this->verifyData($ratingReview, $ratingForm);
         \PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
     }
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewBackendSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewBackendSuccessSaveMessage.php
new file mode 100644
index 0000000000000000000000000000000000000000..f82a4fbe307d1526189363bab39db35a06672f41
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewBackendSuccessSaveMessage.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\Constraint;
+
+use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
+use Mtf\Constraint\AbstractConstraint;
+
+/**
+ * Class AssertProductReviewBackendSuccessSaveMessage
+ * Assert that success message is displayed after review created
+ */
+class AssertProductReviewBackendSuccessSaveMessage extends AbstractConstraint
+{
+    /**
+     * Text of success message after review created
+     */
+    const SUCCESS_MESSAGE = 'You saved the review.';
+
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'middle';
+
+    /**
+     * Assert that success message is displayed after review created
+     *
+     * @param ReviewIndex $reviewIndex
+     * @return void
+     */
+    public function processAssert(ReviewIndex $reviewIndex)
+    {
+        \PHPUnit_Framework_Assert::assertEquals(
+            self::SUCCESS_MESSAGE,
+            $reviewIndex->getMessagesBlock()->getSuccessMessages(),
+            'Wrong success message is displayed.'
+        );
+    }
+
+    /**
+     * Text success create message is displayed
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Review success create message is present.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php
index 3c6fcaf5798f00f702c4a08fce5fec6e2705f9c9..67e214f693c12e16f06f56fd96871bef2fcd9832 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewInGrid.php
@@ -27,6 +27,7 @@ namespace Magento\Review\Test\Constraint;
 use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
 use Magento\Review\Test\Fixture\ReviewInjectable;
 use Mtf\Constraint\AbstractConstraint;
+use Mtf\Fixture\FixtureInterface;
 
 /**
  * Class AssertProductReviewInGrid
@@ -40,26 +41,90 @@ class AssertProductReviewInGrid extends AbstractConstraint
      */
     protected $severeness = 'low';
 
+    /**
+     * Filter params
+     *
+     * @var array
+     */
+    protected $filter = [
+        'review_id',
+        'status' => 'status_id',
+        'title',
+        'nickname',
+        'detail',
+        'visible_in' => 'select_stores',
+        'type',
+        'name',
+        'sku'
+    ];
+
     /**
      * Assert that review is displayed in grid
      *
      * @param ReviewIndex $reviewIndex
      * @param ReviewInjectable $review
+     * @param string $gridStatus
+     * @param ReviewInjectable $reviewInitial
      * @return void
      */
-    public function processAssert(ReviewIndex $reviewIndex, ReviewInjectable $review)
-    {
-        $filter = ['title' => $review->getTitle()];
+    public function processAssert(
+        ReviewIndex $reviewIndex,
+        ReviewInjectable $review,
+        $gridStatus = '',
+        ReviewInjectable $reviewInitial = null
+    ) {
+        $product = $reviewInitial === null
+            ? $review->getDataFieldConfig('entity_id')['source']->getEntity()
+            : $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity();
+        $filter = $this->prepareFilter($product, $review, $gridStatus);
 
         $reviewIndex->open();
+        $reviewIndex->getReviewGrid()->search($filter);
+        unset($filter['visible_in']);
         \PHPUnit_Framework_Assert::assertTrue(
-            $reviewIndex->getReviewGrid()->isRowVisible($filter),
-            'Review with '
-            . 'title "' . $filter['title'] . '"'
-            . 'is absent in Review grid.'
+            $reviewIndex->getReviewGrid()->isRowVisible($filter, false),
+            'Review with is absent in Review grid.'
         );
     }
 
+    /**
+     * Prepare filter for assert
+     *
+     * @param FixtureInterface $product
+     * @param ReviewInjectable $review
+     * @param string $gridStatus
+     * @return array
+     */
+    protected function prepareFilter(FixtureInterface $product, ReviewInjectable $review, $gridStatus)
+    {
+        $filter = [];
+        foreach ($this->filter as $key => $item) {
+            list($type, $param) = [$key, $item];
+            if (is_numeric($key)) {
+                $type = $param = $item;
+            }
+            switch ($param) {
+                case 'name':
+                case 'sku':
+                    $value = $product->getData($param);
+                    break;
+                case 'select_stores':
+                    $value = $review->getData($param)[0];
+                    break;
+                case 'status_id':
+                    $value = $gridStatus != '' ? $gridStatus : $review->getData($param);
+                    break;
+                default:
+                    $value = $review->getData($param);
+                    break;
+            }
+            if ($value !== null) {
+                $filter += [$type => $value];
+            }
+        }
+        return $filter;
+    }
+
     /**
      * Text success exist review in grid on product reviews tab
      *
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewMassActionSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewMassActionSuccessDeleteMessage.php
new file mode 100644
index 0000000000000000000000000000000000000000..89fcb14962d0b101a0c2610bef1b4ee94257ea79
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewMassActionSuccessDeleteMessage.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\Review\Test\Fixture\ReviewInjectable;
+use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
+
+/**
+ * Class AssertProductReviewMassActionSuccessDeleteMessage
+ * Assert success message appears after deletion via mass actions
+ */
+class AssertProductReviewMassActionSuccessDeleteMessage extends AbstractConstraint
+{
+    /**
+     * Message that appears after deletion via mass actions
+     */
+    const SUCCESS_DELETE_MESSAGE = 'A total of %d record(s) have been deleted.';
+
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that success message is displayed after deletion via mass actions
+     *
+     * @param ReviewInjectable|ReviewInjectable[] $review
+     * @param ReviewIndex $reviewIndex
+     * @return void
+     */
+    public function processAssert(ReviewInjectable $review, ReviewIndex $reviewIndex)
+    {
+        $reviews = is_array($review) ? $review : [$review];
+        $deleteMessage = sprintf(self::SUCCESS_DELETE_MESSAGE, count($reviews));
+        \PHPUnit_Framework_Assert::assertEquals(
+            $deleteMessage,
+            $reviewIndex->getMessagesBlock()->getSuccessMessages(),
+            'Wrong success message is displayed.'
+        );
+    }
+
+    /**
+     * Text success save message is displayed
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Review success message appears after deletion via mass actions is present.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewMassActionSuccessMessage.php b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewMassActionSuccessMessage.php
new file mode 100644
index 0000000000000000000000000000000000000000..979e20eccc4b9188e70eeb589f30e21ee0b3561b
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductReviewMassActionSuccessMessage.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\Constraint;
+
+use Mtf\Constraint\AbstractConstraint;
+use Magento\Review\Test\Fixture\ReviewInjectable;
+use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
+
+/**
+ * Class AssertProductReviewMassActionSuccessMessage
+ * Assert success message appears after updated via mass actions
+ */
+class AssertProductReviewMassActionSuccessMessage extends AbstractConstraint
+{
+    /**
+     * Message that appears after updates via mass actions
+     */
+    const SUCCESS_MESSAGE = 'A total of %d record(s) have been updated.';
+
+    /**
+     * Constraint severeness
+     *
+     * @var string
+     */
+    protected $severeness = 'high';
+
+    /**
+     * Assert that success message is displayed after updated via mass actions
+     *
+     * @param ReviewInjectable|ReviewInjectable[] $review
+     * @param ReviewIndex $reviewIndex
+     * @return void
+     */
+    public function processAssert(ReviewInjectable $review, ReviewIndex $reviewIndex)
+    {
+        $reviews = is_array($review) ? $review : [$review];
+        $successMessage = sprintf(self::SUCCESS_MESSAGE, count($reviews));
+        \PHPUnit_Framework_Assert::assertEquals(
+            $successMessage,
+            $reviewIndex->getMessagesBlock()->getSuccessMessages(),
+            'Wrong success message is displayed.'
+        );
+    }
+
+    /**
+     * Text success save message is displayed
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Review success message appears after updated via mass actions is present.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.php b/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.php
index 369f801bf3f21a7539eecfff16cdd2f1b636534b..e133a71ab27dda93d34af0702c07c1e4830618c3 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.php
@@ -29,6 +29,8 @@ use Mtf\Fixture\InjectableFixture;
 /**
  * Class ReviewInjectable
  * Product review fixture
+ *
+ * @SuppressWarnings(PHPMD.TooManyFields)
  */
 class ReviewInjectable extends InjectableFixture
 {
@@ -50,16 +52,17 @@ class ReviewInjectable extends InjectableFixture
     protected $defaultDataSet = [
         'status_id' => 'Approved',
         'select_stores' => ['Main Website/Main Website Store/Default Store View'],
-        'nickname' =>  'Guest customer %isolation%',
+        'nickname' => 'Guest customer %isolation%',
         'title' => 'Summary review %isolation%',
         'detail' => 'Text review %isolation%',
         'ratings' => [
-            1 => [
+            [
                 'dataSet' => 'visibleOnDefaultWebsite',
                 'rating' => 4
             ]
         ],
-        'entity_id' => ['dataSet' => 'catalogProductSimple::default']
+        'entity_id' => ['dataSet' => 'catalogProductSimple::default'],
+        'type' => 'Administrator'
     ];
 
     protected $review_id = [
@@ -151,12 +154,38 @@ class ReviewInjectable extends InjectableFixture
         'input' => '',
     ];
 
+    protected $select_stores = [
+        'attribute_code' => 'select_stores',
+        'backend_type' => 'virtual',
+        'is_required' => '1',
+        'default_value' => '0',
+        'input' => 'multiselectgrouplist',
+    ];
+
     protected $ratings = [
         'attribute_code' => 'ratings',
         'backend_type' => 'virtual',
         'source' => 'Magento\Review\Test\Fixture\ReviewInjectable\Ratings',
     ];
 
+    protected $type = [
+        'attribute_code' => 'type',
+        'backend_type' => 'string',
+        'is_required' => '',
+        'default_value' => '',
+        'input' => '',
+    ];
+
+    public function getType()
+    {
+        return $this->getData('type');
+    }
+
+    public function getSelectStores()
+    {
+        return $this->getData('select_stores');
+    }
+
     public function getReviewId()
     {
         return $this->getData('review_id');
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.xml
index e7b344b51a6c7259bd4e35266b9c91bf91135a19..becce08c80799f9ce8f2c6156c43eec5c3c2fe4b 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.xml
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Fixture/ReviewInjectable.xml
@@ -110,6 +110,20 @@
             <default_value></default_value>
             <input></input>
         </customer_id>
+        <type>
+            <attribute_code>type</attribute_code>
+            <backend_type>string</backend_type>
+            <is_required></is_required>
+            <default_value></default_value>
+            <input></input>
+        </type>
+        <select_stores>
+            <attribute_code>select_stores</attribute_code>
+            <backend_type>virtual</backend_type>
+            <is_required>1</is_required>
+            <default_value>0</default_value>
+            <input>multiselectgrouplist</input>
+        </select_stores>
         <ratings>
             <attribute_code>ratings</attribute_code>
             <backend_type>virtual</backend_type>
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php
index 69c149371a40d171b58eb967f7f6c742741759a9..ead0d1b1a667c5f0655652ad8e11321d40ca00ac 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.php
@@ -28,6 +28,7 @@ use Mtf\Page\BackendPage;
 
 /**
  * Class ReviewEdit
+ * Review edit page
  */
 class ReviewEdit extends BackendPage
 {
@@ -46,6 +47,12 @@ class ReviewEdit extends BackendPage
             'locator' => '#edit_form',
             'strategy' => 'css selector',
         ],
+        'productGrid' => [
+            'name' => 'productGrid',
+            'class' => 'Magento\Review\Test\Block\Adminhtml\Product\Grid',
+            'locator' => '#productGrid',
+            'strategy' => 'css selector',
+        ],
     ];
 
     /**
@@ -63,4 +70,12 @@ class ReviewEdit extends BackendPage
     {
         return $this->getBlockInstance('reviewForm');
     }
+
+    /**
+     * @return \Magento\Review\Test\Block\Adminhtml\Product\Grid
+     */
+    public function getProductGrid()
+    {
+        return $this->getBlockInstance('productGrid');
+    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml
index b006f73960ec173cf746e44d6cffba1304759a76..e2e8d8b11a818d93d86b7a090213a8447aa9997c 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewEdit.xml
@@ -36,4 +36,10 @@
         <locator>#edit_form</locator>
         <strategy>css selector</strategy>
     </block>
+    <block>
+        <name>productGrid</name>
+        <class>Magento\Review\Test\Block\Adminhtml\Product\Grid</class>
+        <locator>#productGrid</locator>
+        <strategy>css selector</strategy>
+    </block>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php
index 3c551b35a5e704ddeb921ee4e2a66efdbdb77a58..d2a3eaab114300b528669c40c3691f2eb316d0e2 100644
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.php
@@ -28,8 +28,7 @@ use Mtf\Page\BackendPage;
 
 /**
  * Class ReviewIndex
- *
- * @package Magento\Review\Test\Page\Adminhtml
+ * Review Index page
  */
 class ReviewIndex extends BackendPage
 {
@@ -48,6 +47,12 @@ class ReviewIndex extends BackendPage
             'locator' => '#reviwGrid',
             'strategy' => 'css selector',
         ],
+        'reviewActions' => [
+            'name' => 'reviewActions',
+            'class' => 'Magento\Backend\Test\Block\GridPageActions',
+            'locator' => '.page-main-actions',
+            'strategy' => 'css selector',
+        ],
     ];
 
     /**
@@ -65,4 +70,12 @@ class ReviewIndex extends BackendPage
     {
         return $this->getBlockInstance('reviewGrid');
     }
+
+    /**
+     * @return \Magento\Backend\Test\Block\GridPageActions
+     */
+    public function getReviewActions()
+    {
+        return $this->getBlockInstance('reviewActions');
+    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml
index 42bb5169639c4587e62b92c172255c07fc6a0912..45234c918bf9108b8db8cca999020d4b017584a6 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml
@@ -36,4 +36,10 @@
         <locator>#reviwGrid</locator>
         <strategy>css selector</strategy>
     </block>
+    <block>
+        <name>reviewActions</name>
+        <class>Magento\Backend\Test\Block\GridPageActions</class>
+        <locator>.page-main-actions</locator>
+        <strategy>css selector</strategy>
+    </block>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Repository/ReviewInjectable.php b/dev/tests/functional/tests/app/Magento/Review/Test/Repository/ReviewInjectable.php
index e97d0ce7e6de8fc3579f8604796f5b8548167908..82aa09b530f193caab625ffbc17ba4a4fc7e98c4 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/Repository/ReviewInjectable.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/Repository/ReviewInjectable.php
@@ -48,7 +48,7 @@ class ReviewInjectable extends AbstractRepository
             'title' => 'title_%isolation%',
             'detail' => 'review_detail_%isolation%',
             'ratings' => [
-                1 => [
+                [
                     'dataSet' => 'visibleOnDefaultWebsite',
                     'rating' => mt_rand(1, 5)
                 ]
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateFrontendProductReviewEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateFrontendProductReviewEntityTest/test.csv
deleted file mode 100755
index c292f94db4dd652ddb7e86fee33dc7e991d26674..0000000000000000000000000000000000000000
--- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateFrontendProductReviewEntityTest/test.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"review/data/nickname";"review/data/title";"review/data/detail";"review/data/ratings/1/dataSet";"review/data/ratings/1/rating";"constraint"
-"name_%isolation%";"title_%isolation%";"review_%isolation%";"visibleOnDefaultWebsite";"4";"assertReviewCreationSuccessMessage, assertProductReviewInGrid, assertProductRatingOnReviewPage, assertProductRatingInProductPage"
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..faa53940c7422039ea09afdcd72b6549c390e7a5
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php
@@ -0,0 +1,154 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\TestCase;
+
+use Magento\Catalog\Test\Fixture\CatalogProductSimple;
+use Magento\Review\Test\Fixture\ReviewInjectable;
+use Magento\Review\Test\Fixture\Rating;
+use Magento\Review\Test\Page\Adminhtml\RatingEdit;
+use Magento\Review\Test\Page\Adminhtml\RatingIndex;
+use Magento\Review\Test\Page\Adminhtml\ReviewEdit;
+use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
+use Mtf\TestCase\Injectable;
+
+/**
+ * Test Creation for Create ProductReviewEntity Backend
+ *
+ * Test Flow:
+ * Preconditions:
+ * 1. Simple Product created
+ *
+ * Steps:
+ * 1. Login to backend
+ * 2. Navigate to Marketing -> User Content -> Reviews
+ * 3. Click the "+" (Add New Review) button
+ * 4. Select the product in the Products Grid
+ * 5. Fill data according to DataSet
+ * 6. Click "Save Review" button
+ * 7. Perform Asserts
+ *
+ * @group Reviews_and_Ratings_(MX)
+ * @ZephyrId MAGETWO-26476
+ */
+class CreateProductReviewBackendEntityTest extends Injectable
+{
+    /**
+     * ReviewIndex page
+     *
+     * @var ReviewIndex
+     */
+    protected $reviewIndex;
+
+    /**
+     * ReviewEdit page
+     *
+     * @var ReviewEdit
+     */
+    protected $reviewEdit;
+
+    /**
+     * RatingIndex page
+     *
+     * @var RatingIndex
+     */
+    protected $ratingIndex;
+
+    /**
+     * RatingEdit page
+     *
+     * @var RatingEdit
+     */
+    protected $ratingEdit;
+
+    /**
+     * @var Rating
+     */
+    protected $productRating;
+
+    /**
+     * Review fixture
+     *
+     * @var ReviewInjectable
+     */
+    protected $review;
+
+    /**
+     * Inject pages into test
+     *
+     * @param ReviewIndex $reviewIndex
+     * @param ReviewEdit $reviewEdit
+     * @param RatingIndex $ratingIndex
+     * @param RatingEdit $ratingEdit
+     * @return void
+     */
+    public function __inject(
+        ReviewIndex $reviewIndex,
+        ReviewEdit $reviewEdit,
+        RatingIndex $ratingIndex,
+        RatingEdit $ratingEdit
+    ) {
+        $this->reviewIndex = $reviewIndex;
+        $this->reviewEdit = $reviewEdit;
+        $this->ratingIndex = $ratingIndex;
+        $this->ratingEdit = $ratingEdit;
+    }
+
+    /**
+     * Run Create Product Review Entity Backend Test
+     *
+     * @param ReviewInjectable $review
+     * @return void
+     */
+    public function test(ReviewInjectable $review)
+    {
+        // Precondition:
+        $filter = ['id' => $review->getDataFieldConfig('entity_id')['source']->getEntity()->getId()];
+        $this->review = $review;
+
+        // Steps:
+        $this->reviewIndex->open();
+        $this->reviewIndex->getReviewActions()->addNew();
+        $this->reviewEdit->getProductGrid()->searchAndOpen($filter);
+        $this->reviewEdit->getReviewForm()->fill($this->review);
+        $this->reviewEdit->getPageActions()->save();
+    }
+
+    /**
+     * Clear data after test
+     *
+     * @return void
+     */
+    public function tearDown()
+    {
+        $this->ratingIndex->open();
+        $ratingGrid = $this->ratingIndex->getRatingGrid();
+        $pageActions = $this->ratingEdit->getPageActions();
+        foreach ($this->review->getRatings() as $rating) {
+            $filter = ['rating_code' => $rating['title']];
+            $ratingGrid->searchAndOpen($filter);
+            $pageActions->delete();
+        }
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..33384fad3fdf8b662b01168d8b4715075455493d
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest/test.csv
@@ -0,0 +1,4 @@
+"review/data/type";"review/data/entity_id/dataSet";"review/data/status_id";"review/data/select_stores/0";"review/data/ratings/rating_0/dataSet";"review/data/ratings/rating_0/rating";"review/data/nickname";"review/data/title";"review/data/detail";"constraint"
+"Administrator";"catalogProductSimple::default";"Approved";"Main Website/Main Website Store/Default Store View";"visibleOnDefaultWebsite";"3";"John";"title %isolation%";"review detail %isolation%";"assertProductReviewBackendSuccessSaveMessage, assertProductReviewInGrid, assertProductRatingInProductPage"
+"Administrator";"catalogProductSimple::default";"Pending";"Main Website/Main Website Store/Default Store View";"visibleOnDefaultWebsite";"4";"Britney";"title %isolation%";"review detail %isolation%";"assertProductReviewBackendSuccessSaveMessage, assertProductReviewInGrid, assertProductRatingInProductPage"
+"Administrator";"catalogProductSimple::default";"Not Approved";"Main Website/Main Website Store/Default Store View";"visibleOnDefaultWebsite";"5";"Michael";"title %isolation%";"review detail %isolation%";"assertProductReviewBackendSuccessSaveMessage, assertProductReviewInGrid, assertProductRatingInProductPage"
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateFrontendProductReviewEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php
old mode 100755
new mode 100644
similarity index 82%
rename from dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateFrontendProductReviewEntityTest.php
rename to dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php
index fd06461a5a405e12519f3f36a76dfe00218fb1d5..a75bb866639d0f786033c6de1322714ccab093fb
--- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateFrontendProductReviewEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.php
@@ -24,12 +24,10 @@
 
 namespace Magento\Review\Test\TestCase;
 
-use Magento\Catalog\Test\Fixture\CatalogProductSimple;
 use Magento\Catalog\Test\Page\Product\CatalogProductView;
 use Magento\Review\Test\Fixture\ReviewInjectable;
 use Magento\Review\Test\Page\Adminhtml\RatingEdit;
 use Magento\Review\Test\Page\Adminhtml\RatingIndex;
-use Mtf\Fixture\FixtureFactory;
 use Mtf\TestCase\Injectable;
 
 /**
@@ -52,7 +50,7 @@ use Mtf\TestCase\Injectable;
  * @group Reviews_and_Ratings_(MX)
  * @ZephyrId MAGETWO-25519
  */
-class CreateFrontendProductReviewEntityTest extends Injectable
+class CreateProductReviewFrontendEntityTest extends Injectable
 {
     /**
      * Frontend product view page
@@ -82,20 +80,6 @@ class CreateFrontendProductReviewEntityTest extends Injectable
      */
     protected $review;
 
-    /**
-     * Prepare data
-     *
-     * @param FixtureFactory $fixtureFactory
-     * @return array
-     */
-    public function __prepare(FixtureFactory $fixtureFactory)
-    {
-        $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default']);
-        $product->persist();
-
-        return ['product' => $product];
-    }
-
     /**
      * Injection data
      *
@@ -117,22 +101,22 @@ class CreateFrontendProductReviewEntityTest extends Injectable
     /**
      * Run create frontend product rating test
      *
-     * @param CatalogProductSimple $product
      * @param ReviewInjectable $review
      * @return void
      */
-    public function test(
-        CatalogProductSimple $product,
-        ReviewInjectable $review
-    ) {
+    public function test(ReviewInjectable $review)
+    {
         // Prepare for tear down
         $this->review = $review;
 
         // Steps
+        $product = $review->getDataFieldConfig('entity_id')['source']->getEntity();
         $this->catalogProductView->init($product);
         $this->catalogProductView->open();
-        $this->catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
-
+        $reviewLink = $this->catalogProductView->getReviewSummaryBlock()->getAddReviewLink();
+        if ($reviewLink->isVisible()) {
+            $reviewLink->click();
+        }
         $reviewForm = $this->catalogProductView->getReviewFormBlock();
         $reviewForm->fill($review);
         $reviewForm->submit();
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..211299f67a5cb3903eea6ca55548387504075387
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest/test.csv
@@ -0,0 +1,2 @@
+"review/data/nickname";"review/data/title";"review/data/detail";"review/data/ratings/1/dataSet";"review/data/ratings/1/rating";"review/data/entity_id/dataSet";"constraint"
+"name_%isolation%";"title_%isolation%";"review_%isolation%";"visibleOnDefaultWebsite";"4";"catalogProductSimple::default";"assertReviewCreationSuccessMessage, assertProductReviewInGrid, assertProductRatingOnReviewPage, assertProductRatingInProductPage"
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..385c9e70b9af91afee2fafc359d2aade1380f3f3
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest.php
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Review\Test\TestCase;
+
+use Magento\Review\Test\Page\Adminhtml\RatingIndex;
+use Magento\Review\Test\Page\Adminhtml\RatingEdit;
+use Mtf\TestCase\Injectable;
+use Magento\Review\Test\Fixture\ReviewInjectable;
+use Magento\Review\Test\Page\Adminhtml\ReviewIndex;
+use Magento\Catalog\Test\Fixture\CatalogProductSimple;
+
+/**
+ * Test creation for MassActions ProductReviewEntity
+ *
+ * Test Flow:
+ *
+ * Preconditions:
+ * 1. Simple product created
+ * 2. Product Review created on frontend
+ *
+ * Steps:
+ * 1. Login to backend
+ * 2. Navigate to Marketing -> User Content -> Reviews
+ * 3. Search and select review created in precondition
+ * 4. Select Mass Action
+ * 5. Select Action from Dataset
+ * 6. Click "Submit" button
+ * 7. Perform Asserts
+ *
+ * @group Reviews_and_Ratings_(MX)
+ * @ZephyrId MAGETWO-26618
+ */
+class MassActionsProductReviewEntityTest extends Injectable
+{
+    /**
+     * Backend rating grid page
+     *
+     * @var RatingIndex
+     */
+    protected $ratingIndex;
+
+    /**
+     * Backend rating edit page
+     *
+     * @var RatingEdit
+     */
+    protected $ratingEdit;
+
+    /**
+     * Review index page
+     *
+     * @var ReviewIndex
+     */
+    protected $reviewIndex;
+
+    /**
+     * Fixture review
+     *
+     * @var ReviewInjectable
+     */
+    protected $review;
+
+    /**
+     * Injection data
+     *
+     * @param ReviewIndex $reviewIndex
+     * @param RatingIndex $ratingIndex
+     * @param RatingEdit $ratingEdit
+     * @param ReviewInjectable $review
+     * @return array
+     */
+    public function __inject(
+        ReviewIndex $reviewIndex,
+        RatingIndex $ratingIndex,
+        RatingEdit $ratingEdit,
+        ReviewInjectable $review
+    ) {
+        $this->reviewIndex = $reviewIndex;
+        $this->ratingIndex = $ratingIndex;
+        $this->ratingEdit = $ratingEdit;
+        $this->review = $review;
+        $this->review->persist();
+
+        return ['review' => $this->review];
+    }
+
+    /**
+     * Apply for MassActions ProductReviewEntity
+     *
+     * @param string $gridActions
+     * @param string $gridStatus
+     * @return void
+     */
+    public function test($gridActions, $gridStatus)
+    {
+        // Steps
+        $this->reviewIndex->open();
+        $this->reviewIndex->getReviewGrid()->massaction(
+            [['title' => $this->review->getTitle()]],
+            [$gridActions => $gridStatus],
+            ($gridActions == 'Delete' ? true : false)
+        );
+    }
+
+    /**
+     * Clear data after test
+     *
+     * @return void
+     */
+    public function tearDown()
+    {
+        $this->ratingIndex->open();
+        $ratingGrid = $this->ratingIndex->getRatingGrid();
+        $pageActions = $this->ratingEdit->getPageActions();
+        foreach ($this->review->getRatings() as $rating) {
+            $ratingGrid->searchAndOpen(['rating_code' => $rating['title']]);
+            $pageActions->delete();
+        }
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest/test.csv
new file mode 100644
index 0000000000000000000000000000000000000000..9e90a3c34a79c59eb2e6f0fa8e36d2119b1e0b8a
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/MassActionsProductReviewEntityTest/test.csv
@@ -0,0 +1,5 @@
+"gridActions";"gridStatus";"constraint"
+"Update Status";"Approved";"assertProductReviewMassActionSuccessMessage, assertProductReviewInGrid, assertProductRatingInProductPage"
+"Update Status";"Pending";"assertProductReviewMassActionSuccessMessage, assertProductReviewInGrid, assertProductRatingNotInProductPage"
+"Update Status";"Not Approved";"assertProductReviewMassActionSuccessMessage, assertProductReviewInGrid, assertProductRatingNotInProductPage"
+"Delete";"-";"assertProductReviewMassActionSuccessDeleteMessage, assertProductRatingNotInProductPage"
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php
index e44a7a9b271d87922cbcc59dad68171b0e7f5c68..5be0f612f0c4b4d8097910aa481696c9522c7946 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.php
@@ -29,7 +29,6 @@ use Magento\Review\Test\Page\Adminhtml\ReviewEdit;
 use Magento\Review\Test\Page\Adminhtml\RatingIndex;
 use Magento\Review\Test\Page\Adminhtml\RatingEdit;
 use Magento\Review\Test\Fixture\ReviewInjectable;
-use Mtf\Fixture\FixtureFactory;
 use Mtf\TestCase\Injectable;
 
 /**
@@ -90,20 +89,6 @@ class UpdateProductReviewEntityTest extends Injectable
      */
     protected $review;
 
-    /**
-     * Prepare data
-     *
-     * @param FixtureFactory $fixtureFactory
-     * @return array
-     */
-    public function __prepare(FixtureFactory $fixtureFactory)
-    {
-        $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default']);
-        $product->persist();
-
-        return ['product' => $product];
-    }
-
     /**
      * Injection data
      *
diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml b/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml
index cb017639675d82e2f5a6cad8065e49600ed6c59a..24f5b1b58bf4ba79f81dc44e1e57b164603e2df8 100755
--- a/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml
+++ b/dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml
@@ -57,4 +57,19 @@
     <assertProductRatingInProductPage module="Magento_Review">
         <severeness>middle</severeness>
     </assertProductRatingInProductPage>
-</constraint>
+    <assertProductReviewMassActionSuccessMessage module="Magento_Review">
+        <severeness>high</severeness>
+        <require>
+            <reviewIndex class="Magento\Review\Test\Page\Adminhtml\ReviewIndex"/>
+        </require>
+    </assertProductReviewMassActionSuccessMessage>
+    <assertProductReviewMassActionSuccessDeleteMessage module="Magento_Review">
+        <severeness>high</severeness>
+        <require>
+            <reviewIndex class="Magento\Review\Test\Page\Adminhtml\ReviewIndex"/>
+        </require>
+    </assertProductReviewMassActionSuccessDeleteMessage>
+    <assertProductReviewBackendSuccessSaveMessage module="Magento_Review">
+        <severeness>middle</severeness>
+    </assertProductReviewBackendSuccessSaveMessage>
+</constraint>
\ No newline at end of file
diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php
index 88d566f66e392f0d29c83c8c279ad2bf2420ea64..ed3df80928b357f8af554156c5074cd76d3ad2ec 100644
--- a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php
+++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.php
@@ -46,7 +46,6 @@ class Store extends AbstractRepository
             'name' => 'Custom_Store_%isolation%',
             'code' => 'code_%isolation%',
             'is_active' => 'Enabled',
-            'store_id' => 1,
         ];
 
         $this->_data['All Store Views'] = [
diff --git a/dev/tests/integration/.gitignore b/dev/tests/integration/.gitignore
index 7d1c96da626f65fc68c041977a321a2a059c1681..60ecdfd9ed8ee284ae5d8061a164da1dd1525f3d 100644
--- a/dev/tests/integration/.gitignore
+++ b/dev/tests/integration/.gitignore
@@ -1,5 +1,4 @@
 /*.xml
 /etc/*.xml
 !/etc/integration-tests-config.xml
-/tmp/
 /var/
diff --git a/dev/tests/integration/testsuite/Magento/Connect/Controller/Adminhtml/Extension/LocalTest.php b/dev/tests/integration/testsuite/Magento/Connect/Controller/Adminhtml/Extension/LocalTest.php
deleted file mode 100644
index 29032b9c68d0f74f70f54f086e0988f9fcbb86e3..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Connect/Controller/Adminhtml/Extension/LocalTest.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Connect\Controller\Adminhtml\Extension;
-
-/**
- * Test \Magento\Connect\Controller\Adminhtml\Extension\Local
- *
- * @magentoAppArea adminhtml
- */
-class LocalTest extends \Magento\Backend\Utility\Controller
-{
-    public function testIndexAction()
-    {
-        $this->dispatch('backend/admin/extension_local/index');
-        $expected = '?return=' . urlencode(
-            \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
-                'Magento\Backend\Helper\Data'
-            )->getHomePageUrl()
-        );
-        $this->assertRedirect($this->stringEndsWith($expected));
-    }
-}
diff --git a/dev/tests/integration/tmp/.gitignore b/dev/tests/integration/tmp/.gitignore
index 72e8ffc0db8aad71a934dd11e5968bd5109e54b4..a68d087bfe51165cfcd71d2185d9d8a94855728a 100644
--- a/dev/tests/integration/tmp/.gitignore
+++ b/dev/tests/integration/tmp/.gitignore
@@ -1 +1,2 @@
-*
+/*
+!/.gitignore
diff --git a/dev/tests/js/framework/requirejs-util.js b/dev/tests/js/framework/requirejs-util.js
index b0aeac43a83ae4589eb8402f8753acd7b0bc0dd7..84e90d556de84af9d58f1c469d615fa7c568ddd8 100644
--- a/dev/tests/js/framework/requirejs-util.js
+++ b/dev/tests/js/framework/requirejs-util.js
@@ -48,6 +48,10 @@
         });
     };
 
+    window.require = function(dependencies, callback){
+        return callback && callback();
+    };
+
     // Exposed interface
     var requirejsUtil = {
         getDefineArgsInScript: function (scriptPath) {
diff --git a/dev/tests/js/jsTestDriver.php.dist b/dev/tests/js/jsTestDriver.php.dist
index f7f5c70aa6378ed35ab2b17894e464fffec46d3a..8eea3c15c96c91c89a2fce9b78c14ffe0cc9dbee 100644
--- a/dev/tests/js/jsTestDriver.php.dist
+++ b/dev/tests/js/jsTestDriver.php.dist
@@ -30,20 +30,12 @@ return array(
     'server' => 'http://localhost:9876',
     'load' => array(
         '/dev/tests/js/framework',
-        '/lib/web/mage/translate.js',
         '/lib/web/mage/webapi.js',
-        '/lib/web/jquery/jquery-ui-timepicker-addon.js',
+        '/lib/web/mage/validation/validation.js',
         '/lib/web/jquery/jquery.tmpl.min.js',
-        '/dev/tests/js/framework',
-        '/app/code/Magento/DesignEditor/view/adminhtml/web/js/base.js',
-        '/app/code/Magento/DesignEditor/view/adminhtml/web/js/design_editor.js',
-        '/app/code/Magento/DesignEditor/view/frontend/web/js/change/layout.js',
-        '/app/code/Magento/DesignEditor/view/frontend/web/js/design_editor.js',
-        '/app/code/Magento/DesignEditor/view/frontend/web/js/form_deactivation.js',
         '/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js',
         '/lib/web/jquery/jstree/jquery.jstree.js',
-        '/lib/web/jquery/slimScroll/slimScroll.min.js',
-        '/app/code/Magento/DesignEditor/view/frontend/web/css/styles.css',
+        '/lib/web/jquery/jquery-ui-timepicker-addon.js',
         '/lib/web/mage/cookies.js',
         '/lib/web/mage/calendar.js',
         '/lib/web/mage/loader_old.js',
@@ -53,15 +45,12 @@ return array(
         '/lib/web/mage/backend/form.js',
         '/lib/web/mage/backend/button.js',
         '/lib/web/mage/backend/tabs.js',
-        '/lib/web/mage/validation.js',
-        '/lib/web/mage/validation/validation.js',
         '/lib/web/mage/backend/menu.js',
         '/lib/web/mage/backend/suggest.js',
         '/lib/web/mage/backend/tree-suggest.js',
         '/lib/web/mage/gallery.js',
         '/lib/web/mage/gallery-fullscreen.js',
         '/lib/web/mage/zoom.js',
-        '/lib/web/mage/requirejs',
         '/lib/internal/Magento/Framework/RequireJs/paths-updater.js',
     ),
     'test' => array('/dev/tests/js/testsuite'),
diff --git a/dev/tests/js/jsTestDriverOrder.php b/dev/tests/js/jsTestDriverOrder.php
index afe5055617f37b73e4244821fc57c4a1320a4b1e..dceed96242d8605e01ad2e32d46725c86b5f8d4a 100644
--- a/dev/tests/js/jsTestDriverOrder.php
+++ b/dev/tests/js/jsTestDriverOrder.php
@@ -31,9 +31,11 @@ return array(
     '/lib/web/jquery/jquery-ui-1.9.2.js',
     '/dev/tests/js/framework/requirejs-util.js',
     '/lib/web/jquery/jquery.cookie.js',
-    '/lib/web/headjs/head.min.js',
     '/lib/web/mage/mage.js',
     '/lib/web/mage/decorate.js',
     '/lib/web/jquery/jquery.validate.js',
-    '/lib/web/jquery/jquery.metadata.js'
+    '/lib/web/jquery/jquery.metadata.js',
+    '/lib/web/mage/translate.js',
+    '/lib/web/mage/validation.js',
+    '/lib/web/mage/requirejs/plugin/id-normalizer.js',
 );
diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php
index 4b3ca23fce0a85951ad4f6ad5bf25bf7b65f5d6c..7d0990be9448e55efc0034daac9c5ceb130e1cb4 100644
--- a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php
+++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php
@@ -138,7 +138,6 @@ class Files
                     $files,
                     glob($this->_path . '/*.php', GLOB_NOSORT),
                     glob($this->_path . '/pub/*.php', GLOB_NOSORT),
-                    self::getFiles(array("{$this->_path}/downloader"), '*.php'),
                     self::getFiles(array("{$this->_path}/lib/internal/Magento"), '*.php')
                 );
             }
@@ -160,8 +159,6 @@ class Files
      * @param bool $appCode   application PHP-code
      * @param bool $devTests
      * @param bool $devTools
-     * @param bool $downloaderApp
-     * @param bool $downloaderLib
      * @param bool $lib
      * @param bool $asDataSet
      * @return array
@@ -170,13 +167,10 @@ class Files
         $appCode = true,
         $devTests = true,
         $devTools = true,
-        $downloaderApp = true,
-        $downloaderLib = true,
         $lib = true,
         $asDataSet = true
     ) {
-        $key = __METHOD__ .
-            "/{$this->_path}/{$appCode}/{$devTests}/{$devTools}/{$downloaderApp}/{$downloaderLib}/{$lib}";
+        $key = __METHOD__ . "/{$this->_path}/{$appCode}/{$devTests}/{$devTools}/{$lib}";
         if (!isset(self::$_cache[$key])) {
             $files = array();
             if ($appCode) {
@@ -188,12 +182,6 @@ class Files
             if ($devTools) {
                 $files = array_merge($files, self::getFiles(array("{$this->_path}/dev/tools/Magento"), '*.php'));
             }
-            if ($downloaderApp) {
-                $files = array_merge($files, self::getFiles(array("{$this->_path}/downloader/app/Magento"), '*.php'));
-            }
-            if ($downloaderLib) {
-                $files = array_merge($files, self::getFiles(array("{$this->_path}/downloader/lib/Magento"), '*.php'));
-            }
             if ($lib) {
                 $files = array_merge($files, self::getFiles(array("{$this->_path}/lib/internal/Magento"), '*.php'));
             }
@@ -810,7 +798,6 @@ class Files
             array(
                 $this->_path . '/app',
                 $this->_path . '/dev',
-                $this->_path . '/downloader',
                 $this->_path . '/lib',
                 $this->_path . '/pub'
             ),
@@ -895,8 +882,6 @@ class Files
         $directories = array(
             '/app/code/',
             '/lib/internal/',
-            '/downloader/app/',
-            '/downloader/lib/',
             '/dev/tools/',
             '/dev/tools/performance_toolkit/framework/',
             '/dev/tests/api-functional/framework/',
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
index 441961d6108c250fa0d3d34df409188c74ddcdf2..3c0c04016c560cc66be83c9c4cc650bf5ecbd8f2 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
@@ -487,8 +487,6 @@ class ClassesTest extends \PHPUnit_Framework_TestCase
             $directories = array(
                 '/app/code/',
                 '/lib/internal/',
-                '/downloader/app/',
-                '/downloader/lib/',
                 '/dev/tools/',
                 '/dev/tests/api-functional/framework/',
                 '/dev/tests/functional/',
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
index 181f59a67f9c97396fc95603128adb717abfb08b..2173e3ef6eab5229cb6686d3d408bfde9302cc9a 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
@@ -212,8 +212,6 @@ class CompilerTest extends \PHPUnit_Framework_TestCase
             true,
             false,
             false,
-            false,
-            false,
             true,
             false
         );
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
index 5777d5534eb8b99b9630478216aa250c9199f6cd..b122b0c2721a6aa155ccc270addcfa0b3f500343 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php
@@ -129,7 +129,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase
         // @TODO: remove this code when class Magento\Framework\Data\Collection will fixed
         include_once BP . '/lib/internal/Magento/Framework/Option/ArrayInterface.php';
         $blackList = file(__DIR__ . '/_files/blacklist.txt', FILE_IGNORE_NEW_LINES);
-        $dataProvider = Files::init()->getClassFiles(false, false, false, false, false, true, true);
+        $dataProvider = Files::init()->getClassFiles(false, false, false, true, true);
 
         foreach ($dataProvider as $key => $data) {
             $file = str_replace(BP . '/', '', $data[0]);
diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt
index ce70c8d4b4817ecd14637bafb3660ed360668ee5..6420dba12a5f1c1711cd17a6148b2af21063b5ed 100644
--- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt
@@ -16,7 +16,5 @@ app/code/Magento/Theme/view/frontend/web/menu.js
 dev/tests/js/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js
 dev/tests/js/framework/qunit
 lib/web/mage/adminhtml
-lib/web/mage/backend/editablemultiselect.js
 lib/web/mage/captcha.js
-lib/web/mage/flex.js
 lib/web/mage/jquery-no-conflict.js
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php
index dc61a100b122d948c71a7cf76fe917603ff15c8f..4390073473123f3e187f3294eeb7abc73701eb13 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LicenseTest.php
@@ -66,7 +66,6 @@ class LicenseTest extends \PHPUnit_Framework_TestCase
             $rootFolderName . '/[^/]+\.' . $extensions,
             $rootFolderName . '/app/.+\.' . $extensions,
             $rootFolderName . '/dev/(?!tests/integration/tmp|tests/functional).+\.' . $extensions,
-            $rootFolderName . '/downloader/.+\.' . $extensions,
             $rootFolderName . '/lib/internal/(Mage|Magento|Varien)/.+\.' . $extensions,
             $rootFolderName . '/pub/.+\.' . $extensions
         );
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
index 18fcb1f839cd23490b63ceff0f7c6ab06b115782..3f2e8d2e56270539cce3e87ab8a6f8fa06af7ded 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
@@ -604,8 +604,6 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase
             true,
             true,
             true,
-            true,
-            true,
             false
         );
         $files = array_map('realpath', $files);
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
index 0feded3cb23129449e1a33130bc04d6257c4d8fa..9bc2ac19e07cc7642e0f7a3ca2dc9316d6d764ce 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -2456,7 +2456,6 @@ return array(
     ['Magento\Logger', 'Magento\Framework\Logger'],
     ['Magento\Phrase', 'Magento\Framework\Phrase'],
     ['Magento\Pear', 'Magento\Framework\Pear'],
-    ['Magento\Connect\Channel\Generator', 'Magento\Framework\Connect\Channel\Generator'],
     [
         'Magento\ImportExport\Model\Export\Product\Type\AbstractType',
         'Magento\CatalogImportExport\Model\Export\Product\Type\AbstractType'
@@ -2523,33 +2522,6 @@ return array(
         'Magento\ImportExport\Model\Resource\Customer\Collection',
         'Magento\CustomerFinance\Model\Resource\Customer\Collection'
     ],
-    ['Magento\Connect\Channel\VO', 'Magento\Framework\Connect\Channel\VO'],
-    ['Magento\Connect\Command\Channels', 'Magento\Framework\Connect\Command\Channels'],
-    ['Magento\Connect\Command\Config', 'Magento\Framework\Connect\Command\Config'],
-    ['Magento\Connect\Command\Install', 'Magento\Framework\Connect\Command\Install'],
-    ['Magento\Connect\Command\Package', 'Magento\Framework\Connect\Command\Package'],
-    ['Magento\Connect\Command\Registry', 'Magento\Framework\Connect\Command\Registry'],
-    ['Magento\Connect\Command\Remote', 'Magento\Framework\Connect\Command\Remote'],
-    ['Magento\Connect\Frontend\CLI', 'Magento\Framework\Connect\Frontend\CLI'],
-    ['Magento\Connect\Loader\Ftp', 'Magento\Framework\Connect\Loader\Ftp'],
-    ['Magento\Connect\Package\Hotfix', 'Magento\Framework\Connect\Package\Hotfix'],
-    ['Magento\Connect\Package\Reader', 'Magento\Framework\Connect\Package\Reader'],
-    ['Magento\Connect\Package\Target', 'Magento\Framework\Connect\Package\Target'],
-    ['Magento\Connect\Package\VO', 'Magento\Framework\Connect\Package\VO'],
-    ['Magento\Connect\Package\Writer', 'Magento\Framework\Connect\Package\Writer'],
-    ['Magento\Connect\Structures\Graph', 'Magento\Framework\Connect\Structures\Graph'],
-    ['Magento\Connect\Structures\Node', 'Magento\Framework\Connect\Structures\Node'],
-    ['Magento\Connect\Command', 'Magento\Framework\Connect\Command'],
-    ['Magento\Connect\Config', 'Magento\Framework\Connect\Config'],
-    ['Magento\Connect\Converter', 'Magento\Framework\Connect\Converter'],
-    ['Magento\Connect\Frontend', 'Magento\Framework\Connect\Frontend'],
-    ['Magento\Connect\Ftp', 'Magento\Framework\Connect\Ftp'],
-    ['Magento\Connect\Loader', 'Magento\Framework\Connect\Loader'],
-    ['Magento\Connect\Package', 'Magento\Framework\Connect\Package'],
-    ['Magento\Connect\Packager', 'Magento\Framework\Connect\Packager'],
-    ['Magento\Connect\Rest', 'Magento\Framework\Connect\Rest'],
-    ['Magento\Connect\Singleconfig', 'Magento\Framework\Connect\Singleconfig'],
-    ['Magento\Connect\Validator', 'Magento\Framework\Connect\Validator'],
     ['Magento\Profiler', 'Magento\Framework\Profiler'],
     ['Magento\Shell', 'Magento\Framework\Shell'],
     ['Magento\Url', 'Magento\Framework\Url'],
@@ -2722,6 +2694,8 @@ return array(
     ['Magento\Tax\Model\Resource\Rule\Grid\Options\HashOptimized'],
     ['Magento\Tax\Model\Resource\Rule\Grid\Options\ProductTaxClass'],
     ['Magento\SalesArchive\Block\Adminhtml\Sales\Order\Grid\Massaction'],
+    ['Magento\Framework\System\Args'],
+    ['Magento\Framework\Autoload\Simple'],
     ['Magento\Catalog\Helper\Product\Price'],
     ['Magento\Tax\Model\Config\Source\TaxClass\Product', 'Magento\Tax\Model\TaxClass\Source\Product'],
     ['Magento\Tax\Model\Config\Source\TaxClass\Customer', 'Magento\Tax\Model\TaxClass\Source\Customer'],
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
index fd30dd301cd457ed4f7bc6b01dd28f59aa465aeb..837c22f270a322164ce8cf33d6c463b8fd715649 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
@@ -534,7 +534,6 @@ return array(
     array('getPriceFormatted', 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\Sales'),
     array('getPrices', 'Magento\Bundle\Model\Product\Price', 'getTotalPrices()'),
     array('getPricesDependingOnTax', 'Magento\Bundle\Model\Product\Price', 'getTotalPrices()'),
-    array('getPriceTaxSql', 'Magento\Tax\Helper\Data'),
     array('getPrintUrl', 'Magento\Checkout\Block\Onepage\Success'),
     array('getPrintUrl', 'Magento\Sales\Block\Order\Info'),
     array('getProduct', 'Magento\Catalog\Model\Product\Type\AbstractType'),
@@ -1004,7 +1003,6 @@ return array(
     array('getHelper', 'Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute\Collection'),
     array('getHelper', 'Magento\Cms\Model\Wysiwyg\Images\Storage'),
     array('getCatalogHelper', 'Magento\Backend\Block\Catalog\Category\Tabs'),
-    array('getStabilityOptions', 'Magento\Connect\Model\Extension'),
     array('_getSession', 'Magento\Centinel\Model\Service'),
     array('_getValidationStateModel', 'Magento\Centinel\Model\Service'),
     array('_getIndexer', 'Magento\Index\Model\Shell'),
@@ -1304,8 +1302,6 @@ return array(
     array('getDataHelperName', 'Magento\Backend\Block\Dashboard\AbstractDashboard'),
     array('setDataHelperName', 'Magento\Backend\Block\Dashboard\AbstractDashboard'),
     array('addStoresToCollection', '\Magento\Review\Model\Resource\Rating\Collection'),
-    array('getLocalPackagesPath', 'Magento\Connect\Helper\Data'),
-    array('getLocalPackagesPathV1x', 'Magento\Connect\Helper\Data'),
     array('getSessionSaveMethod', '\Magento\Core\Model\Session\AbstractSession', '\Magento\Core\Model\Session\Config'),
     array('setSessionName', '\Magento\Core\Model\Session\AbstractSession', 'setName'),
     array('getCode', '\Magento\Framework\Message\AbstractMessage', 'getText'),
@@ -1802,5 +1798,9 @@ return array(
     ['translateArray', 'Magento\Framework\App\Helper\AbstractHelper'],
     ['getCalculator', '\Magento\Tax\Helper\Data'],
     ['getRatesForAllProductTaxClasses', 'Magento\Tax\Model\Calculation'],
-    ['getRatesForAllCustomerTaxClasses', 'Magento\Tax\Model\Calculation']
+    ['getRatesForAllCustomerTaxClasses', 'Magento\Tax\Model\Calculation'],
+    ['prepareCatalogProductIndexSelect', 'Magento\CatalogInventory\Model\Observer'],
+    ['prepareCatalogProductIndexSelect', 'Magento\CatalogInventory\Model\Resource\Stock\Status'],
+    ['prepareCatalogProductIndexSelect', 'Magento\CatalogInventory\Model\Stock\Status'],
+    ['getDeleteUrl','\Magento\Checkout\Block\Cart\Item\Renderer'],
 );
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php
index fbadab6220d1dac624f3e9906c4a489c1c627920..a5d35beee4a006da414e024315133477416e99d7 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php
@@ -82,4 +82,6 @@ return [
     ['Magento\Image', 'Magento\Framework\Image'],
     ['Magento\Oauth', 'Magento\Framework\Oauth'],
     ['Magento\Object', 'Magento\Framework\Object'],
+    ['Magento\Connect'],
+    ['Magento\Framework\Connect'],
 ];
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php
index 4045a4e47971c31586ed9589d47f2d7272cae43c..453ffd8bc7c4508a3216cdffb36da40bef4ab9d2 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php
@@ -145,7 +145,9 @@ return [
     ['/lib/Magento/Pricing', '/lib/Magento/Framework/Pricing'],
     ['/dev/tests/integration/testsuite/Magento/Pricing', '/dev/tests/integration/testsuite/Magento/Framework/Pricing'],
     ['/dev/tests/unit/testsuite/Magento/Pricing', '/dev/tests/unit/testsuite/Magento/Framework/Pricing'],
-    ['/lib/Magento/Connect', '/lib/Magento/Framework/Connect'],
+    ['/lib/Magento/Connect'],
+    ['/lib/Magento/Framework/Connect'],
+    ['/lib/internal/Magento/Framework/Connect'],
     ['/lib/Magento/Profiler', '/lib/Magento/Framework/Profiler'],
     ['/dev/tests/unit/testsuite/Magento/Profiler', '/dev/tests/unit/testsuite/Magento/Framework/Profiler'],
     [
@@ -242,4 +244,5 @@ return [
     ['/lib/Magento/Object', '/lib/Magento/Framework/Object'],
     ['/dev/tests/unit/testsuite/Magento/Object', '/dev/tests/unit/testsuite/Magento/Framework/Object'],
     ['/dev/tests/integration/testsuite/Magento/Object', '/dev/tests/integration/testsuite/Magento/Framework/Object'],
+    ['/downloader'],
 ];
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
index fa620e572b00cde146d396d7214341701197ea25..5756c6e27efc0cdf3d81bdfddbb2466baf7de921 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
@@ -274,7 +274,6 @@ return array(
     array('_frameOpenTag', 'Magento\Framework\View\Element\AbstractBlock'),
     array('_frameCloseTag', 'Magento\Framework\View\Element\AbstractBlock'),
     array('_messagesBlock', 'Magento\Framework\View\Element\AbstractBlock'),
-    array('_messagesBlock', 'Magento\Connect\Helper\Data'),
     array('escapeMessageFlag', 'Magento\Framework\View\Block\Messages'),
     array('_handlerFactory', 'Magento\Backend\Block\Widget\Grid\Massaction\Additional'),
     array('_flatResourceFactory', 'Magento\Catalog\Model\Observer'),
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt
index 54ea92a6e2f4ebd8ba0705310f5cc131498a7c44..ef94888aee5b7e61cd3e347ba90e74d78a00e7a8 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt
@@ -39,13 +39,11 @@ dev/tests/unit/testsuite/Magento/Framework/View/TemplateEngine/_files
 dev/tools/Magento/Tools/I18n/Zend
 lib/internal/Magento/Framework/App/Config/Element.php
 lib/internal/Magento/Framework/Archive
-lib/internal/Magento/Framework/Autoload/Simple.php
 lib/internal/Magento/Framework/Backup
 lib/internal/Magento/Framework/Cache/Backend/Database.php
 lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php
 lib/internal/Magento/Framework/Cache/Backend/Memcached.php
 lib/internal/Magento/Framework/Cache/Core.php
-lib/internal/Magento/Framework/Connect
 lib/internal/Magento/Framework/Data/Collection.php
 lib/internal/Magento/Framework/Data/Collection/Db.php
 lib/internal/Magento/Framework/Data/Collection/Db/FetchStrategy/Cache.php
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
index f33297f898b91182cb7fa2300d6470bdcd75ca25..139b4d8797a2ed9e2738e0fbade3ab5fc7232684 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
@@ -8,7 +8,6 @@ Magento/Catalog/Model/Category/Indexer
 Magento/Catalog/Model/Product
 Magento/Core/Model/Resource/Design
 Zend
-downloader
 dev
 Mysql
 lib/internal/Magento/Framework/DB
@@ -27,7 +26,6 @@ Magento/Centinel/Controller
 Magento/Centinel/Model/State
 Magento/Checkout/Block/Multishipping
 Magento/Checkout/Model/Type
-Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab
 Magento/Catalog/Model/Template
 Magento/Cms/Model
 Magento/GiftMessage/Model
@@ -98,7 +96,6 @@ Magento/Widget/Model/Widget/Instance
 Magento/Wishlist/Block
 Magento/Wishlist/Model
 lib/internal/Magento/Framework/Archive
-lib/internal/Magento/Framework/Connect/Channel
 lib/internal/Magento/Framework/HTTP/Client
 lib/internal/Magento/Framework/Acl
 lib/internal/PEAR
@@ -109,7 +106,6 @@ Magento/Cron/Model
 Magento/SalesRule/Model/Resource/Report/Rule
 Magento/SalesRule/Model/Resource/Rule
 Magento/SalesRule/Model/Quote/Nominal
-Magento/Connect/Block/Adminhtml/Extension/Custom/Edit
 Magento/Tax/Model/Sales/Total/Quote/Nominal
 Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit
 Magento/User/Block/User/Edit
@@ -126,3 +122,4 @@ Magento/Dhl/Model
 Magento/Shipping/Model
 Magento/Catalog/Service/V1/Category
 Magento/UrlRedirect/Model
+setup
\ No newline at end of file
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt
index 28df010a7c21092a9211204402c59aef10cae5b6..bd9a1028a5ede1523e4f9b691a9fdbac68e25b3f 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt
@@ -3,8 +3,6 @@
 #
 app
 dev
-downloader/app/Magento
-downloader/lib/Magento
 index.php
 lib/internal/Magento
 pub
diff --git a/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php b/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..160b2550d33ba0be802275530582ba5fa29a192f
--- /dev/null
+++ b/dev/tests/static/testsuite/Magento/Test/Tools/Composer/RootComposerMappingTest.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Test\Tools\Composer;
+
+use \Magento\Tools\Composer\Package\Reader;
+
+/**
+ * Class RootComposerMappingTest
+ */
+class RootComposerMappingTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test existence of paths for marshalling
+     * @return void
+     */
+    public function testMapping()
+    {
+        //Checking existence of composer components
+        $reader = new Reader(BP . '/dev/tools/Magento/Tools/Composer');
+        $patterns = $reader->getPatterns();
+        $counter = 0;
+        $count = count($patterns);
+        for ($i = 0; $i < $count; $i++) {
+            if (file_exists(BP . '/' . $patterns[$i])) {
+                $counter++;
+            }
+        }
+
+        $this->assertEquals($count, $counter);
+
+        //Checking existence of customizable paths
+        $customizablePaths = $reader->getCustomizablePaths();
+        $counter = 0;
+        $count = count($customizablePaths);
+        for ($i = 0; $i < $count; $i++) {
+            if (file_exists(BP . '/' . str_replace('*', '', $customizablePaths[$i]))) {
+                $counter++;
+            }
+        }
+
+        $this->assertEquals($count, $counter);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/CartTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/CartTest.php
index 4792118e686ddd7df1c793b04e068ee5aa52f988..39e12d61df8003716f27b27a65f4b90181c2574d 100644
--- a/dev/tests/unit/testsuite/Magento/Checkout/Helper/CartTest.php
+++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/CartTest.php
@@ -25,6 +25,7 @@ namespace Magento\Checkout\Helper;
 
 use \Magento\Framework\App\Action\Action;
 use \Magento\Framework\Object;
+use Magento\Sales\Model\Quote\Item;
 
 class CartTest extends \PHPUnit_Framework_TestCase
 {
@@ -206,4 +207,89 @@ class CartTest extends \PHPUnit_Framework_TestCase
         $this->urlBuilderMock->expects($this->once())->method('getUrl')->with('checkout/cart/add', $params);
         $this->helper->getAddUrl($productMock, array('custom_param' => 'value'));
     }
+
+    /**
+     * @param integer $id
+     * @param string $url
+     * @param bool $isAjax
+     * @param string $expectedPostData
+     *
+     * @dataProvider deletePostJsonDataProvider
+     */
+    public function testGetDeletePostJson($id, $url, $isAjax, $expectedPostData)
+    {
+        $storeManager = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface');
+        $coreData = $this->getMock('\Magento\Core\Helper\Data', array(), array(), '', false);
+        $scopeConfig = $this->getMockForAbstractClass('\Magento\Framework\App\Config\ScopeConfigInterface');
+        $checkoutCart = $this->getMock('\Magento\Checkout\Model\Cart', array(), array(), '', false);
+        $checkoutSession = $this->getMock('\Magento\Checkout\Model\Session', array(), array(), '', false);
+
+        $context = $this->getMock('\Magento\Framework\App\Helper\Context', array(), array(), '', false);
+        $urlBuilder = $this->getMock('Magento\Framework\UrlInterface');
+        $context->expects($this->once())
+            ->method('getUrlBuilder')
+            ->will($this->returnValue($urlBuilder));
+
+
+        $item = $this->getMock('Magento\Sales\Model\Quote\Item', array(), array(), '', false);
+        $request = $this->getMock('\Magento\Framework\App\Request\Http', array(), array(), '', false);
+        $context->expects($this->once())
+            ->method('getRequest')
+            ->will($this->returnValue($request));
+
+        $helper = new Cart(
+            $context,
+            $storeManager,
+            $coreData,
+            $scopeConfig,
+            $checkoutCart,
+            $checkoutSession
+        );
+
+        $item->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue($id));
+
+        $request->expects($this->once())
+            ->method('isAjax')
+            ->will($this->returnValue($isAjax));
+
+        $urlBuilder->expects($this->any())
+            ->method('getCurrentUrl')
+            ->will($this->returnValue($url));
+
+        $urlBuilder->expects($this->once())
+            ->method('getUrl')
+            ->will($this->returnValue($url));
+
+        $result = $helper->getDeletePostJson($item);
+        $this->assertEquals($expectedPostData, $result);
+    }
+
+    /**
+     * @return array
+     */
+    public function deletePostJsonDataProvider()
+    {
+        $url = 'http://localhost.com/dev/checkout/cart/delete/';
+        $uenc = strtr(base64_encode($url), '+/=', '-_,');
+        $id = 1;
+        $expectedPostData1 = json_encode(
+            array(
+                'action' => $url,
+                'data' => array('id' => $id, 'uenc' => $uenc)
+            )
+        );
+        $expectedPostData2 = json_encode(
+            array(
+                'action' => $url,
+                'data' => array('id' => $id)
+            )
+        );
+
+        return array(
+            array($id, $url, false, $expectedPostData1),
+            array($id, $url, true, $expectedPostData2),
+        );
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/MediaTest.php b/dev/tests/unit/testsuite/Magento/Framework/Backup/MediaTest.php
index 442cc1e875da52f718970c7b7657d6f18f635683..e348385cab3962d73bb729d784f65798ef8637eb 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Backup/MediaTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Backup/MediaTest.php
@@ -26,6 +26,7 @@ namespace Magento\Framework\Backup;
 require_once __DIR__ . '/_files/Fs.php';
 require_once __DIR__ . '/_files/Helper.php';
 require_once __DIR__ . '/_files/io.php';
+require_once __DIR__ . '/_files/app_dirs.php';
 
 class MediaTest extends \PHPUnit_Framework_TestCase
 {
@@ -84,7 +85,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase
     {
         $this->_backupFactoryMock->expects($this->once())->method('create');
 
-        $rootDir = __DIR__ . '/_files/data';
+        $rootDir = TESTS_TEMP_DIR . '/Magento/Backup/data';
 
         $model = new \Magento\Framework\Backup\Media($this->_filesystemMock, $this->_backupFactoryMock);
         $model->setRootDir($rootDir);
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/NomediaTest.php b/dev/tests/unit/testsuite/Magento/Framework/Backup/NomediaTest.php
index 6ba27c2e09dddd20e23e1ae0126d11db041438f8..a5c598c3fecb5717803619339a70833163512480 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Backup/NomediaTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Backup/NomediaTest.php
@@ -26,6 +26,7 @@ namespace Magento\Framework\Backup;
 require_once __DIR__ . '/_files/Fs.php';
 require_once __DIR__ . '/_files/Helper.php';
 require_once __DIR__ . '/_files/io.php';
+require_once __DIR__ . '/_files/app_dirs.php';
 
 class NomediaTest extends \PHPUnit_Framework_TestCase
 {
@@ -84,7 +85,7 @@ class NomediaTest extends \PHPUnit_Framework_TestCase
     {
         $this->_backupFactoryMock->expects($this->once())->method('create');
 
-        $rootDir = __DIR__ . '/_files/data';
+        $rootDir = TESTS_TEMP_DIR . '/Magento/Backup/data';
 
         $model = new \Magento\Framework\Backup\Nomedia($this->_filesystemMock, $this->_backupFactoryMock);
         $model->setRootDir($rootDir);
diff --git a/downloader/lib/Magento/Framework/Backup/Exception/FtpConnectionFailed.php b/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/app_dirs.php
similarity index 77%
rename from downloader/lib/Magento/Framework/Backup/Exception/FtpConnectionFailed.php
rename to dev/tests/unit/testsuite/Magento/Framework/Backup/_files/app_dirs.php
index 762b625b4c027e47c57b51e16de8b6130559c7aa..cf06fa3abe8fd69c7662a5462d7e536a91f5634d 100644
--- a/downloader/lib/Magento/Framework/Backup/Exception/FtpConnectionFailed.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/app_dirs.php
@@ -23,12 +23,12 @@
  */
 
 /**
- * \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Create directories structure as in application
  */
-namespace Magento\Framework\Backup\Exception;
-
-class FtpConnectionFailed extends \Magento\Framework\Backup\BackupException
-{
+$appDirs = ['code', 'media', 'pub/media', 'var/log'];
+foreach ($appDirs as $dir) {
+    $appDir = TESTS_TEMP_DIR . '/Magento/Backup/data/' . $dir;
+    if (!is_dir($appDir)) {
+        mkdir($appDir, 0777, true);
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/.gitignore b/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/.gitignore
deleted file mode 100644
index 22e83649f7d5219bb31ce45bd7e986e57ea4e72e..0000000000000000000000000000000000000000
--- a/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/*
\ No newline at end of file
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/media/.gitignore b/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/media/.gitignore
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/pub/media/.gitignore b/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/pub/media/.gitignore
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/var/log/.gitignore b/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/var/log/.gitignore
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/dev/tests/unit/testsuite/Magento/Framework/_files/Archive/archives/.gitignore b/dev/tests/unit/testsuite/Magento/Framework/_files/Archive/archives/.gitignore
index 22e83649f7d5219bb31ce45bd7e986e57ea4e72e..a68d087bfe51165cfcd71d2185d9d8a94855728a 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/_files/Archive/archives/.gitignore
+++ b/dev/tests/unit/testsuite/Magento/Framework/_files/Archive/archives/.gitignore
@@ -1 +1,2 @@
-/*
\ No newline at end of file
+/*
+!/.gitignore
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php
index ff951321b56679e9d07f943cf86b284e0f863407..4f902eadd6cf790730f16ef3d5d9b8ba38a47cd5 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/OrderTest.php
@@ -30,62 +30,162 @@ namespace Magento\Sales\Model;
 class OrderTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * Prepare items for the order
-     *
-     * @param \PHPUnit_Framework_MockObject_MockObject $order
-     * @param bool $allInvoiced
+     * @var \PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $paymentCollectionFactoryMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject
      */
-    protected function _prepareOrderItems($order, $allInvoiced)
+    protected $orderItemCollectionFactoryMock;
+
+    /**
+     * @var \Magento\Sales\Model\Order
+     */
+    protected $order;
+
+    protected function setUp()
     {
-        $items = array();
-        if (!$allInvoiced) {
-            $item = $this->getMockBuilder(
-                'Magento\Sales\Model\Order\Item'
-            )->setMethods(
-                array('getQtyToInvoice', 'isDeleted', '__wakeup')
-            )->disableOriginalConstructor()->getMock();
-            $item->expects($this->any())->method('getQtyToInvoice')->will($this->returnValue(1));
-            $item->expects($this->any())->method('isDeleted')->will($this->returnValue(false));
-            $items[] = $item;
-        }
+        $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->paymentCollectionFactoryMock = $this->getMock(
+            'Magento\Sales\Model\Resource\Order\Payment\CollectionFactory',
+            ['create'],
+            [],
+            '',
+            false
+        );
+        $this->orderItemCollectionFactoryMock = $this->getMock(
+            'Magento\Sales\Model\Resource\Order\Item\CollectionFactory',
+            ['create'],
+            [],
+            '',
+            false
+        );
 
-        $itemsProperty = new \ReflectionProperty('Magento\Sales\Model\Order', '_items');
-        $itemsProperty->setAccessible(true);
-        $itemsProperty->setValue($order, $items);
+        $this->order = $helper->getObject(
+            'Magento\Sales\Model\Order',
+            [
+                'paymentCollectionFactory' => $this->paymentCollectionFactoryMock,
+                'orderItemCollectionFactory' => $this->orderItemCollectionFactoryMock
+            ]
+        );
+    }
+
+    public function testCanCancelCanUnhold()
+    {
+        $this->order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD, true);
+        $this->order->setState(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW);
+        $this->assertFalse($this->order->canCancel());
+    }
+
+    public function testCanCancelIsPaymentReview()
+    {
+        $this->order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD, false);
+        $this->order->setState(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW);
+        $this->assertFalse($this->order->canCancel());
+    }
+
+    public function testCanCancelCanReviewPayment()
+    {
+        $paymentMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Payment')
+            ->disableOriginalConstructor()
+            ->setMethods(['isDeleted', 'canReviewPayment', 'canFetchTransactionInfo'])
+            ->getMock();
+        $paymentMock->expects($this->once())
+            ->method('canReviewPayment')
+            ->will($this->returnValue(false));
+        $paymentMock->expects($this->once())
+            ->method('canFetchTransactionInfo')
+            ->will($this->returnValue(true));
+
+        $this->preparePaymentMock($paymentMock);
+
+        $this->order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD, false);
+        $this->order->setState(\Magento\Sales\Model\Order::STATE_NEW);
+        $this->assertFalse($this->order->canCancel());
+    }
+
+    public function testCanCancelAllInvoiced()
+    {
+        $paymentMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Payment')
+            ->disableOriginalConstructor()
+            ->setMethods(['isDeleted', 'canReviewPayment', 'canFetchTransactionInfo'])
+            ->getMock();
+        $paymentMock->expects($this->once())
+            ->method('canReviewPayment')
+            ->will($this->returnValue(false));
+        $paymentMock->expects($this->once())
+            ->method('canFetchTransactionInfo')
+            ->will($this->returnValue(false));
+
+        $this->preparePaymentMock($paymentMock);
+
+        $this->prepareItemMock(0);
+
+        $this->order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD, false);
+        $this->order->setState(\Magento\Sales\Model\Order::STATE_NEW);
+        $this->assertFalse($this->order->canCancel());
+    }
+
+    public function testCanCancelState()
+    {
+        $paymentMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Payment')
+            ->disableOriginalConstructor()
+            ->setMethods(['isDeleted', 'canReviewPayment', 'canFetchTransactionInfo'])
+            ->getMock();
+        $paymentMock->expects($this->once())
+            ->method('canReviewPayment')
+            ->will($this->returnValue(false));
+        $paymentMock->expects($this->once())
+            ->method('canFetchTransactionInfo')
+            ->will($this->returnValue(false));
+
+        $this->preparePaymentMock($paymentMock);
+
+        $this->prepareItemMock(1);
+        $this->order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD, false);
+        $this->order->setState(\Magento\Sales\Model\Order::STATE_CANCELED);
+        $this->assertFalse($this->order->canCancel());
     }
 
     /**
-     * Prepare payment for the order
-     *
-     * @param \PHPUnit_Framework_MockObject_MockObject $order
-     * @param array $mockedMethods
-     * @return \Magento\Sales\Model\Order\Payment|\PHPUnit_Framework_MockObject_MockObject
+     * @param bool $cancelActionFlag
+     * @dataProvider dataProviderActionFlag
      */
-    protected function _prepareOrderPayment($order, $mockedMethods = array())
+    public function testCanCancelActionFlag($cancelActionFlag)
     {
-        $payment = $this->getMockBuilder('Magento\Sales\Model\Order\Payment')->disableOriginalConstructor()->getMock();
-        foreach ($mockedMethods as $method => $value) {
-            $payment->expects($this->any())->method($method)->will($this->returnValue($value));
-        }
-        $payment->expects($this->any())->method('isDeleted')->will($this->returnValue(false));
+        $paymentMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Payment')
+            ->disableOriginalConstructor()
+            ->setMethods(['isDeleted', 'canReviewPayment', 'canFetchTransactionInfo'])
+            ->getMock();
+        $paymentMock->expects($this->once())
+            ->method('canReviewPayment')
+            ->will($this->returnValue(false));
+        $paymentMock->expects($this->once())
+            ->method('canFetchTransactionInfo')
+            ->will($this->returnValue(false));
 
-        $itemsProperty = new \ReflectionProperty('Magento\Sales\Model\Order', '_payments');
-        $itemsProperty->setAccessible(true);
-        $itemsProperty->setValue($order, array($payment));
-        return $payment;
+        $this->preparePaymentMock($paymentMock);
+
+        $this->prepareItemMock(1);
+
+        $actionFlags= [
+            \Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD => false,
+            \Magento\Sales\Model\Order::ACTION_FLAG_CANCEL => $cancelActionFlag
+        ];
+        foreach ($actionFlags as $action => $flag) {
+            $this->order->setActionFlag($action, $flag);
+        }
+        $this->order->setState(\Magento\Sales\Model\Order::STATE_NEW);
+        $this->assertEquals($cancelActionFlag, $this->order->canCancel());
     }
 
     /**
-     * @SuppressWarnings("complexity")
-     *
      * @param array $actionFlags
      * @param string $orderState
-     * @param bool $canReviewPayment
-     * @param bool $canUpdatePayment
-     * @param bool $allInvoiced
-     * @dataProvider canCancelDataProvider
+     * @dataProvider canVoidPaymentDataProvider
      */
-    public function testCanCancel($actionFlags, $orderState, $canReviewPayment, $canUpdatePayment, $allInvoiced)
+    public function testCanVoidPayment($actionFlags, $orderState)
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
         /** @var Order $order */
@@ -94,62 +194,83 @@ class OrderTest extends \PHPUnit_Framework_TestCase
             $order->setActionFlag($action, $flag);
         }
         $order->setData('state', $orderState);
-        $this->_prepareOrderPayment(
-            $order,
-            [
-                'canReviewPayment' => $canReviewPayment,
-                'canFetchTransactionInfo' => $canUpdatePayment,
-                'canVoid' => true
-            ]
-        );
-        $this->_prepareOrderItems($order, $allInvoiced);
-
-        // Calculate result
-        $expectedResult = true;
-        if ((!isset(
-            $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD]
-        ) ||
-            $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD] !== false) &&
-            $orderState == \Magento\Sales\Model\Order::STATE_HOLDED
-        ) {
-            $expectedResult = false;
-        }
-        if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW && !$canReviewPayment && $canUpdatePayment
-        ) {
-            $expectedResult = false;
+        $payment = $this->_prepareOrderPayment($order);
+        $canVoidOrder = true;
+        if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) {
+            $canVoidOrder = false;
         }
-        if ($allInvoiced || in_array(
-            $orderState,
-            array(
-                \Magento\Sales\Model\Order::STATE_CANCELED,
-                \Magento\Sales\Model\Order::STATE_COMPLETE,
-                \Magento\Sales\Model\Order::STATE_CLOSED,
-                \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW
-            )
-        )
+        if ($orderState == \Magento\Sales\Model\Order::STATE_HOLDED && (!isset(
+                    $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD]
+                ) || $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD] !== false)
         ) {
-            $expectedResult = false;
+            $canVoidOrder = false;
         }
-        if (isset(
-            $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_CANCEL]
-        ) && $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_CANCEL] === false
-        ) {
-            $expectedResult = false;
+
+        $expected = false;
+        if ($canVoidOrder) {
+            $expected = 'some value';
+            $payment->expects(
+                $this->once()
+            )->method(
+                'canVoid'
+            )->with(
+                new \PHPUnit_Framework_Constraint_IsIdentical($payment)
+            )->will(
+                $this->returnValue($expected)
+            );
+        } else {
+            $payment->expects($this->never())->method('canVoid');
         }
+        $this->assertEquals($expected, $order->canVoidPayment());
+    }
 
-        if (isset($actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD])
-        && $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD] == false
-        && $orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) {
-            $expectedResult = false;
+    /**
+     * @param $paymentMock
+     */
+    protected function preparePaymentMock($paymentMock)
+    {
+        $iterator = new \ArrayIterator([$paymentMock]);
+
+        $collectionMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Payment\Collection')
+            ->disableOriginalConstructor()
+            ->setMethods(['setOrderFilter', 'getIterator'])
+            ->getMock();
+        $collectionMock->expects($this->any())
+            ->method('getIterator')
+            ->will($this->returnValue($iterator));
+        $collectionMock->expects($this->once())
+            ->method('setOrderFilter')
+            ->will($this->returnSelf());
+
+        $this->paymentCollectionFactoryMock->expects($this->once())
+            ->method('create')
+            ->will($this->returnValue($collectionMock));
+    }
+
+    /**
+     * Prepare payment for the order
+     *
+     * @param \PHPUnit_Framework_MockObject_MockObject $order
+     * @param array $mockedMethods
+     * @return \Magento\Sales\Model\Order\Payment|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected function _prepareOrderPayment($order, $mockedMethods = array())
+    {
+        $payment = $this->getMockBuilder('Magento\Sales\Model\Order\Payment')->disableOriginalConstructor()->getMock();
+        foreach ($mockedMethods as $method => $value) {
+            $payment->expects($this->any())->method($method)->will($this->returnValue($value));
         }
+        $payment->expects($this->any())->method('isDeleted')->will($this->returnValue(false));
 
-        $this->assertEquals($expectedResult, $order->canCancel());
+        $itemsProperty = new \ReflectionProperty('Magento\Sales\Model\Order', '_payments');
+        $itemsProperty->setAccessible(true);
+        $itemsProperty->setValue($order, array($payment));
+        return $payment;
     }
 
     /**
      * Get action flags
      *
-     * @return array
      */
     protected function _getActionFlagsValues()
     {
@@ -183,68 +304,37 @@ class OrderTest extends \PHPUnit_Framework_TestCase
         );
     }
 
-    public function canCancelDataProvider()
+    /**
+     * @param int $qtyInvoiced
+     * @return void
+     */
+    protected function prepareItemMock($qtyInvoiced)
     {
-        $boolValues = array(true, false);
+        $itemMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Item')
+            ->disableOriginalConstructor()
+            ->setMethods(['isDeleted', 'filterByTypes', 'filterByParent', 'getQtyToInvoice'])
+            ->getMock();
 
-        $data = array();
-        foreach ($this->_getActionFlagsValues() as $actionFlags) {
-            foreach ($this->_getOrderStatuses() as $status) {
-                foreach ($boolValues as $canReviewPayment) {
-                    foreach ($boolValues as $canUpdatePayment) {
-                        foreach ($boolValues as $allInvoiced) {
-                            $data[] = array($actionFlags, $status, $canReviewPayment, $canUpdatePayment, $allInvoiced);
-                        }
-                    }
-                }
-            }
-        }
+        $itemMock->expects($this->once())
+            ->method('getQtyToInvoice')
+            ->will($this->returnValue($qtyInvoiced));
 
-        return $data;
-    }
+        $iterator = new \ArrayIterator([$itemMock]);
 
-    /**
-     * @param array $actionFlags
-     * @param string $orderState
-     * @dataProvider canVoidPaymentDataProvider
-     */
-    public function testCanVoidPayment($actionFlags, $orderState)
-    {
-        $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        /** @var Order $order */
-        $order = $helper->getObject('Magento\Sales\Model\Order');
-        foreach ($actionFlags as $action => $flag) {
-            $order->setActionFlag($action, $flag);
-        }
-        $order->setData('state', $orderState);
-        $payment = $this->_prepareOrderPayment($order);
-        $canVoidOrder = true;
-        if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) {
-            $canVoidOrder = false;
-        }
-        if ($orderState == \Magento\Sales\Model\Order::STATE_HOLDED && (!isset(
-            $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD]
-        ) || $actionFlags[\Magento\Sales\Model\Order::ACTION_FLAG_UNHOLD] !== false)
-        ) {
-            $canVoidOrder = false;
-        }
+        $itemCollectionMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Item\Collection')
+            ->disableOriginalConstructor()
+            ->setMethods(['setOrderFilter', 'getIterator'])
+            ->getMock();
+        $itemCollectionMock->expects($this->any())
+            ->method('getIterator')
+            ->will($this->returnValue($iterator));
+        $itemCollectionMock->expects($this->once())
+            ->method('setOrderFilter')
+            ->will($this->returnSelf());
 
-        $expected = false;
-        if ($canVoidOrder) {
-            $expected = 'some value';
-            $payment->expects(
-                $this->once()
-            )->method(
-                'canVoid'
-            )->with(
-                new \PHPUnit_Framework_Constraint_IsIdentical($payment)
-            )->will(
-                $this->returnValue($expected)
-            );
-        } else {
-            $payment->expects($this->never())->method('canVoid');
-        }
-        $this->assertEquals($expected, $order->canVoidPayment());
+        $this->orderItemCollectionFactoryMock->expects($this->once())
+            ->method('create')
+            ->will($this->returnValue($itemCollectionMock));
     }
 
     public function canVoidPaymentDataProvider()
@@ -257,4 +347,12 @@ class OrderTest extends \PHPUnit_Framework_TestCase
         }
         return $data;
     }
+
+    public function dataProviderActionFlag()
+    {
+        return [
+            [false],
+            [true]
+        ];
+    }
 }
diff --git a/downloader/.htaccess b/downloader/.htaccess
deleted file mode 100644
index e8420e693bb6d65d0797d0e1a60db0eea3a04f67..0000000000000000000000000000000000000000
--- a/downloader/.htaccess
+++ /dev/null
@@ -1,11 +0,0 @@
-<IfModule mod_deflate.c>
-
-    RemoveOutputFilter DEFLATE
-    RemoveOutputFilter GZIP
-
-</IfModule>
-
-<Files ~ "\.(cfg|ini|xml)$">
-    order allow,deny
-    deny from all
-</Files> 
\ No newline at end of file
diff --git a/downloader/app/Magento/Downloader/Connect.php b/downloader/app/Magento/Downloader/Connect.php
deleted file mode 100644
index 1fdc91e02aa3414972cdc7dab75b08ed466212ed..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Connect.php
+++ /dev/null
@@ -1,514 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader;
-
-
-error_reporting(E_ALL & ~E_NOTICE);
-
-// add Magento lib in include_path if needed
-$_includePath = get_include_path();
-$_libDir = dirname(__DIR__) . '/lib/internal';
-if (strpos($_includePath, $_libDir) === false) {
-    if (substr($_includePath, 0, 2) === '.' . PATH_SEPARATOR) {
-        $_includePath = '.' . PATH_SEPARATOR . $_libDir . PATH_SEPARATOR . substr($_includePath, 2);
-    } else {
-        $_includePath = $_libDir . PATH_SEPARATOR . $_includePath;
-    }
-    set_include_path($_includePath);
-}
-/**
- * Class for connect
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Connect
-{
-    /**
-     * Object of config
-     *
-     * @var \Magento\Framework\Connect\Config
-     */
-    protected $_config;
-
-    /**
-     * Object of single config
-     *
-     * @var \Magento\Framework\Connect\Singleconfig
-     */
-    protected $_sconfig;
-
-    /**
-     * Object of frontend
-     *
-     * @var \Magento\Framework\Connect\Frontend
-     */
-    protected $_frontend;
-
-    /**
-     * Internal cache for command objects
-     *
-     * @var array
-     */
-    protected $_cmdCache = array();
-
-    /**
-     * Console Started flag
-     *
-     * @var boolean
-     */
-    protected $_consoleStarted = false;
-
-    /**
-     * Instance of class
-     *
-     * @var \Magento\Downloader\Connect
-     */
-    protected static $_instance;
-
-    /**
-     * Constructor loads Config, Cache Config and initializes Frontend
-     */
-    public function __construct()
-    {
-        $this->getConfig();
-        $this->getSingleConfig();
-        $this->getFrontend();
-    }
-
-    /**
-     * Destructor, sends Console footer if Console started
-     */
-    public function __destruct()
-    {
-        if ($this->_consoleStarted) {
-            $this->_consoleFooter();
-        }
-    }
-
-    /**
-     * Initialize instance
-     *
-     * @return \Magento\Downloader\Connect
-     */
-    public static function getInstance()
-    {
-        if (!self::$_instance) {
-            self::$_instance = new self();
-        }
-        return self::$_instance;
-    }
-
-    /**
-     * Retrieve object of config and set it to \Magento\Framework\Connect\Command
-     *
-     * @return \Magento\Framework\Connect\Config
-     */
-    public function getConfig()
-    {
-        if (!$this->_config) {
-            $this->_config = new \Magento\Framework\Connect\Config();
-            $ftp = $this->_config->__get('remote_config');
-            if (!empty($ftp)) {
-                $packager = new \Magento\Framework\Connect\Packager();
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $this->_config = $config;
-                $this->_sconfig = $cache;
-            }
-            $this->_config->magento_root = dirname(__DIR__) . '/..';
-            \Magento\Framework\Connect\Command::setConfigObject($this->_config);
-        }
-        return $this->_config;
-    }
-
-    /**
-     * Retrieve object of single config and set it to \Magento\Framework\Connect\Command
-     *
-     * @param bool $reload
-     * @return \Magento\Framework\Connect\Singleconfig
-     */
-    public function getSingleConfig($reload = false)
-    {
-        if (!$this->_sconfig || $reload) {
-            $this->_sconfig = new \Magento\Framework\Connect\Singleconfig(
-                $this->getConfig()->magento_root .
-                '/' .
-                $this->getConfig()->downloader_path .
-                '/' .
-                \Magento\Framework\Connect\Singleconfig::DEFAULT_SCONFIG_FILENAME
-            );
-        }
-        \Magento\Framework\Connect\Command::setSconfig($this->_sconfig);
-        return $this->_sconfig;
-    }
-
-    /**
-     * Retrieve object of frontend and set it to \Magento\Framework\Connect\Command
-     *
-     * @return \Magento\Downloader\Connect\Frontend
-     */
-    public function getFrontend()
-    {
-        if (!$this->_frontend) {
-            $this->_frontend = new \Magento\Downloader\Connect\Frontend();
-            \Magento\Framework\Connect\Command::setFrontendObject($this->_frontend);
-        }
-        return $this->_frontend;
-    }
-
-    /**
-     * Retrieve lof from frontend
-     *
-     * @return array
-     */
-    public function getLog()
-    {
-        return $this->getFrontend()->getLog();
-    }
-
-    /**
-     * Retrieve output from frontend
-     *
-     * @return array
-     */
-    public function getOutput()
-    {
-        return $this->getFrontend()->getOutput();
-    }
-
-    /**
-     * Clean registry
-     *
-     * @return \Magento\Downloader\Connect
-     */
-    public function cleanSconfig()
-    {
-        $this->getSingleConfig()->clear();
-        return $this;
-    }
-
-    /**
-     * Delete directory recursively
-     *
-     * @param string $path
-     * @return \Magento\Downloader\Connect
-     */
-    public function delTree($path)
-    {
-        if (@is_dir($path)) {
-            $entries = @scandir($path);
-            foreach ($entries as $entry) {
-                if ($entry != '.' && $entry != '..') {
-                    $this->delTree($path . '/' . $entry);
-                }
-            }
-            @rmdir($path);
-        } else {
-            @unlink($path);
-        }
-        return $this;
-    }
-
-    /**
-     * Run commands from \Magento\Framework\Connect\Command
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return boolean|\Magento\Framework\Connect\Error
-     */
-    public function run($command, $options = array(), $params = array())
-    {
-        @set_time_limit(0);
-        @ini_set('memory_limit', '256M');
-
-        if (empty($this->_cmdCache[$command])) {
-            \Magento\Framework\Connect\Command::getCommands();
-            /**
-             * @var $cmd \Magento\Framework\Connect\Command
-             */
-            $cmd = \Magento\Framework\Connect\Command::getInstance($command);
-            if ($cmd instanceof \Magento\Framework\Connect\Error) {
-                return $cmd;
-            }
-            $this->_cmdCache[$command] = $cmd;
-        } else {
-            /**
-             * @var $cmd \Magento\Framework\Connect\Command
-             */
-            $cmd = $this->_cmdCache[$command];
-        }
-        $ftp = $this->getConfig()->remote_config;
-        if (strlen($ftp) > 0) {
-            $options = array_merge($options, array('ftp' => $ftp));
-        }
-        $cmd->run($command, $options, $params);
-        if ($cmd->ui()->hasErrors()) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * Set remote Config by URI
-     *
-     * @param string $uri
-     * @return \Magento\Downloader\Connect
-     */
-    public function setRemoteConfig($uri)
-    {
-        $this->getConfig()->remote_config = $uri;
-        return $this;
-    }
-
-    /**
-     * Show Errors
-     *
-     * @param array $errors Error messages
-     * @return \Magento\Downloader\Connect
-     */
-    public function showConnectErrors($errors)
-    {
-        echo '<script type="text/javascript">';
-        $run = new \Magento\Downloader\Model\Connect\Request();
-        if ($callback = $run->get('failure_callback')) {
-            if (is_array($callback)) {
-                call_user_func_array($callback, array($errors));
-            } else {
-                echo $callback;
-            }
-        }
-        echo '</script>';
-
-        return $this;
-    }
-
-    /**
-     * Run \Magento\Framework\Connect\Command with html output console style
-     *
-     * @throws \Magento\Downloader\Exception
-     * @param array|string|\Magento\Downloader\Model $runParams
-     *   command, options, params, comment, success_callback, failure_callback
-     * @return bool|\Magento\Framework\Connect\Error
-     */
-    public function runHtmlConsole($runParams)
-    {
-        if (function_exists('apache_setenv')) {
-            apache_setenv('no-gzip', '1');
-        }
-        @ini_set('zlib.output_compression', 0);
-        @ini_set('implicit_flush', 1);
-        for ($i = 0; $i < ob_get_level(); $i++) {
-            ob_end_flush();
-        }
-        ob_implicit_flush();
-
-        $fe = $this->getFrontend();
-        $oldLogStream = $fe->getLogStream();
-        $fe->setLogStream('stdout');
-
-        if ($runParams instanceof \Magento\Downloader\Model) {
-            $run = $runParams;
-        } elseif (is_array($runParams)) {
-            $run = new \Magento\Downloader\Model\Connect\Request($runParams);
-        } elseif (is_string($runParams)) {
-            $run = new \Magento\Downloader\Model\Connect\Request(array('comment' => $runParams));
-        } else {
-            throw new \Magento\Downloader\Exception("Invalid run parameters");
-        }
-
-        if (!$run->get('no-header')) {
-            $this->_consoleHeader();
-        }
-        echo htmlspecialchars($run->get('comment')) . '<br/>';
-
-        if ($command = $run->get('command')) {
-            $result = $this->run($command, $run->get('options'), $run->get('params'));
-
-            if ($this->getFrontend()->hasErrors()) {
-                echo "<br/>CONNECT ERROR: ";
-                foreach ($this->getFrontend()->getErrors(false) as $error) {
-                    echo nl2br($error[1]);
-                    echo '<br/>';
-                }
-            }
-            echo '<script type="text/javascript">';
-            if ($this->getFrontend()->hasErrors()) {
-                if ($callback = $run->get('failure_callback')) {
-                    if (is_array($callback)) {
-                        call_user_func_array($callback, array($result));
-                    } else {
-                        echo $callback;
-                    }
-                }
-            } else {
-                if (!$run->get('no-footer')) {
-                    if ($callback = $run->get('success_callback')) {
-                        if (is_array($callback)) {
-                            call_user_func_array($callback, array($result));
-                        } else {
-                            echo $callback;
-                        }
-                    }
-                }
-            }
-            echo '</script>';
-        } else {
-            $result = false;
-        }
-        if ($this->getFrontend()->getErrors() || !$run->get('no-footer')) {
-            //$this->_consoleFooter();
-            $fe->setLogStream($oldLogStream);
-        }
-        return $result;
-    }
-
-    /**
-     * Show HTML Console Header
-     *
-     * @return void
-     */
-    protected function _consoleHeader()
-    {
-        if (!$this->_consoleStarted) {
-            ?>
-            <html><head><style type="text/css">
-            body { margin:0px;
-                padding:3px;
-                background:black;
-                color:#2EC029;
-                font:normal 11px Lucida Console, Courier New, serif;
-                }
-            </style></head><body>
-            <script type="text/javascript">
-            if (parent && parent.disableInputs) {
-                parent.disableInputs(true);
-            }
-            if (typeof auto_scroll=='undefined') {
-                var auto_scroll = window.setInterval(console_scroll, 10);
-            }
-            function console_scroll()
-            {
-                if (typeof top.$ != 'function') {
-                    return;
-                }
-                if (top.$('connect_iframe_scroll').checked) {
-                    document.body.scrollTop+=3;
-                }
-            }
-            function show_message(message, newline)
-            {
-                var bodyElement = document.getElementsByTagName('body')[0];
-                if (typeof newline == 'undefined') {
-                    newline = true
-                }
-                if (newline) {
-                    bodyElement.innerHTML += '<br/>';
-                }
-                bodyElement.innerHTML += message;
-            }
-            function clear_cache(callbacks)
-            {
-                if (typeof top.Ajax != 'object') {
-                    return;
-                }
-                var message = 'Exception during cache and session cleaning';
-                var url = window.location.href.split('?')[0] + '?A=cleanCache';
-                var intervalID = setInterval(function() {show_message('.', false); }, 500);
-                var clean = 0;
-                var maintenance = 0;
-                if (window.location.href.indexOf('clean_sessions') >= 0) {
-                    clean = 1;
-                }
-                if (window.location.href.indexOf('maintenance') >= 0) {
-                    maintenance = 1;
-                }
-
-                new top.Ajax.Request(url, {
-                    method: 'post',
-                    parameters: {clean_sessions:clean, maintenance:maintenance},
-                    onCreate: function() {
-                        show_message('Cleaning cache');
-                        show_message('');
-                    },
-                    onSuccess: function(transport, json) {
-                        var result = true;
-                        try{
-                            var response = eval('(' + transport.responseText + ')');
-                            if (typeof response.result != 'undefined') {
-                                result = response.result;
-                            } else {
-                                result = false;
-                            }
-                            if (typeof response.message != 'undefined') {
-                                if (response.message.length > 0) {
-                                    message = response.message;
-                                } else {
-                                    message = 'Cache cleaned successfully';
-                                }
-                            }
-                        } catch (ex){
-                            result = false;
-                        }
-                        if (result) {
-                            callbacks.success();
-                        } else {
-                            callbacks.fail();
-                        }
-                    },
-                    onFailure: function() {
-                        callbacks.fail();
-                    },
-                    onComplete: function(transport) {
-                        clearInterval(intervalID);
-                        show_message(message);
-                    }
-                });
-            }
-            </script>
-            <?php
-            $this->_consoleStarted = true;
-        }
-    }
-
-    /**
-     * Show HTML Console Footer
-     *
-     * @return void
-     */
-    protected function _consoleFooter()
-    {
-        if ($this->_consoleStarted) {
-            ?>
-            <script type="text/javascript">
-            if (parent && parent.disableInputs) {
-                parent.disableInputs(false);
-            }
-            </script>
-            </body></html>
-            <?php
-            $this->_consoleStarted = false;
-        }
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Connect/Frontend.php b/downloader/app/Magento/Downloader/Connect/Frontend.php
deleted file mode 100644
index cccc53eb0856541288ab37bdf61dbd03cd21a1f6..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Connect/Frontend.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader\Connect;
-
-/**
- * Class frontend
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Frontend extends \Magento\Framework\Connect\Frontend
-{
-    /**
-     * Log stream or not
-     *
-     * @var string|null
-     */
-    protected $_logStream = null;
-
-    /**
-     * Output cache
-     *
-     * @var array
-     */
-    protected $_out = array();
-
-    /**
-     * Set log stream
-     *
-     * @param string|resource $stream 'stdout' or open php stream
-     * @return $this
-     */
-    public function setLogStream($stream)
-    {
-        $this->_logStream = $stream;
-        return $this;
-    }
-
-    /**
-     * Retrieve log stream
-     *
-     * @return string
-     */
-    public function getLogStream()
-    {
-        return $this->_logStream;
-    }
-
-    /**
-     * @param array $data
-     * @return void
-     */
-    public function output($data)
-    {
-
-        $this->_out = $data;
-
-        if ('stdout' === $this->_logStream) {
-            if (is_string($data)) {
-                echo $data . "<br/>" . str_repeat(" ", 256);
-            } elseif (is_array($data)) {
-                $data = array_pop($data);
-                if (!empty($data['message']) && is_string($data['message'])) {
-                    echo $data['message'] . "<br/>" . str_repeat(" ", 256);
-                } elseif (!empty($data['data'])) {
-                    if (is_string($data['data'])) {
-                        echo $data['data'] . "<br/>" . str_repeat(" ", 256);
-                    } else {
-                        if (isset($data['title'])) {
-                            echo $data['title'] . "<br/>" . str_repeat(" ", 256);
-                        }
-                        if (is_array($data['data'])) {
-                            foreach ($data['data'] as $row) {
-                                foreach ($row as $msg) {
-                                    echo "&nbsp;" . $msg;
-                                }
-                                echo "<br/>" . str_repeat(" ", 256);
-                            }
-                        } else {
-                            echo "&nbsp;" . $data['data'];
-                        }
-                    }
-                }
-            } else {
-                print_r($data);
-            }
-        }
-    }
-
-    /**
-     * Method for ask client about rewrite all files.
-     *
-     * @param string $string
-     * @return void
-     */
-    public function confirm($string)
-    {
-        $formId = $_POST['form_id'];
-        echo <<<SCRIPT
-        <script type="text/javascript">
-            if (confirm("{$string}")) {
-                parent.document.getElementById('ignore_local_modification').value=1;
-                parent.onSuccess();
-                if (parent && parent.disableInputs) {
-                    parent.disableInputs(false);
-                }
-                window.onload = function () {
-                    parent.document.getElementById('{$formId}').submit();
-                    parent.document.getElementById('ignore_local_modification').value='';
-                }
-            }
-        </script>
-SCRIPT;
-    }
-
-    /**
-     * Retrieve output cache
-     *
-     * @return array
-     */
-    public function getOutput()
-    {
-        return $this->_out;
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Controller.php b/downloader/app/Magento/Downloader/Controller.php
deleted file mode 100644
index 43bf5e899f8ab9eaaae002c1a864b5ac323e436d..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Controller.php
+++ /dev/null
@@ -1,1173 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class Controller
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Downloader;
-
-final class Controller
-{
-    /**
-     * Request key of action
-     */
-    const ACTION_KEY = 'A';
-
-    /**
-     * Instance of class
-     *
-     * @var \Magento\Downloader\Controller
-     */
-    private static $_instance;
-
-    /**
-     * Current action name
-     *
-     * @var string
-     */
-    private $_action;
-
-    /**
-     * Controller is dispathed flag
-     *
-     * @var bool
-     */
-    private $_isDispatched = false;
-
-    /**
-     * Redirect to URL
-     *
-     * @var string
-     */
-    private $_redirectUrl;
-
-    /**
-     * Downloader dir path
-     *
-     * @var string
-     */
-    private $_rootDir;
-
-    /**
-     * Magento root dir path
-     *
-     * @var string
-     */
-    private $_mageDir;
-
-    /**
-     * View instance
-     *
-     * @var \Magento\Downloader\View
-     */
-    private $_view;
-
-    /**
-     * Connect config instance
-     *
-     * @var \Magento\Framework\Connect\Config
-     */
-    private $_config;
-
-    /**
-     * Config instance
-     *
-     * @var \Magento\Downloader\Model\Config
-     */
-    private $_localConfig;
-
-    /**
-     * Session instance
-     *
-     * @var \Magento\Downloader\Model\Session
-     */
-    private $_session;
-
-    /**
-     * Root dir is writable flag
-     *
-     * @var bool
-     */
-    private $_writable;
-
-    /**
-     * Use maintenance flag
-     *
-     * @var bool
-     */
-    protected $_maintenance;
-
-    /**
-     * Maintenance file path
-     *
-     * @var string
-     */
-    protected $_maintenanceFile;
-
-    /**
-     * Register array for singletons
-     *
-     * @var array
-     */
-    protected $_singletons = array();
-
-    //////////////////////////// ACTIONS
-
-    /**
-     * Get ftp string from post data
-     *
-     * @param array $post post data
-     * @return string FTP Url
-     */
-    private function getFtpPost($post)
-    {
-        if (empty($post['ftp_host'])) {
-            $_POST['ftp'] = '';
-            return '';
-        }
-        $ftp = 'ftp://';
-        $post['ftp_proto'] = 'ftp://';
-
-        if (!empty($post['ftp_path']) && strlen(trim($post['ftp_path'], '\\/')) > 0) {
-            $post['ftp_path'] = '/' . trim($post['ftp_path'], '\\/') . '/';
-        } else {
-            $post['ftp_path'] = '/';
-        }
-
-        $start = stripos($post['ftp_host'], 'ftp://');
-        if ($start !== false) {
-            $post['ftp_proto'] = 'ftp://';
-            $post['ftp_host'] = substr($post['ftp_host'], $start + 6 - 1);
-        }
-        $start = stripos($post['ftp_host'], 'ftps://');
-        if ($start !== false) {
-            $post['ftp_proto'] = 'ftps://';
-            $post['ftp_host'] = substr($post['ftp_host'], $start + 7 - 1);
-        }
-
-        $post['ftp_host'] = trim($post['ftp_host'], '\\/');
-
-        if (!empty($post['ftp_login']) && !empty($post['ftp_password'])) {
-            $ftp = sprintf(
-                "%s%s:%s@%s%s",
-                $post['ftp_proto'],
-                $post['ftp_login'],
-                $post['ftp_password'],
-                $post['ftp_host'],
-                $post['ftp_path']
-            );
-        } elseif (!empty($post['ftp_login'])) {
-            $ftp = sprintf("%s%s@%s%s", $post['ftp_proto'], $post['ftp_login'], $post['ftp_host'], $post['ftp_path']);
-        } else {
-            $ftp = $post['ftp_proto'] . $post['ftp_host'] . $post['ftp_path'];
-        }
-
-        $_POST['ftp'] = $ftp;
-        return $ftp;
-    }
-
-    /**
-     * NoRoute
-     *
-     * @return void
-     */
-    public function norouteAction()
-    {
-        header("HTTP/1.0 404 Invalid Action");
-        echo $this->view()->template('noroute.phtml');
-    }
-
-    /**
-     * Login
-     *
-     * @return void
-     */
-    public function loginAction()
-    {
-        $this->view()->set('username', !empty($_GET['username']) ? $_GET['username'] : '');
-        echo $this->view()->template('login.phtml');
-    }
-
-    /**
-     * Logout
-     *
-     * @return void
-     */
-    public function logoutAction()
-    {
-        $this->session()->logout();
-        $this->redirect($this->url());
-    }
-
-    /**
-     * Index
-     *
-     * @return void
-     */
-    public function indexAction()
-    {
-        $config = $this->config();
-        if (!$this->isInstalled()) {
-            $this->view()->set('mage_url', dirname(dirname($_SERVER['SCRIPT_NAME'])));
-            $this->view()->set(
-                'use_custom_permissions_mode',
-                $config->__get('use_custom_permissions_mode') ? $config->__get('use_custom_permissions_mode') : '0'
-            );
-            $this->view()->set('mkdir_mode', decoct($config->__get('global_dir_mode')));
-            $this->view()->set('chmod_file_mode', decoct($config->__get('global_file_mode')));
-            $this->view()->set('protocol', $config->__get('protocol'));
-            $this->channelConfig()->setInstallView($config, $this->view());
-
-            echo $this->view()->template('install/download.phtml');
-        } elseif (!$config->sync_pear) {
-            $this->model('connect', true)->connect()->run('sync');
-            $this->forward('connectPackages');
-        } else {
-            $this->forward('connectPackages');
-        }
-    }
-
-    /**
-     * Empty Action
-     *
-     * @return void
-     */
-    public function emptyAction()
-    {
-        $this->model('connect', true)->connect()->runHtmlConsole('Please wait, preparing for updates...');
-    }
-
-    /**
-     * Install all magento
-     *
-     * @return void
-     */
-    public function connectInstallAllAction()
-    {
-        $p =& $_POST;
-        $this->getFtpPost($p);
-        $errors = $this->model('connect', true)->validateConfigPost($p);
-        /* todo show errors */
-        if ($errors) {
-            $message = "CONNECT ERROR: ";
-            foreach ($errors as $err) {
-                $message .= $err . "\n";
-            }
-            $this->model('connect', true)->connect()->runHtmlConsole($message);
-            $this->model('connect', true)->connect()->showConnectErrors($errors);
-            return;
-        }
-
-        if (1 == $p['inst_protocol']) {
-            $this->model('connect', true)->connect()->setRemoteConfig($this->getFtpPost($p));
-        }
-
-        $this->channelConfig()->setPostData($this->config(), $p);
-
-        $chan = $this->config()->__get('root_channel');
-        $this->model('connect', true)->saveConfigPost($_POST);
-        $this->channelConfig()->setSettingsSession($_POST, $this->session());
-        $this->model('connect', true)->installAll(!empty($_GET['force']), $chan);
-        $p = null;
-    }
-
-    /**
-     * Connect packages
-     *
-     * @return void
-     */
-    public function connectPackagesAction()
-    {
-        $connect = $this->model('connect', true);
-
-        if (isset($_GET['loggedin'])) {
-            $connect->connect()->run('sync');
-        }
-
-        $this->view()->set('connect', $connect);
-        $this->view()->set('channel_config', $this->channelConfig());
-        $remoteConfig = $this->config()->remote_config;
-        if (!$this->isWritable() && empty($remoteConfig)) {
-            $this->view()->set('writable_warning', true);
-        }
-
-        echo $this->view()->template('connect/packages.phtml');
-    }
-
-    /**
-     * Connect packages POST
-     *
-     * @return void
-     */
-    public function connectPackagesPostAction()
-    {
-        $actions = isset($_POST['actions']) ? $_POST['actions'] : array();
-        if (isset($_POST['ignore_local_modification'])) {
-            $ignoreLocalModification = $_POST['ignore_local_modification'];
-        } else {
-            $ignoreLocalModification = '';
-        }
-        $this->model('connect', true)->applyPackagesActions($actions, $ignoreLocalModification);
-    }
-
-    /**
-     * Prepare package to install, get dependency info.
-     *
-     * @return void
-     */
-    public function connectPreparePackagePostAction()
-    {
-        if (!$_POST) {
-            echo "INVALID POST DATA";
-            return;
-        }
-        $prepareResult = $this->model('connect', true)->prepareToInstall($_POST['install_package_id']);
-
-        $packages = isset($prepareResult['data']) ? $prepareResult['data'] : array();
-        $errors = isset($prepareResult['errors']) ? $prepareResult['errors'] : array();
-
-        $this->view()->set('packages', $packages);
-        $this->view()->set('errors', $errors);
-        $this->view()->set('package_id', $_POST['install_package_id']);
-
-        echo $this->view()->template('connect/packages_prepare.phtml');
-    }
-
-    /**
-     * Install package
-     *
-     * @return void
-     */
-    public function connectInstallPackagePostAction()
-    {
-        if (!$_POST) {
-            echo "INVALID POST DATA";
-            return;
-        }
-        $this->model('connect', true)->installPackage($_POST['install_package_id']);
-    }
-
-    /**
-     * Install uploaded package
-     *
-     * @return void
-     */
-    public function connectInstallPackageUploadAction()
-    {
-        if (!$_FILES) {
-            echo "No file was uploaded";
-            return;
-        }
-
-        if (empty($_FILES['file'])) {
-            echo "No file was uploaded";
-            return;
-        }
-
-        $info =& $_FILES['file'];
-
-        if (0 !== intval($info['error'])) {
-            echo "File upload problem";
-            return;
-        }
-
-        $target = $this->_mageDir . '/var/' . uniqid() . $info['name'];
-        $res = move_uploaded_file($info['tmp_name'], $target);
-        if (false === $res) {
-            echo "Error moving uploaded file";
-            return;
-        }
-
-        $this->model('connect', true)->installUploadedPackage($target);
-        @unlink($target);
-    }
-
-    /**
-     * Clean cache on ajax request
-     *
-     * @return void
-     */
-    public function cleanCacheAction()
-    {
-        $result = $this->cleanCache();
-        echo json_encode($result);
-    }
-
-    /**
-     * Settings
-     *
-     * @return void
-     */
-    public function settingsAction()
-    {
-        $config = $this->config();
-        $this->view()->set('preferred_state', $config->__get('preferred_state'));
-        $this->view()->set('protocol', $config->__get('protocol'));
-
-        $this->view()->set('use_custom_permissions_mode', $config->__get('use_custom_permissions_mode'));
-        $this->view()->set('mkdir_mode', decoct($config->__get('global_dir_mode')));
-        $this->view()->set('chmod_file_mode', decoct($config->__get('global_file_mode')));
-
-        $this->channelConfig()->setSettingsView($this->session(), $this->view());
-
-        $fs_disabled = !$this->isWritable();
-        $ftpParams = $config->__get('remote_config') ? parse_url($config->__get('remote_config')) : '';
-
-        $this->view()->set('fs_disabled', $fs_disabled);
-        $this->view()->set('deployment_type', $fs_disabled || !empty($ftpParams) ? 'ftp' : 'fs');
-
-        if (!empty($ftpParams)) {
-            $this->view()->set('ftp_host', sprintf("%s://%s", $ftpParams['scheme'], $ftpParams['host']));
-            $this->view()->set('ftp_login', $ftpParams['user']);
-            $this->view()->set('ftp_password', $ftpParams['pass']);
-            $this->view()->set('ftp_path', $ftpParams['path']);
-        }
-        echo $this->view()->template('settings.phtml');
-    }
-
-    /**
-     * Settings post
-     *
-     * @return void
-     */
-    public function settingsPostAction()
-    {
-        if ($_POST) {
-            $ftp = $this->getFtpPost($_POST);
-
-            /* clear startup messages */
-            $this->config();
-            $this->session()->getMessages();
-
-            $errors = $this->model('connect', true)->validateConfigPost($_POST);
-            if ($errors) {
-                foreach ($errors as $err) {
-                    $this->session()->addMessage('error', $err);
-                }
-                $this->redirect($this->url('settings'));
-                return;
-            }
-            try {
-                if ('ftp' == $_POST['deployment_type'] && !empty($_POST['ftp_host'])) {
-                    $this->model('connect', true)->connect()->setRemoteConfig($ftp);
-                } else {
-                    $this->model('connect', true)->connect()->setRemoteConfig('');
-                    $_POST['ftp'] = '';
-                }
-                $this->channelConfig()->setPostData($this->config(), $_POST);
-                $this->model('connect', true)->saveConfigPost($_POST);
-                $this->channelConfig()->setSettingsSession($_POST, $this->session());
-                $this->model('connect', true)->connect()->run('sync');
-            } catch (\Exception $e) {
-                $this->session()->addMessage('error', "Unable to save settings: " . $e->getMessage());
-            }
-        }
-        $this->redirect($this->url('settings'));
-    }
-
-    //////////////////////////// ABSTRACT
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $this->_rootDir = dirname(__DIR__);
-        $this->_mageDir = dirname($this->_rootDir);
-    }
-
-    /**
-     * Run
-     *
-     * @return void
-     */
-    public static function run()
-    {
-        try {
-            self::singleton()->dispatch();
-        } catch (\Exception $e) {
-            echo $e->getMessage();
-        }
-    }
-
-    /**
-     * Initialize object of class
-     *
-     * @return \Magento\Downloader\Controller
-     */
-    public static function singleton()
-    {
-        if (!self::$_instance) {
-            self::$_instance = new self();
-
-            if (self::$_instance->isDownloaded()) {
-                if (!class_exists('Magento', false)) {
-                    if (!file_exists(self::$_instance->getBootstrapPath())) {
-                        return false;
-                    }
-                    include_once self::$_instance->getBootstrapPath();
-
-                    \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\App\State')->setIsDownloader();
-                }
-                if (self::isInstalled()) {
-                    \Mage::getSingleton('Magento\Backend\Model\UrlInterface')->turnOffSecretKey();
-                }
-            }
-        }
-        return self::$_instance;
-    }
-
-    /**
-     * Retrieve Downloader root dir
-     *
-     * @return string
-     */
-    public function getRootDir()
-    {
-        return $this->_rootDir;
-    }
-
-    /**
-     * Retrieve Magento root dir
-     *
-     * @return string
-     */
-    public function getMageDir()
-    {
-        return $this->_mageDir;
-    }
-
-    /**
-     * Retrieve Mage Class file path
-     *
-     * @return string
-     */
-    public function getBootstrapPath()
-    {
-        return $this->getMageDir() . '/app/bootstrap.php';
-    }
-
-    /**
-     * Retrieve path for \Magento\Framework\Profiler
-     *
-     * @return string
-     */
-    public function getVarFilename()
-    {
-        return $this->getMageDir() . '/lib/internal/Magento/Framework/Profiler.php';
-    }
-
-    /**
-     * Retrieve downloader file path
-     *
-     * @param string $name
-     * @return string
-     */
-    public function filepath($name = '')
-    {
-        return rtrim($this->getRootDir() . '/' . $name, '/');
-    }
-
-    /**
-     * Retrieve object of view
-     *
-     * @return \Magento\Downloader\View
-     */
-    public function view()
-    {
-        if (!$this->_view) {
-            $this->_view = new \Magento\Downloader\View();
-        }
-        return $this->_view;
-    }
-
-    /**
-     * Retrieve object of model
-     *
-     * @param string $model
-     * @param boolean $singleton
-     * @return \Magento\Downloader\Model
-     */
-    public function model($model = null, $singleton = false)
-    {
-        if ($singleton && isset($this->_singletons[$model])) {
-            return $this->_singletons[$model];
-        }
-
-        if (is_null($model)) {
-            $class = 'Magento\Downloader\Model';
-        } else {
-            $class = 'Magento\Downloader\Model\\' . str_replace(' ', '\\', ucwords(str_replace('\\', ' ', $model)));
-            if (!class_exists($class, false)) {
-                include_once str_replace('_', '/', $class) . '.php';
-            }
-        }
-
-        $object = new $class();
-
-        if ($singleton) {
-            $this->_singletons[$model] = $object;
-        }
-
-        return $object;
-    }
-
-    /**
-     * Retrieve object of config
-     *
-     * @return \Magento\Framework\Connect\Config
-     */
-    public function config()
-    {
-        if (!$this->_config) {
-            $this->_config = $this->model('connect', true)->connect()->getConfig();
-            if (!$this->_config->isLoaded()) {
-                $this->session()->addMessage('error', "Settings has not been loaded. Used default settings");
-                if ($this->_config->getError()) {
-                    $this->session()->addMessage('error', $this->_config->getError());
-                }
-            }
-        }
-        return $this->_config;
-    }
-
-    /**
-     * Retrieve object of channel config
-     *
-     * @return \Magento\Downloader\Model\Config\ConfigInterface
-     */
-    public function channelConfig()
-    {
-        if (!$this->_localConfig) {
-            $this->_localConfig = $this->model('config', true)->getChannelConfig();
-        }
-        return $this->_localConfig;
-    }
-
-    /**
-     * Retrieve object of session
-     *
-     * @return \Magento\Downloader\Model\Session
-     */
-    public function session()
-    {
-        if (!$this->_session) {
-            $this->_session = $this->model('session')->start();
-        }
-        return $this->_session;
-    }
-
-    /**
-     * Set Controller action
-     *
-     * @param string $action
-     * @return \Magento\Downloader\Controller
-     */
-    public function setAction($action = null)
-    {
-        if (is_null($action)) {
-            if (!empty($this->_action)) {
-                return $this;
-            }
-            $action = !empty($_GET[self::ACTION_KEY]) ? $_GET[self::ACTION_KEY] : 'index';
-        }
-        if (empty($action) || !is_string($action) || !method_exists($this, $this->getActionMethod($action))) {
-            //$action = 'noroute';
-            $action = 'index';
-        }
-        $this->_action = $action;
-        return $this;
-    }
-
-    /**
-     * Retrieve Controller action name
-     *
-     * @return string
-     */
-    public function getAction()
-    {
-        return $this->_action;
-    }
-
-    /**
-     * Set Redirect to URL
-     *
-     * @param string $url
-     * @param bool $force
-     * @return \Magento\Downloader\Controller
-     */
-    public function redirect($url, $force = false)
-    {
-        $this->_redirectUrl = $url;
-        if ($force) {
-            $this->processRedirect();
-        }
-        return $this;
-    }
-
-    /**
-     * Precess redirect
-     *
-     * @return \Magento\Downloader\Controller
-     */
-    public function processRedirect()
-    {
-        if ($this->_redirectUrl) {
-            if (headers_sent()) {
-                echo '<script type="text/javascript">location.href="' . $this->_redirectUrl . '"</script>';
-                exit;
-            } else {
-                header("Location: " . $this->_redirectUrl);
-                exit;
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Forward to action
-     *
-     * @param string $action
-     * @return \Magento\Downloader\Controller
-     */
-    public function forward($action)
-    {
-        $this->setAction($action);
-        $this->_isDispatched = false;
-        return $this;
-    }
-
-    /**
-     * Retrieve action method by action name
-     *
-     * @param string $action
-     * @return string
-     */
-    public function getActionMethod($action = null)
-    {
-        $method = (!is_null($action) ? $action : $this->_action) . 'Action';
-        return $method;
-    }
-
-    /**
-     * Generate URL for action
-     *
-     * @param string $action
-     * @param array $params
-     * @return string
-     */
-    public function url($action = '', $params = array())
-    {
-        $args = array();
-        foreach ($params as $k => $v) {
-            $args[] = sprintf('%s=%s', rawurlencode($k), rawurlencode($v));
-        }
-        $args = $args ? join('&', $args) : '';
-
-        return sprintf('%s?%s=%s%s', $_SERVER['SCRIPT_NAME'], self::ACTION_KEY, rawurlencode($action), $args);
-    }
-
-    /**
-     * Dispatch process
-     *
-     * @return void
-     */
-    public function dispatch()
-    {
-        header('Content-type: text/html; charset=UTF-8');
-
-        $this->setAction();
-
-        if (!$this->isInstalled()) {
-            if (!in_array($this->getAction(), array('index', 'connectInstallAll', 'empty', 'cleanCache'))) {
-                $this->setAction('index');
-            }
-        } else {
-            $this->session()->authenticate();
-        }
-
-        while (!$this->_isDispatched) {
-            $this->_isDispatched = true;
-
-            $method = $this->getActionMethod();
-            $this->{$method}();
-        }
-
-        $this->processRedirect();
-    }
-
-    /**
-     * Check root dir is writable
-     *
-     * @return bool
-     */
-    public function isWritable()
-    {
-        if (is_null($this->_writable)) {
-            $this->_writable = is_writable(
-                $this->getMageDir() . '/'
-            ) && is_writable(
-                $this->filepath()
-            ) && !file_exists(
-                $this->filepath('config.ini') || is_writable($this->filepath('config.ini'))
-            );
-        }
-        return $this->_writable;
-    }
-
-    /**
-     * Check is Magento files downloaded
-     *
-     * @return bool
-     */
-    public function isDownloaded()
-    {
-        return file_exists($this->getBootstrapPath()) && file_exists($this->getVarFilename());
-    }
-
-    /**
-     * Check is Magento installed
-     *
-     * @return bool
-     */
-    public function isInstalled()
-    {
-        if (!$this->isDownloaded()) {
-            return false;
-        }
-        return \Mage::isInstalled();
-    }
-
-    /**
-     * Retrieve Maintenance flag
-     *
-     * @return bool
-     */
-    protected function _getMaintenanceFlag()
-    {
-        if (is_null($this->_maintenance)) {
-            $this->_maintenance = !empty($_REQUEST['maintenance']) && $_REQUEST['maintenance'] == '1' ? true : false;
-        }
-        return $this->_maintenance;
-    }
-
-    /**
-     * Retrieve Maintenance Flag file path
-     * Path for maintenance flag: web_root/var/maintenance.flag
-     *
-     * @return string
-     */
-    protected function _getMaintenanceFilePath()
-    {
-        if (is_null($this->_maintenanceFile)) {
-            $path = dirname(dirname(__DIR__)) . '/var/';
-            $this->_maintenanceFile = $path . 'maintenance.flag';
-        }
-        return $this->_maintenanceFile;
-    }
-
-    /**
-     * Begin install package(s)
-     *
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    public function startInstall()
-    {
-        if ($this->_getMaintenanceFlag()) {
-            $maintenance_filename = 'var/maintenance.flag';
-            $config = $this->config();
-            if (!$this->isWritable() || strlen($config->__get('remote_config')) > 0) {
-                $ftpObj = new \Magento\Framework\Connect\Ftp();
-                $ftpObj->connect($config->__get('remote_config'));
-                $tempFile = tempnam(sys_get_temp_dir(), 'maintenance');
-                @file_put_contents($tempFile, 'maintenance');
-                $ftpObj->upload($maintenance_filename, $tempFile);
-                $ftpObj->close();
-            } else {
-                @file_put_contents($this->_getMaintenanceFilePath(), 'maintenance');
-            }
-        }
-
-        if (!empty($_GET['archive_type'])) {
-
-            $backupName = $_GET['backup_name'];
-            $connect = $this->model('connect', true)->connect();
-            $isSuccess = true;
-
-            if (!preg_match('/^[a-zA-Z0-9\ ]{0,50}$/', $backupName)) {
-                $connect->runHtmlConsole(
-                    'Please use only letters (a-z or A-Z), numbers (0-9) or space in ' .
-                    'Backup Name field. Other characters are not allowed.'
-                );
-                $isSuccess = false;
-            }
-
-            if ($isSuccess) {
-                $isSuccess = $this->_createBackup($_GET['archive_type'], $_GET['backup_name']);
-            }
-
-            if (!$isSuccess) {
-                $this->endInstall();
-                $this->cleanCache();
-                throw new \Magento\Framework\Exception(
-                    'The installation process has been canceled because of the backup creation error'
-                );
-            }
-        }
-    }
-
-    /**
-     * End install package(s)
-     *
-     * @return void
-     */
-    public function endInstall()
-    {
-        //$connect
-        /** @var $connect \Magento\Downloader\Model\Connect */
-        $frontend = $this->model('connect', true)->connect()->getFrontend();
-        if (!$frontend instanceof \Magento\Downloader\Connect\Frontend) {
-            $this->cleanCache();
-        }
-    }
-
-    /**
-     * @return array
-     */
-    protected function cleanCache()
-    {
-        $result = true;
-        $message = '';
-        try {
-            if ($this->isInstalled()) {
-                if (!empty($_REQUEST['clean_sessions'])) {
-                    \Mage::app()->cleanAllSessions();
-                    $message .= 'Session cleaned successfully. ';
-                }
-                \Mage::app()->cleanCache();
-
-                // reinit config and apply all updates
-                \Mage::app()->getConfig()->reinit();
-
-                /** @var $updater \Magento\Framework\Module\UpdaterInterface*/
-                $updater = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Module\UpdaterInterface');
-                $updater->updateScheme();
-                $updater->updateData();
-                $message .= 'Cache cleaned successfully';
-            } else {
-                $result = true;
-            }
-        } catch (\Exception $e) {
-            $result = false;
-            $message = "Exception during cache and session cleaning: " . $e->getMessage();
-            $this->session()->addMessage('error', $message);
-        }
-
-        if ($result && $this->_getMaintenanceFlag()) {
-            $maintenance_filename = 'var/maintenance.flag';
-            $config = $this->config();
-            if (!$this->isWritable() && strlen($config->__get('remote_config')) > 0) {
-                $ftpObj = new \Magento\Framework\Connect\Ftp();
-                $ftpObj->connect($config->__get('remote_config'));
-                $ftpObj->delete($maintenance_filename);
-                $ftpObj->close();
-            } else {
-                @unlink($this->_getMaintenanceFilePath());
-            }
-        }
-        return array('result' => $result, 'message' => $message);
-    }
-
-    /**
-     * Gets the current Magento Connect Manager (Downloader) version string
-     * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/
-     *
-     * @return string
-     */
-    public static function getVersion()
-    {
-        $i = self::getVersionInfo();
-        return trim(
-            "{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] !=
-            '' ? ".{$i['patch']}" : "") . "-{$i['stability']}{$i['number']}",
-            '.-'
-        );
-    }
-
-    /**
-     * Gets the detailed Magento Connect Manager (Downloader) version information
-     * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/
-     *
-     * @return array
-     */
-    public static function getVersionInfo()
-    {
-        return array(
-            'major' => '1',
-            'minor' => '5',
-            'revision' => '0',
-            'patch' => '0',
-            'stability' => 'rc',
-            'number' => '2'
-        );
-    }
-
-    /**
-     * Create Backup
-     *
-     * @param string $archiveType
-     * @param string $archiveName
-     * @return bool
-     */
-    protected function _createBackup($archiveType, $archiveName)
-    {
-        /** @var $connect \Magento\Downloader\Connect */
-        $connect = $this->model('connect', true)->connect();
-        $connect->runHtmlConsole('Creating backup...');
-
-        $isSuccess = false;
-
-        try {
-            $type = $this->_getBackupTypeByCode($archiveType);
-
-            $backupManager = \Magento\Core\Model\ObjectManager::getInstance()->get(
-                'Magento\Framework\Backup\Factory'
-            )->create(
-                $type
-            )->setBackupExtension(
-                $this->_getExtensionType($type)
-            )->setTime(
-                time()
-            )->setName(
-                $archiveName
-            )->setBackupsDir(
-                \Mage::getBaseDir('var') . '/backups'
-            );
-
-            \Magento\Framework\App\ObjectManager::getInstance()->get(
-                'Magento\Framework\Registry'
-            )->register(
-                'backup_manager',
-                $backupManager
-            );
-
-            if ($type != \Magento\Framework\Backup\Factory::TYPE_DB) {
-                $backupManager->setRootDir(\Mage::getBaseDir())->addIgnorePaths($this->_getBackupIgnorePaths());
-            }
-            $backupManager->create();
-            $connect->runHtmlConsole($this->_getCreateBackupSuccessMessageByType($type));
-            $isSuccess = true;
-        } catch (\Magento\Framework\Backup\Exception\NotEnoughFreeSpace $e) {
-            $connect->runHtmlConsole('Not enough free space to create backup.');
-        } catch (\Magento\Framework\Backup\Exception\NotEnoughPermissions $e) {
-            $connect->runHtmlConsole('Not enough permissions to create backup.');
-        } catch (\Exception $e) {
-            $connect->runHtmlConsole('An error occurred while creating the backup.');
-        }
-
-        return $isSuccess;
-    }
-
-    /**
-     * @param string $type
-     * @return string
-     */
-    protected function _getExtensionType($type)
-    {
-        $extensionType = array(
-            \Magento\Framework\Backup\Factory::TYPE_SYSTEM_SNAPSHOT => 'tgz',
-            \Magento\Framework\Backup\Factory::TYPE_SNAPSHOT_WITHOUT_MEDIA => 'tgz',
-            \Magento\Framework\Backup\Factory::TYPE_MEDIA => 'tgz',
-            \Magento\Framework\Backup\Factory::TYPE_DB => 'gz'
-        );
-
-        return $extensionType[$type];
-    }
-
-    /**
-     * @return array
-     */
-    protected function _getBackupIgnorePaths()
-    {
-        return array(
-            '.git',
-            '.svn',
-            'var/maintenance.flag',
-            \Mage::getBaseDir('var') . '/session',
-            \Mage::getBaseDir('var') . '/cache',
-            \Mage::getBaseDir('var') . '/full_page_cache',
-            \Mage::getBaseDir('var') . '/locks',
-            \Mage::getBaseDir('var') . '/log',
-            \Mage::getBaseDir('var') . '/report'
-        );
-    }
-
-    /**
-     * Retrieve Backup Type by Code
-     *
-     * @param int $code
-     * @return string
-     */
-    protected function _getBackupTypeByCode($code)
-    {
-        $typeMap = array(
-            1 => \Magento\Framework\Backup\Factory::TYPE_DB,
-            2 => \Magento\Framework\Backup\Factory::TYPE_SYSTEM_SNAPSHOT,
-            3 => \Magento\Framework\Backup\Factory::TYPE_SNAPSHOT_WITHOUT_MEDIA,
-            4 => \Magento\Framework\Backup\Factory::TYPE_MEDIA
-        );
-
-        if (!isset($typeMap[$code])) {
-            \Mage::throwException('Unknown backup type');
-        }
-
-        return $typeMap[$code];
-    }
-
-    /**
-     * Get backup create success message by backup type
-     *
-     * @param string $type
-     * @return string
-     */
-    protected function _getCreateBackupSuccessMessageByType($type)
-    {
-        $messagesMap = array(
-            \Magento\Framework\Backup\Factory::TYPE_SYSTEM_SNAPSHOT => 'System backup has been created',
-            \Magento\Framework\Backup\Factory::TYPE_SNAPSHOT_WITHOUT_MEDIA =>
-                'System (excluding Media) backup has been created',
-            \Magento\Framework\Backup\Factory::TYPE_MEDIA => 'Database and media backup has been created',
-            \Magento\Framework\Backup\Factory::TYPE_DB => 'Database backup has been created'
-        );
-
-        if (!isset($messagesMap[$type])) {
-            return '';
-        }
-
-        return $messagesMap[$type];
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model.php b/downloader/app/Magento/Downloader/Model.php
deleted file mode 100644
index d51215701dc6600a4eb65c2562170aa2231b5523..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader;
-
-/**
- * Class Model
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Model
-{
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_data;
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $args = func_get_args();
-        if (empty($args[0])) {
-            $args[0] = array();
-        }
-        $this->_data = $args[0];
-
-        $this->_construct();
-    }
-
-    /**
-     * Constructor for covering
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-    }
-
-    /**
-     * Retrieve controller
-     *
-     * @return \Magento\Downloader\Controller
-     */
-    public function controller()
-    {
-        return \Magento\Downloader\Controller::singleton();
-    }
-
-    /**
-     * Set value for key
-     *
-     * @param string $key
-     * @param mixed $value
-     * @return \Magento\Downloader\Model
-     */
-    public function set($key, $value)
-    {
-        $this->_data[$key] = $value;
-        return $this;
-    }
-
-    /**
-     * Get value by key
-     *
-     * @param string $key
-     * @return mixed
-     */
-    public function get($key)
-    {
-        return isset($this->_data[$key]) ? $this->_data[$key] : null;
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model/Config.php b/downloader/app/Magento/Downloader/Model/Config.php
deleted file mode 100644
index ba5c82335a8baa78f27178943fcdfd8e205a12f7..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Config.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class config
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Downloader\Model;
-
-class Config extends \Magento\Downloader\Model\Config\AbstractConfig
-{
-    /**
-     * Get channel config class
-     * @return \Magento\Downloader\Model\Config\ConfigInterface
-     */
-    public function getChannelConfig()
-    {
-        $this->load();
-        $channel = trim($this->get('root_channel'));
-        if (!empty($channel)) {
-            try {
-                return $this->controller()->model('config_' . $channel, true);
-            } catch (\Exception $e) {
-                throw new \Exception('Not valid config.ini file.');
-            }
-        } else {
-            throw new \Exception('Not valid config.ini file.');
-        }
-    }
-
-    /**
-     * Save post data to config
-     *
-     * @param array $p
-     * @return \Magento\Downloader\Model\Config
-     */
-    public function saveConfigPost($p)
-    {
-        $configParams = array(
-            'protocol',
-            'preferred_state',
-            'use_custom_permissions_mode',
-            'mkdir_mode',
-            'chmod_file_mode',
-            'magento_root',
-            'downloader_path',
-            'root_channel_uri',
-            'root_channel',
-            'ftp'
-        );
-        foreach ($configParams as $paramName) {
-            if (isset($p[$paramName])) {
-                $this->set($paramName, $p[$paramName]);
-            }
-        }
-        $this->save();
-        return $this;
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php b/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php
deleted file mode 100644
index c829c28f0a0e2f7d7d74043e0a46f11f4df7dfb0..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Config/AbstractConfig.php
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class config
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Downloader\Model\Config;
-
-class AbstractConfig extends \Magento\Downloader\Model
-{
-    /**
-     * Retrieve file name
-     *
-     * @return string
-     */
-    public function getFilename()
-    {
-        return $this->controller()->filepath('config.ini');
-    }
-
-    /**
-     * Load file
-     *
-     * @return \Magento\Downloader\Model\Config
-     */
-    public function load()
-    {
-        if (!file_exists($this->getFilename())) {
-            return $this;
-        }
-        $rows = file($this->getFilename());
-        if (!$rows) {
-            return $this;
-        }
-        foreach ($rows as $row) {
-            $arr = explode('=', $row, 2);
-            if (count($arr) !== 2) {
-                continue;
-            }
-            $key = trim($arr[0]);
-            $value = trim($arr[1], " \t\"'\n\r");
-            if (!$key || $key[0] == '#' || $key[0] == ';') {
-                continue;
-            }
-            $this->set($key, $value);
-        }
-        return $this;
-    }
-
-    /**
-     * Save file
-     *
-     * @return \Magento\Downloader\Model\Config
-     */
-    public function save()
-    {
-        if (!is_writable(
-            $this->getFilename()
-        ) && is_file(
-            $this->getFilename()
-        ) || dirname(
-            $this->getFilename()
-        ) != '' && !is_writable(
-            dirname($this->getFilename())
-        )
-        ) {
-            if (isset($this->_data['ftp']) && !empty($this->_data['ftp']) && strlen($this->get('downloader_path')) > 0
-            ) {
-                $confFile = $this->get('downloader_path') . '/' . basename($this->getFilename());
-                $ftpObj = new \Magento\Framework\Connect\Ftp();
-                $ftpObj->connect($this->_data['ftp']);
-                $tempFile = tempnam(sys_get_temp_dir(), 'configini');
-                $fp = fopen($tempFile, 'w');
-                foreach ($this->_data as $k => $v) {
-                    fwrite($fp, $k . '=' . $v . "\n");
-                }
-                fclose($fp);
-                $ret = $ftpObj->upload($confFile, $tempFile);
-                $ftpObj->close();
-            } else {
-                /* @TODO: show Warning message*/
-                $this->controller()->session()->addMessage(
-                    'warning',
-                    'Invalid file permissions, could not save configuration.'
-                );
-                return $this;
-            }
-        } else {
-            $fp = fopen($this->getFilename(), 'w');
-            foreach ($this->_data as $k => $v) {
-                fwrite($fp, $k . '=' . $v . "\n");
-            }
-            fclose($fp);
-        }
-        return $this;
-    }
-
-    /**
-     * Return channel label for channel name
-     *
-     * @param string $channel
-     * @return string
-     */
-    public function getChannelLabel($channel)
-    {
-        $channelLabel = '';
-        switch ($channel) {
-            case 'community':
-                $channelLabel = 'Magento Community Edition';
-                break;
-            default:
-                $channelLabel = $channel;
-                break;
-        }
-        return $channelLabel;
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model/Config/Community.php b/downloader/app/Magento/Downloader/Model/Config/Community.php
deleted file mode 100644
index 402ff4cfc4b60f32683b83b3baccb931f6c15d32..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Config/Community.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader\Model\Config;
-
-/**
- * Class config
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Community extends \Magento\Downloader\Model\Config\AbstractConfig implements
-    \Magento\Downloader\Model\Config\ConfigInterface
-{
-    /**
-     * Initialization
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-        $this->load();
-    }
-
-    /**
-     * Set data for Settings View
-     *
-     * @param \Magento\Framework\Connect\Config $config
-     * @param \Magento\Downloader\View $view
-     * @return void
-     */
-    public function setInstallView($config, $view)
-    {
-        $view->set('channel_logo', 'logo');
-    }
-
-    /**
-     * Set data for Settings View
-     * @param \Magento\Framework\Connect\Config $config
-     * @param \Magento\Downloader\View $view
-     * @return void
-     */
-    public function setSettingsView($config, $view)
-    {
-    }
-
-    /**
-     * Set session data for Settings
-     * @param array $post post data
-     * @param mixed $session Session object
-     * @return void
-     */
-    public function setSettingsSession($post, $session)
-    {
-    }
-
-    /**
-     * Get root channel URI
-     *
-     * @return string Root channel URI
-     */
-    public function getRootChannelUri()
-    {
-        if (!$this->get('root_channel_uri')) {
-            $this->set('root_channel_uri', 'connect20.magentocommerce.com/community');
-        }
-        return $this->get('root_channel_uri');
-    }
-
-    /**
-     * Set config data from POST
-     *
-     * @param \Magento\Framework\Connect\Config $config Config object
-     * @param array $post post data
-     * @return void
-     */
-    public function setPostData($config, &$post)
-    {
-    }
-
-    /**
-     * Set additional command options
-     *
-     * @param mixed $session Session object
-     * @param array $options
-     * @return void
-     */
-    public function setCommandOptions($session, &$options)
-    {
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model/Config/ConfigInterface.php b/downloader/app/Magento/Downloader/Model/Config/ConfigInterface.php
deleted file mode 100644
index 0fd86733c726e74c18749e13c8bee4b0176ff17b..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Config/ConfigInterface.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class config
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Downloader\Model\Config;
-
-interface ConfigInterface
-{
-    /**
-     * Set data for Settings View
-     *
-     * @param \Magento\Framework\Connect\Config $config
-     * @param \Magento\Downloader\View $view
-     * @return null
-     */
-    public function setInstallView($config, $view);
-
-    /**
-     * Set data for Settings View
-     *
-     * @param mixed $session Session object
-     * @param \Magento\Downloader\View $view
-     * @return null
-     */
-    public function setSettingsView($session, $view);
-
-    /**
-     * Set session data for Settings
-     *
-     * @param array $post post data
-     * @param mixed $session Session object
-     * @return null
-     */
-    public function setSettingsSession($post, $session);
-
-    /**
-     * Set config data from POST
-     *
-     * @param \Magento\Framework\Connect\Config $config Config object
-     * @param array $post post data
-     * @return boolean
-     */
-    public function setPostData($config, &$post);
-
-    /**
-     * Get root channel URI
-     *
-     * @return string Root channel URI
-     */
-    public function getRootChannelUri();
-
-    /**
-     * Set additional command options
-     *
-     * @param mixed $session Session object
-     * @param array $options
-     * @return null
-     */
-    public function setCommandOptions($session, &$options);
-}
diff --git a/downloader/app/Magento/Downloader/Model/Connect.php b/downloader/app/Magento/Downloader/Model/Connect.php
deleted file mode 100644
index cf891d4f0a2dbe84c196e1f366287de2e32cb3be..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Connect.php
+++ /dev/null
@@ -1,487 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader\Model;
-
-
-include_once "Magento/Framework/Connect.php";
-/**
- * Class for initialize Magento_Connect lib
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Connect extends \Magento\Downloader\Model
-{
-    /**
-     * Retrieve object of \Magento\Downloader\Connect
-     *
-     * @return \Magento\Downloader\Connect
-     */
-    public function connect()
-    {
-        return \Magento\Downloader\Connect::getInstance();
-    }
-
-    /**
-     * Install All Magento
-     *
-     * @param bool $force
-     * @param string $chanName
-     * @return void
-     */
-    public function installAll($force = false, $chanName = '')
-    {
-        $options = array('install_all' => true);
-        if ($force) {
-            $this->connect()->cleanSconfig();
-            $options['force'] = 1;
-        }
-        $packages = array('Magento_All_Latest');
-        $connectConfig = $this->connect()->getConfig();
-        $ftp = $connectConfig->remote_config;
-        if (!empty($ftp)) {
-            $options['ftp'] = $ftp;
-        }
-        $params = array();
-
-        $uri = $this->controller()->channelConfig()->getRootChannelUri();
-
-        $this->controller()->channelConfig()->setCommandOptions($this->controller()->session(), $options);
-
-        $connectConfig->root_channel = $chanName;
-        foreach ($packages as $package) {
-            $params[] = $uri;
-            $params[] = $package;
-        }
-        $this->connect()->runHtmlConsole(array('command' => 'install', 'options' => $options, 'params' => $params));
-    }
-
-    /**
-     * Prepare to install package
-     *
-     * @param string $id
-     * @return array
-     */
-    public function prepareToInstall($id)
-    {
-        $match = array();
-        if (!$this->checkExtensionKey($id, $match)) {
-            echo 'Invalid package identifier provided: ' . $id;
-            exit;
-        }
-
-        $channel = $match[1];
-        $package = $match[2];
-        $version = !empty($match[3]) ? trim($match[3], '/\-') : '';
-
-        $connect = $this->connect();
-        $sconfig = $connect->getSingleConfig();
-
-        $options = array();
-        $params = array($channel, $package, $version, $version);
-        $this->controller()->channelConfig()->setCommandOptions($this->controller()->session(), $options);
-
-        $connect->run('package-prepare', $options, $params);
-        $output = $connect->getOutput();
-        $errors = $connect->getFrontend()->getErrors();
-        $package_error = array();
-        foreach ($errors as $error) {
-            if (isset($error[1])) {
-                $package_error[] = $error[1];
-            }
-        }
-
-        $packages = array();
-        if (is_array($output) && isset($output['package-prepare'])) {
-            $packages = array_merge($output['package-prepare'], array('errors' => array('error' => $package_error)));
-        } elseif (is_array($output) && !empty($package_error)) {
-            $packages = array('errors' => array('error' => $package_error));
-        }
-        return $packages;
-    }
-
-    /**
-     * Retrieve all installed packages
-     *
-     * @return array
-     */
-    public function getAllInstalledPackages()
-    {
-        $connect = $this->connect();
-        $sconfig = $connect->getSingleConfig(true);
-        $connect->run('list-installed');
-        $output = $connect->getOutput();
-        $packages = array();
-        if (is_array($output) && isset($output['list-installed']['data'])) {
-            $packages = $output['list-installed']['data'];
-        } else {
-        }
-        foreach ($packages as $channel => $package) {
-            foreach ($package as $name => $data) {
-                $summary = $sconfig->getPackageObject($channel, $name)->getSummary();
-                $addition = array('summary' => $summary, 'upgrade_versions' => array(), 'upgrade_latest' => '');
-                $packages[$channel][$name] = array_merge($data, $addition);
-            }
-        }
-
-        if (!empty($_GET['updates'])) {
-            $options = array();
-            $this->controller()->channelConfig()->setCommandOptions($this->controller()->session(), $options);
-            $result = $connect->run('list-upgrades', $options);
-            $output = $connect->getOutput();
-            if (is_array($output)) {
-                $channelData = $output;
-                if (!empty($channelData['list-upgrades']['data']) && is_array($channelData['list-upgrades']['data'])) {
-                    foreach ($channelData['list-upgrades']['data'] as $channel => $package) {
-                        foreach ($package as $name => $data) {
-                            if (!isset($packages[$channel][$name])) {
-                                continue;
-                            }
-                            $packages[$channel][$name]['upgrade_latest'] = $data['to'] . ' (' . $data['from'] . ')';
-                        }
-                    }
-                }
-            }
-        }
-
-        $states = array('snapshot' => 0, 'devel' => 1, 'alpha' => 2, 'beta' => 3, 'stable' => 4);
-        $preferredState = $states[$this->getPreferredState()];
-
-        foreach ($packages as $channel => &$package) {
-            foreach ($package as $name => &$data) {
-                $actions = array();
-                $systemPkg = $name === 'Magento_Downloader';
-                if (!empty($data['upgrade_latest'])) {
-                    $status = 'upgrade-available';
-                    $releases = array();
-                    $connect->run('info', array(), array($channel, $name));
-                    $output = $connect->getOutput();
-                    if (!empty($output['info']['releases'])) {
-                        foreach ($output['info']['releases'] as $release) {
-                            $stability = $packages[$channel][$name]['stability'];
-                            if ($states[$release['s']] < min($preferredState, $states[$stability])) {
-                                continue;
-                            }
-                            if (version_compare($release['v'], $packages[$channel][$name]['version']) < 1) {
-                                continue;
-                            }
-                            $releases[$release['v']] = $release['v'] . ' (' . $release['s'] . ')';
-                        }
-                    }
-
-                    if ($releases) {
-                        uksort($releases, 'version_compare');
-                        foreach ($releases as $version => $release) {
-                            $actions['upgrade|' . $version] = 'Upgrade to ' . $release;
-                        }
-                    } else {
-                        $a = explode(' ', $data['upgrade_latest'], 2);
-                        $actions['upgrade|' . $a[0]] = 'Upgrade';
-                    }
-                    if (!$systemPkg) {
-                        $actions['uninstall'] = 'Uninstall';
-                    }
-                } else {
-                    $status = 'installed';
-                    $actions['reinstall'] = 'Reinstall';
-                    if (!$systemPkg) {
-                        $actions['uninstall'] = 'Uninstall';
-                    }
-                }
-                $packages[$channel][$name]['actions'] = $actions;
-                $packages[$channel][$name]['status'] = $status;
-            }
-        }
-        return $packages;
-    }
-
-    /**
-     * Run packages action
-     *
-     * @param mixed $packages
-     * @param string $ignoreLocalModification
-     * @return void
-     */
-    public function applyPackagesActions($packages, $ignoreLocalModification = '')
-    {
-        $actions = array();
-        foreach ($packages as $package => $action) {
-            if ($action) {
-                $a = explode('|', $package);
-                $b = explode('|', $action);
-                $package = $a[1];
-                $channel = $a[0];
-                $version = '';
-                if ($b[0] == 'upgrade') {
-                    $version = $b[1];
-                }
-                $actions[$b[0]][] = array($channel, $package, $version, $version);
-            }
-        }
-        if (empty($actions)) {
-            $this->connect()->runHtmlConsole('No actions selected');
-            exit;
-        }
-
-        $this->controller()->startInstall();
-
-        $options = array();
-        if (!empty($ignoreLocalModification)) {
-            $options = array('ignorelocalmodification' => 1);
-        }
-        if (!$this->controller()->isWritable() || strlen($this->connect()->getConfig()->__get('remote_config')) > 0) {
-            $options['ftp'] = $this->connect()->getConfig()->__get('remote_config');
-        }
-
-        $this->controller()->channelConfig()->setCommandOptions($this->controller()->session(), $options);
-
-        foreach ($actions as $action => $packages) {
-            foreach ($packages as $package) {
-                switch ($action) {
-                    case 'install':
-                    case 'uninstall':
-                    case 'upgrade':
-                        $this->connect()->runHtmlConsole(
-                            array('command' => $action, 'options' => $options, 'params' => $package)
-                        );
-                        break;
-
-                    case 'reinstall':
-                        $package_info = $this->connect()->getSingleConfig()->getPackage($package[0], $package[1]);
-                        if (isset($package_info['version'])) {
-                            $package[2] = $package_info['version'];
-                            $package[3] = $package_info['version'];
-                        }
-                        $this->connect()->runHtmlConsole(
-                            array(
-                                'command' => 'install',
-                                'options' => array_merge($options, array('force' => 1, 'nodeps' => 1)),
-                                'params' => $package
-                            )
-                        );
-                        break;
-                }
-            }
-        }
-
-        $this->controller()->endInstall();
-    }
-
-    /**
-     * @param string $file file path
-     * @return void
-     */
-    public function installUploadedPackage($file)
-    {
-        $this->controller()->startInstall();
-
-        $options = array();
-        if (!$this->controller()->isWritable() || strlen($this->connect()->getConfig()->__get('remote_config')) > 0) {
-            $options['ftp'] = $this->connect()->getConfig()->__get('remote_config');
-        }
-        $this->connect()->runHtmlConsole(
-            array('command' => 'install-file', 'options' => $options, 'params' => array($file))
-        );
-        $this->controller()->endInstall();
-    }
-
-    /**
-     * Install package by id
-     *
-     * @param string $id
-     * @param bool $force
-     * @return void
-     */
-    public function installPackage($id, $force = false)
-    {
-        $match = array();
-        if (!$this->checkExtensionKey($id, $match)) {
-            $this->connect()->runHtmlConsole('Invalid package identifier provided: ' . $id);
-            exit;
-        }
-
-        $channel = $match[1];
-        $package = $match[2];
-        //.(!empty($match[3]) ? $match[3] : '');
-        $version = !empty($match[3]) ? trim($match[3], '/\-') : '';
-
-        $this->controller()->startInstall();
-
-        $options = array();
-        if ($force) {
-            $options['force'] = 1;
-        }
-        if (!$this->controller()->isWritable() || strlen($this->connect()->getConfig()->__get('remote_config')) > 0) {
-            $options['ftp'] = $this->connect()->getConfig()->__get('remote_config');
-        }
-
-        $this->controller()->channelConfig()->setCommandOptions($this->controller()->session(), $options);
-
-        $this->connect()->runHtmlConsole(
-            array(
-                'command' => 'install',
-                'options' => $options,
-                'params' => array(0 => $channel, 1 => $package, 2 => $version)
-            )
-        );
-
-        $this->controller()->endInstall();
-    }
-
-    /**
-     * Retrieve stability choosen client
-     *
-     * @return string alpha, beta, ...
-     */
-    public function getPreferredState()
-    {
-        if (is_null($this->get('preferred_state'))) {
-            $connectConfig = $this->connect()->getConfig();
-            $this->set('preferred_state', $connectConfig->__get('preferred_state'));
-        }
-        return $this->get('preferred_state');
-    }
-
-    /**
-     * Retrieve protocol choosen client
-     *
-     * @return string http, ftp
-     */
-    public function getProtocol()
-    {
-        if (is_null($this->get('protocol'))) {
-            $connectConfig = $this->connect()->getConfig();
-            $this->set('protocol', $connectConfig->__get('protocol'));
-        }
-        return $this->get('protocol');
-    }
-
-    /**
-     * Validate settings post data.
-     *
-     * @param array $p
-     * @return string[]
-     */
-    public function validateConfigPost($p)
-    {
-        $errors = array();
-        $configTestFile = 'connect.cfgt';
-        $configObj = $this->connect()->getConfig();
-        if ('ftp' == $p['deployment_type'] || '1' == $p['inst_protocol']) {
-            /*check ftp*/
-
-            $confFile = $configObj->downloader_path . '/' . $configTestFile;
-            try {
-                $ftpObj = new \Magento\Framework\Connect\Ftp();
-                $ftpObj->connect($p['ftp']);
-                $tempFile = tempnam(sys_get_temp_dir(), 'config');
-                $serial = md5('config test file');
-                $f = @fopen($tempFile, "w+");
-                @fwrite($f, $serial);
-                @fclose($f);
-                $ret = $ftpObj->upload($confFile, $tempFile);
-
-                //read file
-                if (!$errors && is_file($configTestFile)) {
-                    $size = filesize($configTestFile);
-                    if (!$size) {
-                        $errors[] = 'Unable to read saved settings. Please check Installation Path of FTP Connection.';
-                    }
-
-                    if (!$errors) {
-                        $f = @fopen($configTestFile, "r");
-                        @fseek($f, 0, SEEK_SET);
-
-                        $contents = @fread($f, strlen($serial));
-                        if ($serial != $contents) {
-                            $errors[] = 'Wrong Installation Path of FTP Connection.';
-                        }
-                        fclose($f);
-                    }
-                } else {
-                    $errors[] = 'Unable to read saved settings. Please check Installation Path of FTP Connection.';
-                }
-                $ftpObj->delete($confFile);
-                $ftpObj->close();
-            } catch (\Exception $e) {
-                $errors[] = 'Deployment FTP Error. ' . $e->getMessage();
-            }
-        } else {
-            $p['ftp'] = '';
-        }
-
-        if ('1' == $p['use_custom_permissions_mode']) {
-            /*check permissions*/
-            if (octdec(intval($p['mkdir_mode'])) < 73 || octdec(intval($p['mkdir_mode'])) > 511) {
-                $errors[] = 'Folders permissions not valid. ';
-            }
-            if (octdec(intval($p['chmod_file_mode'])) < 73 || octdec(intval($p['chmod_file_mode'])) > 511) {
-                $errors[] = 'Files permissions not valid. ';
-            }
-        }
-        //$this->controller()->session()->addMessage('success', 'Settings has been successfully saved');
-        return $errors;
-    }
-
-    /**
-     * Save settings.
-     *
-     * @param array $p
-     * @return $this
-     */
-    public function saveConfigPost($p)
-    {
-        $configObj = $this->connect()->getConfig();
-        if ('ftp' == $p['deployment_type'] || '1' == $p['inst_protocol']) {
-            $this->set('ftp', $p['ftp']);
-        } else {
-            $p['ftp'] = '';
-        }
-        $configObj->remote_config = $p['ftp'];
-        $configObj->preferred_state = $p['preferred_state'];
-        $configObj->protocol = $p['protocol'];
-        $configObj->use_custom_permissions_mode = $p['use_custom_permissions_mode'];
-        if ('1' == $p['use_custom_permissions_mode']) {
-            $configObj->global_dir_mode = octdec(intval($p['mkdir_mode']));
-            $configObj->global_file_mode = octdec(intval($p['chmod_file_mode']));
-        }
-        if ($configObj->save()) {
-            $this->controller()->session()->addMessage('success', 'Settings has been successfully saved');
-        } else {
-            $this->controller()->session()->addMessage('error', 'Settings cannot be saved');
-        }
-        return $this;
-    }
-
-    /**
-     * Check Extension Key
-     *
-     * @param string $id
-     * @param array $match
-     * @return int
-     */
-    public function checkExtensionKey($id, &$match)
-    {
-        return preg_match('#^([^ ]+)\/([^-]+)(-.+)?$#', $id, $match);
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model/Connect/Request.php b/downloader/app/Magento/Downloader/Model/Connect/Request.php
deleted file mode 100644
index 973858386f520abfcf844f542e72234d33bcc2ae..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Connect/Request.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader\Model\Connect;
-
-/**
- * Class request
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Request extends \Magento\Downloader\Model
-{
-    /**
-     * @return void
-     */
-    protected function _construct()
-    {
-        parent::_construct();
-        $this->set('success_callback', 'clear_cache({success:parent.onSuccess, fail:parent.onFailure})');
-        $this->set('failure_callback', 'parent.onFailure()');
-    }
-}
diff --git a/downloader/app/Magento/Downloader/Model/Session.php b/downloader/app/Magento/Downloader/Model/Session.php
deleted file mode 100644
index e60fc696ba72ac22bf927aa5a2a54fc790bab1be..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/Model/Session.php
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader\Model;
-
-/**
- * Class session
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class Session extends \Magento\Downloader\Model
-{
-    /**
-     * Session
-     *
-     * @var \Magento\Backend\Model\Auth\Session
-     */
-    protected $_session;
-
-    /**
-     * Init session
-     *
-     * @return \Magento\Downloader\Model\Session
-     */
-    public function start()
-    {
-        if (class_exists('Magento') && \Mage::isInstalled()) {
-            $this->_session = \Mage::getSingleton('Magento\Backend\Model\Auth\Session');
-        } else {
-            session_start();
-        }
-        return $this;
-    }
-
-    /**
-     * Get value by key
-     *
-     * @param string $key
-     * @return mixed
-     */
-    public function get($key)
-    {
-        return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
-    }
-
-    /**
-     * Set value for key
-     *
-     * @param string $key
-     * @param mixed $value
-     * @return $this
-     */
-    public function set($key, $value)
-    {
-        $_SESSION[$key] = $value;
-        return $this;
-    }
-
-    /**
-     * Authentication to downloader
-     *
-     * @return $this
-     */
-    public function authenticate()
-    {
-        if (!$this->_session) {
-            return $this;
-        }
-
-        if (!empty($_GET['return'])) {
-            $this->set('return_url', $_GET['return']);
-        }
-
-        if ($this->_checkUserAccess()) {
-            return $this;
-        }
-
-        if (!$this->controller()->isInstalled()) {
-            return $this;
-        }
-
-        try {
-            if (isset(
-                $_POST['username']
-            ) && empty($_POST['username']) || isset(
-                $_POST['password']
-            ) && empty($_POST['password'])
-            ) {
-                $this->addMessage('error', 'Invalid user name or password');
-            }
-            if (empty($_POST['username']) || empty($_POST['password'])) {
-                $this->controller()->setAction('login');
-                return $this;
-            }
-            $user = $this->_session->login($_POST['username'], $_POST['password']);
-            $this->_session->refreshAcl();
-            if ($this->_checkUserAccess($user)) {
-                return $this;
-            }
-        } catch (\Exception $e) {
-            $this->addMessage('error', $e->getMessage());
-        }
-
-        $this->controller()->redirect($this->controller()->url('loggedin'), true);
-    }
-
-    /**
-     * Check is user logged in and permissions
-     *
-     * @param \Magento\User\Model\User|null $user
-     * @return bool
-     */
-    protected function _checkUserAccess($user = null)
-    {
-        if ($user && !$user->getId()) {
-            $this->addMessage('error', 'Invalid user name or password');
-            $this->controller()->setAction('login');
-        } elseif ($this->getUserId() || $user && $user->getId()) {
-            if (\Mage::getSingleton('Magento\Framework\AuthorizationInterface')->isAllowed('Magento_Adminhtml::all')) {
-                return true;
-            } else {
-                $this->logout();
-                $this->addMessage('error', 'Access Denied', true);
-                $this->controller()->setAction('login');
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Log Out
-     *
-     * @return \Magento\Downloader\Model\Session
-     */
-    public function logout()
-    {
-        if (!$this->_session) {
-            return $this;
-        }
-        $this->_session->unsUser();
-        return $this;
-    }
-
-    /**
-     * Retrieve user
-     *
-     * @return mixed
-     */
-    public function getUserId()
-    {
-        if (($session = $this->_session) && ($user = $session->getUser())) {
-            return $user->getId();
-        }
-        return false;
-    }
-
-    /**
-     * Add Message
-     *
-     * @param string $type
-     * @param string $msg
-     * @param string|bool $clear
-     * @return \Magento\Downloader\Model\Session
-     */
-    public function addMessage($type, $msg, $clear = false)
-    {
-        $msgs = $this->getMessages($clear);
-        $msgs[$type][] = $msg;
-        $this->set('messages', $msgs);
-        return $this;
-    }
-
-    /**
-     * Retrieve messages from cache
-     *
-     * @param bool $clear
-     * @return mixed
-     */
-    public function getMessages($clear = true)
-    {
-        $msgs = $this->get('messages');
-        $msgs = $msgs ? $msgs : array();
-        if ($clear) {
-            unset($_SESSION['messages']);
-        }
-        return $msgs;
-    }
-
-    /**
-     * Retrieve url to adminhtml
-     *
-     * @return string
-     */
-    public function getReturnUrl()
-    {
-        //TODO: added logic for backend url
-        return '';
-    }
-}
diff --git a/downloader/app/Magento/Downloader/View.php b/downloader/app/Magento/Downloader/View.php
deleted file mode 100644
index 4a85de790e725fb8effe13608f53718b9c5c6062..0000000000000000000000000000000000000000
--- a/downloader/app/Magento/Downloader/View.php
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Downloader;
-
-/**
- * Class for viewer
- *
- * @author     Magento Core Team <core@magentocommerce.com>
- */
-class View
-{
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_data = array();
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * Retrieve Controller as singleton
-     *
-     * @return \Magento\Downloader\Controller
-     */
-    public function controller()
-    {
-        return \Magento\Downloader\Controller::singleton();
-    }
-
-    /**
-     * Create url by action and params
-     *
-     * @param mixed $action
-     * @param mixed $params
-     * @return string
-     */
-    public function url($action = '', $params = array())
-    {
-        return $this->controller()->url($action, $params);
-    }
-
-    /**
-     * Retrieve base url
-     *
-     * @return string
-     */
-    public function baseUrl()
-    {
-        return str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
-    }
-
-    /**
-     * Retrieve url of magento
-     *
-     * @return string
-     */
-    public function mageUrl()
-    {
-        return str_replace('\\', '/', dirname($this->baseUrl()));
-    }
-
-    /**
-     * Include template
-     *
-     * @param string $name
-     * @return string
-     */
-    public function template($name)
-    {
-        ob_start();
-        include $this->controller()->filepath('template/' . $name);
-        return ob_get_clean();
-    }
-
-    /**
-     * Set value for key
-     *
-     * @param string $key
-     * @param mixed $value
-     * @return \Magento\Downloader\Controller
-     */
-    public function set($key, $value)
-    {
-        $this->_data[$key] = $value;
-        return $this;
-    }
-
-    /**
-     * Get value by key
-     *
-     * @param string $key
-     * @return mixed
-     */
-    public function get($key)
-    {
-        return isset($this->_data[$key]) ? $this->_data[$key] : null;
-    }
-
-    /**
-     * Retrieve link for header menu
-     *
-     * @param mixed $action
-     * @return string
-     */
-    public function getNavLinkParams($action)
-    {
-        $params = 'href="' . $this->url($action) . '"';
-        if ($this->controller()->getAction() == $action) {
-            $params .= ' class="active"';
-        }
-        return $params;
-    }
-}
diff --git a/downloader/config.ini b/downloader/config.ini
deleted file mode 100644
index b2c56fcdc75d5a68c5d9c189642d4d32c122325c..0000000000000000000000000000000000000000
--- a/downloader/config.ini
+++ /dev/null
@@ -1 +0,0 @@
-root_channel=community
\ No newline at end of file
diff --git a/downloader/favicon.ico b/downloader/favicon.ico
deleted file mode 100644
index 1cb7c7713718b5d6b7995734db32a1fdf9bf5b16..0000000000000000000000000000000000000000
Binary files a/downloader/favicon.ico and /dev/null differ
diff --git a/downloader/index.php b/downloader/index.php
deleted file mode 100644
index 03e7db5ec1e30b204c9336c5237dd2c4d4d6a57e..0000000000000000000000000000000000000000
--- a/downloader/index.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-if (version_compare(phpversion(), '5.4.0', '<') === true) {
-    echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.4.0 or newer. <a href="http://www.magentocommerce.com/magento2/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
-    exit;
-}
-
-
-\Magento\Framework\Autoload\Simple::register();
-require_once("lib/Magento/Framework/Autoload/Simple.php");
-umask(0);
-\Magento\Downloader\Controller::run();
diff --git a/downloader/js/prototype.js b/downloader/js/prototype.js
deleted file mode 100644
index a3f21ac790995f83f0d7e1dfc8a448d7580d035b..0000000000000000000000000000000000000000
--- a/downloader/js/prototype.js
+++ /dev/null
@@ -1,3277 +0,0 @@
-/*  Prototype JavaScript framework, version 1.5.1.1
- *  (c) 2005-2007 Sam Stephenson
- *
- *  Prototype is freely distributable under the terms of an MIT-style license.
- *  For details, see the Prototype web site: http://www.prototypejs.org/
- *
-/*--------------------------------------------------------------------------*/
-
-var Prototype = {
-  Version: '1.5.1.1',
-
-  Browser: {
-    IE:     !!(window.attachEvent && !window.opera),
-    Opera:  !!window.opera,
-    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
-    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1
-  },
-
-  BrowserFeatures: {
-    XPath: !!document.evaluate,
-    ElementExtensions: !!window.HTMLElement,
-    SpecificElementExtensions:
-      (document.createElement('div').__proto__ !==
-       document.createElement('form').__proto__)
-  },
-
-  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
-  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
-
-  emptyFunction: function() { },
-  K: function(x) { return x }
-}
-
-var Class = {
-  create: function() {
-    return function() {
-      this.initialize.apply(this, arguments);
-    }
-  }
-}
-
-var Abstract = new Object();
-
-Object.extend = function(destination, source) {
-  for (var property in source) {
-    destination[property] = source[property];
-  }
-  return destination;
-}
-
-Object.extend(Object, {
-  inspect: function(object) {
-    try {
-      if (object === undefined) return 'undefined';
-      if (object === null) return 'null';
-      return object.inspect ? object.inspect() : object.toString();
-    } catch (e) {
-      if (e instanceof RangeError) return '...';
-      throw e;
-    }
-  },
-
-  toJSON: function(object) {
-    var type = typeof object;
-    switch(type) {
-      case 'undefined':
-      case 'function':
-      case 'unknown': return;
-      case 'boolean': return object.toString();
-    }
-    if (object === null) return 'null';
-    if (object.toJSON) return object.toJSON();
-    if (object.ownerDocument === document) return;
-    var results = [];
-    for (var property in object) {
-      var value = Object.toJSON(object[property]);
-      if (value !== undefined)
-        results.push(property.toJSON() + ': ' + value);
-    }
-    return '{' + results.join(', ') + '}';
-  },
-
-  keys: function(object) {
-    var keys = [];
-    for (var property in object)
-      keys.push(property);
-    return keys;
-  },
-
-  values: function(object) {
-    var values = [];
-    for (var property in object)
-      values.push(object[property]);
-    return values;
-  },
-
-  clone: function(object) {
-    return Object.extend({}, object);
-  }
-});
-
-Function.prototype.bind = function() {
-  var __method = this, args = $A(arguments), object = args.shift();
-  return function() {
-    return __method.apply(object, args.concat($A(arguments)));
-  }
-}
-
-Function.prototype.bindAsEventListener = function(object) {
-  var __method = this, args = $A(arguments), object = args.shift();
-  return function(event) {
-    return __method.apply(object, [event || window.event].concat(args));
-  }
-}
-
-Object.extend(Number.prototype, {
-  toColorPart: function() {
-    return this.toPaddedString(2, 16);
-  },
-
-  succ: function() {
-    return this + 1;
-  },
-
-  times: function(iterator) {
-    $R(0, this, true).each(iterator);
-    return this;
-  },
-
-  toPaddedString: function(length, radix) {
-    var string = this.toString(radix || 10);
-    return '0'.times(length - string.length) + string;
-  },
-
-  toJSON: function() {
-    return isFinite(this) ? this.toString() : 'null';
-  }
-});
-
-Date.prototype.toJSON = function() {
-  return '"' + this.getFullYear() + '-' +
-    (this.getMonth() + 1).toPaddedString(2) + '-' +
-    this.getDate().toPaddedString(2) + 'T' +
-    this.getHours().toPaddedString(2) + ':' +
-    this.getMinutes().toPaddedString(2) + ':' +
-    this.getSeconds().toPaddedString(2) + '"';
-};
-
-var Try = {
-  these: function() {
-    var returnValue;
-
-    for (var i = 0, length = arguments.length; i < length; i++) {
-      var lambda = arguments[i];
-      try {
-        returnValue = lambda();
-        break;
-      } catch (e) {}
-    }
-
-    return returnValue;
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
-  initialize: function(callback, frequency) {
-    this.callback = callback;
-    this.frequency = frequency;
-    this.currentlyExecuting = false;
-
-    this.registerCallback();
-  },
-
-  registerCallback: function() {
-    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
-  },
-
-  stop: function() {
-    if (!this.timer) return;
-    clearInterval(this.timer);
-    this.timer = null;
-  },
-
-  onTimerEvent: function() {
-    if (!this.currentlyExecuting) {
-      try {
-        this.currentlyExecuting = true;
-        this.callback(this);
-      } finally {
-        this.currentlyExecuting = false;
-      }
-    }
-  }
-}
-Object.extend(String, {
-  interpret: function(value) {
-    return value == null ? '' : String(value);
-  },
-  specialChar: {
-    '\b': '\\b',
-    '\t': '\\t',
-    '\n': '\\n',
-    '\f': '\\f',
-    '\r': '\\r',
-    '\\': '\\\\'
-  }
-});
-
-Object.extend(String.prototype, {
-  gsub: function(pattern, replacement) {
-    var result = '', source = this, match;
-    replacement = arguments.callee.prepareReplacement(replacement);
-
-    while (source.length > 0) {
-      if (match = source.match(pattern)) {
-        result += source.slice(0, match.index);
-        result += String.interpret(replacement(match));
-        source  = source.slice(match.index + match[0].length);
-      } else {
-        result += source, source = '';
-      }
-    }
-    return result;
-  },
-
-  sub: function(pattern, replacement, count) {
-    replacement = this.gsub.prepareReplacement(replacement);
-    count = count === undefined ? 1 : count;
-
-    return this.gsub(pattern, function(match) {
-      if (--count < 0) return match[0];
-      return replacement(match);
-    });
-  },
-
-  scan: function(pattern, iterator) {
-    this.gsub(pattern, iterator);
-    return this;
-  },
-
-  truncate: function(length, truncation) {
-    length = length || 30;
-    truncation = truncation === undefined ? '...' : truncation;
-    return this.length > length ?
-      this.slice(0, length - truncation.length) + truncation : this;
-  },
-
-  strip: function() {
-    return this.replace(/^\s+/, '').replace(/\s+$/, '');
-  },
-
-  stripTags: function() {
-    return this.replace(/<\/?[^>]+>/gi, '');
-  },
-
-  stripScripts: function() {
-    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
-  },
-
-  extractScripts: function() {
-    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
-    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
-    return (this.match(matchAll) || []).map(function(scriptTag) {
-      return (scriptTag.match(matchOne) || ['', ''])[1];
-    });
-  },
-
-  evalScripts: function() {
-    return this.extractScripts().map(function(script) { return eval(script) });
-  },
-
-  escapeHTML: function() {
-    var self = arguments.callee;
-    self.text.data = this;
-    return self.div.innerHTML;
-  },
-
-  unescapeHTML: function() {
-    var div = document.createElement('div');
-    div.innerHTML = this.stripTags();
-    return div.childNodes[0] ? (div.childNodes.length > 1 ?
-      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
-      div.childNodes[0].nodeValue) : '';
-  },
-
-  toQueryParams: function(separator) {
-    var match = this.strip().match(/([^?#]*)(#.*)?$/);
-    if (!match) return {};
-
-    return match[1].split(separator || '&').inject({}, function(hash, pair) {
-      if ((pair = pair.split('='))[0]) {
-        var key = decodeURIComponent(pair.shift());
-        var value = pair.length > 1 ? pair.join('=') : pair[0];
-        if (value != undefined) value = decodeURIComponent(value);
-
-        if (key in hash) {
-          if (hash[key].constructor != Array) hash[key] = [hash[key]];
-          hash[key].push(value);
-        }
-        else hash[key] = value;
-      }
-      return hash;
-    });
-  },
-
-  toArray: function() {
-    return this.split('');
-  },
-
-  succ: function() {
-    return this.slice(0, this.length - 1) +
-      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
-  },
-
-  times: function(count) {
-    var result = '';
-    for (var i = 0; i < count; i++) result += this;
-    return result;
-  },
-
-  camelize: function() {
-    var parts = this.split('-'), len = parts.length;
-    if (len == 1) return parts[0];
-
-    var camelized = this.charAt(0) == '-'
-      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
-      : parts[0];
-
-    for (var i = 1; i < len; i++)
-      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
-    return camelized;
-  },
-
-  capitalize: function() {
-    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
-  },
-
-  underscore: function() {
-    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
-  },
-
-  dasherize: function() {
-    return this.gsub(/_/,'-');
-  },
-
-  inspect: function(useDoubleQuotes) {
-    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
-      var character = String.specialChar[match[0]];
-      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
-    });
-    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
-    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
-  },
-
-  toJSON: function() {
-    return this.inspect(true);
-  },
-
-  unfilterJSON: function(filter) {
-    return this.sub(filter || Prototype.JSONFilter, '#{1}');
-  },
-
-  isJSON: function() {
-    var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
-    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
-  },
-
-  evalJSON: function(sanitize) {
-    var json = this.unfilterJSON();
-    try {
-      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
-    } catch (e) { }
-    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
-  },
-
-  include: function(pattern) {
-    return this.indexOf(pattern) > -1;
-  },
-
-  startsWith: function(pattern) {
-    return this.indexOf(pattern) === 0;
-  },
-
-  endsWith: function(pattern) {
-    var d = this.length - pattern.length;
-    return d >= 0 && this.lastIndexOf(pattern) === d;
-  },
-
-  empty: function() {
-    return this == '';
-  },
-
-  blank: function() {
-    return /^\s*$/.test(this);
-  }
-});
-
-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
-  escapeHTML: function() {
-    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
-  },
-  unescapeHTML: function() {
-    return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
-  }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
-  if (typeof replacement == 'function') return replacement;
-  var template = new Template(replacement);
-  return function(match) { return template.evaluate(match) };
-}
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-Object.extend(String.prototype.escapeHTML, {
-  div:  document.createElement('div'),
-  text: document.createTextNode('')
-});
-
-with (String.prototype.escapeHTML) div.appendChild(text);
-
-var Template = Class.create();
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-Template.prototype = {
-  initialize: function(template, pattern) {
-    this.template = template.toString();
-    this.pattern  = pattern || Template.Pattern;
-  },
-
-  evaluate: function(object) {
-    return this.template.gsub(this.pattern, function(match) {
-      var before = match[1];
-      if (before == '\\') return match[2];
-      return before + String.interpret(object[match[3]]);
-    });
-  }
-}
-
-var $break = {}, $continue = new Error('"throw $continue" is deprecated, use "return" instead');
-
-var Enumerable = {
-  each: function(iterator) {
-    var index = 0;
-    try {
-      this._each(function(value) {
-        iterator(value, index++);
-      });
-    } catch (e) {
-      if (e != $break) throw e;
-    }
-    return this;
-  },
-
-  eachSlice: function(number, iterator) {
-    var index = -number, slices = [], array = this.toArray();
-    while ((index += number) < array.length)
-      slices.push(array.slice(index, index+number));
-    return slices.map(iterator);
-  },
-
-  all: function(iterator) {
-    var result = true;
-    this.each(function(value, index) {
-      result = result && !!(iterator || Prototype.K)(value, index);
-      if (!result) throw $break;
-    });
-    return result;
-  },
-
-  any: function(iterator) {
-    var result = false;
-    this.each(function(value, index) {
-      if (result = !!(iterator || Prototype.K)(value, index))
-        throw $break;
-    });
-    return result;
-  },
-
-  collect: function(iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      results.push((iterator || Prototype.K)(value, index));
-    });
-    return results;
-  },
-
-  detect: function(iterator) {
-    var result;
-    this.each(function(value, index) {
-      if (iterator(value, index)) {
-        result = value;
-        throw $break;
-      }
-    });
-    return result;
-  },
-
-  findAll: function(iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      if (iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  grep: function(pattern, iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      var stringValue = value.toString();
-      if (stringValue.match(pattern))
-        results.push((iterator || Prototype.K)(value, index));
-    })
-    return results;
-  },
-
-  include: function(object) {
-    var found = false;
-    this.each(function(value) {
-      if (value == object) {
-        found = true;
-        throw $break;
-      }
-    });
-    return found;
-  },
-
-  inGroupsOf: function(number, fillWith) {
-    fillWith = fillWith === undefined ? null : fillWith;
-    return this.eachSlice(number, function(slice) {
-      while(slice.length < number) slice.push(fillWith);
-      return slice;
-    });
-  },
-
-  inject: function(memo, iterator) {
-    this.each(function(value, index) {
-      memo = iterator(memo, value, index);
-    });
-    return memo;
-  },
-
-  invoke: function(method) {
-    var args = $A(arguments).slice(1);
-    return this.map(function(value) {
-      return value[method].apply(value, args);
-    });
-  },
-
-  max: function(iterator) {
-    var result;
-    this.each(function(value, index) {
-      value = (iterator || Prototype.K)(value, index);
-      if (result == undefined || value >= result)
-        result = value;
-    });
-    return result;
-  },
-
-  min: function(iterator) {
-    var result;
-    this.each(function(value, index) {
-      value = (iterator || Prototype.K)(value, index);
-      if (result == undefined || value < result)
-        result = value;
-    });
-    return result;
-  },
-
-  partition: function(iterator) {
-    var trues = [], falses = [];
-    this.each(function(value, index) {
-      ((iterator || Prototype.K)(value, index) ?
-        trues : falses).push(value);
-    });
-    return [trues, falses];
-  },
-
-  pluck: function(property) {
-    var results = [];
-    this.each(function(value, index) {
-      results.push(value[property]);
-    });
-    return results;
-  },
-
-  reject: function(iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      if (!iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  sortBy: function(iterator) {
-    return this.map(function(value, index) {
-      return {value: value, criteria: iterator(value, index)};
-    }).sort(function(left, right) {
-      var a = left.criteria, b = right.criteria;
-      return a < b ? -1 : a > b ? 1 : 0;
-    }).pluck('value');
-  },
-
-  toArray: function() {
-    return this.map();
-  },
-
-  zip: function() {
-    var iterator = Prototype.K, args = $A(arguments);
-    if (typeof args.last() == 'function')
-      iterator = args.pop();
-
-    var collections = [this].concat(args).map($A);
-    return this.map(function(value, index) {
-      return iterator(collections.pluck(index));
-    });
-  },
-
-  size: function() {
-    return this.toArray().length;
-  },
-
-  inspect: function() {
-    return '#<Enumerable:' + this.toArray().inspect() + '>';
-  }
-}
-
-Object.extend(Enumerable, {
-  map:     Enumerable.collect,
-  find:    Enumerable.detect,
-  select:  Enumerable.findAll,
-  member:  Enumerable.include,
-  entries: Enumerable.toArray
-});
-var $A = Array.from = function(iterable) {
-  if (!iterable) return [];
-  if (iterable.toArray) {
-    return iterable.toArray();
-  } else {
-    var results = [];
-    for (var i = 0, length = iterable.length; i < length; i++)
-      results.push(iterable[i]);
-    return results;
-  }
-}
-
-if (Prototype.Browser.WebKit) {
-  $A = Array.from = function(iterable) {
-    if (!iterable) return [];
-    if (!(typeof iterable == 'function' && iterable == '[object NodeList]') &&
-      iterable.toArray) {
-      return iterable.toArray();
-    } else {
-      var results = [];
-      for (var i = 0, length = iterable.length; i < length; i++)
-        results.push(iterable[i]);
-      return results;
-    }
-  }
-}
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse)
-  Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
-  _each: function(iterator) {
-    for (var i = 0, length = this.length; i < length; i++)
-      iterator(this[i]);
-  },
-
-  clear: function() {
-    this.length = 0;
-    return this;
-  },
-
-  first: function() {
-    return this[0];
-  },
-
-  last: function() {
-    return this[this.length - 1];
-  },
-
-  compact: function() {
-    return this.select(function(value) {
-      return value != null;
-    });
-  },
-
-  flatten: function() {
-    return this.inject([], function(array, value) {
-      return array.concat(value && value.constructor == Array ?
-        value.flatten() : [value]);
-    });
-  },
-
-  without: function() {
-    var values = $A(arguments);
-    return this.select(function(value) {
-      return !values.include(value);
-    });
-  },
-
-  indexOf: function(object) {
-    for (var i = 0, length = this.length; i < length; i++)
-      if (this[i] == object) return i;
-    return -1;
-  },
-
-  reverse: function(inline) {
-    return (inline !== false ? this : this.toArray())._reverse();
-  },
-
-  reduce: function() {
-    return this.length > 1 ? this : this[0];
-  },
-
-  uniq: function(sorted) {
-    return this.inject([], function(array, value, index) {
-      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
-        array.push(value);
-      return array;
-    });
-  },
-
-  clone: function() {
-    return [].concat(this);
-  },
-
-  size: function() {
-    return this.length;
-  },
-
-  inspect: function() {
-    return '[' + this.map(Object.inspect).join(', ') + ']';
-  },
-
-  toJSON: function() {
-    var results = [];
-    this.each(function(object) {
-      var value = Object.toJSON(object);
-      if (value !== undefined) results.push(value);
-    });
-    return '[' + results.join(', ') + ']';
-  }
-});
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string) {
-  string = string.strip();
-  return string ? string.split(/\s+/) : [];
-}
-
-if (Prototype.Browser.Opera){
-  Array.prototype.concat = function() {
-    var array = [];
-    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
-    for (var i = 0, length = arguments.length; i < length; i++) {
-      if (arguments[i].constructor == Array) {
-        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
-          array.push(arguments[i][j]);
-      } else {
-        array.push(arguments[i]);
-      }
-    }
-    return array;
-  }
-}
-var Hash = function(object) {
-  if (object instanceof Hash) this.merge(object);
-  else Object.extend(this, object || {});
-};
-
-Object.extend(Hash, {
-  toQueryString: function(obj) {
-    var parts = [];
-    parts.add = arguments.callee.addPair;
-
-    this.prototype._each.call(obj, function(pair) {
-      if (!pair.key) return;
-      var value = pair.value;
-
-      if (value && typeof value == 'object') {
-        if (value.constructor == Array) value.each(function(value) {
-          parts.add(pair.key, value);
-        });
-        return;
-      }
-      parts.add(pair.key, value);
-    });
-
-    return parts.join('&');
-  },
-
-  toJSON: function(object) {
-    var results = [];
-    this.prototype._each.call(object, function(pair) {
-      var value = Object.toJSON(pair.value);
-      if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value);
-    });
-    return '{' + results.join(', ') + '}';
-  }
-});
-
-Hash.toQueryString.addPair = function(key, value, prefix) {
-  key = encodeURIComponent(key);
-  if (value === undefined) this.push(key);
-  else this.push(key + '=' + (value == null ? '' : encodeURIComponent(value)));
-}
-
-Object.extend(Hash.prototype, Enumerable);
-Object.extend(Hash.prototype, {
-  _each: function(iterator) {
-    for (var key in this) {
-      var value = this[key];
-      if (value && value == Hash.prototype[key]) continue;
-
-      var pair = [key, value];
-      pair.key = key;
-      pair.value = value;
-      iterator(pair);
-    }
-  },
-
-  keys: function() {
-    return this.pluck('key');
-  },
-
-  values: function() {
-    return this.pluck('value');
-  },
-
-  merge: function(hash) {
-    return $H(hash).inject(this, function(mergedHash, pair) {
-      mergedHash[pair.key] = pair.value;
-      return mergedHash;
-    });
-  },
-
-  remove: function() {
-    var result;
-    for(var i = 0, length = arguments.length; i < length; i++) {
-      var value = this[arguments[i]];
-      if (value !== undefined){
-        if (result === undefined) result = value;
-        else {
-          if (result.constructor != Array) result = [result];
-          result.push(value)
-        }
-      }
-      delete this[arguments[i]];
-    }
-    return result;
-  },
-
-  toQueryString: function() {
-    return Hash.toQueryString(this);
-  },
-
-  inspect: function() {
-    return '#<Hash:{' + this.map(function(pair) {
-      return pair.map(Object.inspect).join(': ');
-    }).join(', ') + '}>';
-  },
-
-  toJSON: function() {
-    return Hash.toJSON(this);
-  }
-});
-
-function $H(object) {
-  if (object instanceof Hash) return object;
-  return new Hash(object);
-};
-
-// Safari iterates over shadowed properties
-if (function() {
-  var i = 0, Test = function(value) { this.key = value };
-  Test.prototype.key = 'foo';
-  for (var property in new Test('bar')) i++;
-  return i > 1;
-}()) Hash.prototype._each = function(iterator) {
-  var cache = [];
-  for (var key in this) {
-    var value = this[key];
-    if ((value && value == Hash.prototype[key]) || cache.include(key)) continue;
-    cache.push(key);
-    var pair = [key, value];
-    pair.key = key;
-    pair.value = value;
-    iterator(pair);
-  }
-};
-ObjectRange = Class.create();
-Object.extend(ObjectRange.prototype, Enumerable);
-Object.extend(ObjectRange.prototype, {
-  initialize: function(start, end, exclusive) {
-    this.start = start;
-    this.end = end;
-    this.exclusive = exclusive;
-  },
-
-  _each: function(iterator) {
-    var value = this.start;
-    while (this.include(value)) {
-      iterator(value);
-      value = value.succ();
-    }
-  },
-
-  include: function(value) {
-    if (value < this.start)
-      return false;
-    if (this.exclusive)
-      return value < this.end;
-    return value <= this.end;
-  }
-});
-
-var $R = function(start, end, exclusive) {
-  return new ObjectRange(start, end, exclusive);
-}
-
-var Ajax = {
-  getTransport: function() {
-    return Try.these(
-      function() {return new XMLHttpRequest()},
-      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
-      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
-    ) || false;
-  },
-
-  activeRequestCount: 0
-}
-
-Ajax.Responders = {
-  responders: [],
-
-  _each: function(iterator) {
-    this.responders._each(iterator);
-  },
-
-  register: function(responder) {
-    if (!this.include(responder))
-      this.responders.push(responder);
-  },
-
-  unregister: function(responder) {
-    this.responders = this.responders.without(responder);
-  },
-
-  dispatch: function(callback, request, transport, json) {
-    this.each(function(responder) {
-      if (typeof responder[callback] == 'function') {
-        try {
-          responder[callback].apply(responder, [request, transport, json]);
-        } catch (e) {}
-      }
-    });
-  }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
-  onCreate: function() {
-    Ajax.activeRequestCount++;
-  },
-  onComplete: function() {
-    Ajax.activeRequestCount--;
-  }
-});
-
-Ajax.Base = function() {};
-Ajax.Base.prototype = {
-  setOptions: function(options) {
-    this.options = {
-      method:       'post',
-      asynchronous: true,
-      contentType:  'application/x-www-form-urlencoded',
-      encoding:     'UTF-8',
-      parameters:   ''
-    }
-    Object.extend(this.options, options || {});
-
-    this.options.method = this.options.method.toLowerCase();
-    if (typeof this.options.parameters == 'string')
-      this.options.parameters = this.options.parameters.toQueryParams();
-  }
-}
-
-Ajax.Request = Class.create();
-Ajax.Request.Events =
-  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
-  _complete: false,
-
-  initialize: function(url, options) {
-    this.transport = Ajax.getTransport();
-    this.setOptions(options);
-    this.request(url);
-  },
-
-  request: function(url) {
-    this.url = url;
-    this.method = this.options.method;
-    var params = Object.clone(this.options.parameters);
-
-    if (!['get', 'post'].include(this.method)) {
-      // simulate other verbs over post
-      params['_method'] = this.method;
-      this.method = 'post';
-    }
-
-    this.parameters = params;
-
-    if (params = Hash.toQueryString(params)) {
-      // when GET, append parameters to URL
-      if (this.method == 'get')
-        this.url += (this.url.include('?') ? '&' : '?') + params;
-      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
-        params += '&_=';
-    }
-
-    try {
-      if (this.options.onCreate) this.options.onCreate(this.transport);
-      Ajax.Responders.dispatch('onCreate', this, this.transport);
-
-      this.transport.open(this.method.toUpperCase(), this.url,
-        this.options.asynchronous);
-
-      if (this.options.asynchronous)
-        setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
-
-      this.transport.onreadystatechange = this.onStateChange.bind(this);
-      this.setRequestHeaders();
-
-      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
-      this.transport.send(this.body);
-
-      /* Force Firefox to handle ready state 4 for synchronous requests */
-      if (!this.options.asynchronous && this.transport.overrideMimeType)
-        this.onStateChange();
-
-    }
-    catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  onStateChange: function() {
-    var readyState = this.transport.readyState;
-    if (readyState > 1 && !((readyState == 4) && this._complete))
-      this.respondToReadyState(this.transport.readyState);
-  },
-
-  setRequestHeaders: function() {
-    var headers = {
-      'X-Requested-With': 'XMLHttpRequest',
-      'X-Prototype-Version': Prototype.Version,
-      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
-    };
-
-    if (this.method == 'post') {
-      headers['Content-type'] = this.options.contentType +
-        (this.options.encoding ? '; charset=' + this.options.encoding : '');
-
-      /* Force "Connection: close" for older Mozilla browsers to work
-       * around a bug where XMLHttpRequest sends an incorrect
-       * Content-length header. See Mozilla Bugzilla #246651.
-       */
-      if (this.transport.overrideMimeType &&
-          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
-            headers['Connection'] = 'close';
-    }
-
-    // user-defined headers
-    if (typeof this.options.requestHeaders == 'object') {
-      var extras = this.options.requestHeaders;
-
-      if (typeof extras.push == 'function')
-        for (var i = 0, length = extras.length; i < length; i += 2)
-          headers[extras[i]] = extras[i+1];
-      else
-        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
-    }
-
-    for (var name in headers)
-      this.transport.setRequestHeader(name, headers[name]);
-  },
-
-  success: function() {
-    return !this.transport.status
-        || (this.transport.status >= 200 && this.transport.status < 300);
-  },
-
-  respondToReadyState: function(readyState) {
-    var state = Ajax.Request.Events[readyState];
-    var transport = this.transport, json = this.evalJSON();
-
-    if (state == 'Complete') {
-      try {
-        this._complete = true;
-        (this.options['on' + this.transport.status]
-         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
-         || Prototype.emptyFunction)(transport, json);
-      } catch (e) {
-        this.dispatchException(e);
-      }
-
-      var contentType = this.getHeader('Content-type');
-      if (contentType && contentType.strip().
-        match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
-          this.evalResponse();
-    }
-
-    try {
-      (this.options['on' + state] || Prototype.emptyFunction)(transport, json);
-      Ajax.Responders.dispatch('on' + state, this, transport, json);
-    } catch (e) {
-      this.dispatchException(e);
-    }
-
-    if (state == 'Complete') {
-      // avoid memory leak in MSIE: clean up
-      this.transport.onreadystatechange = Prototype.emptyFunction;
-    }
-  },
-
-  getHeader: function(name) {
-    try {
-      return this.transport.getResponseHeader(name);
-    } catch (e) { return null }
-  },
-
-  evalJSON: function() {
-    try {
-      var json = this.getHeader('X-JSON');
-      return json ? json.evalJSON() : null;
-    } catch (e) { return null }
-  },
-
-  evalResponse: function() {
-    try {
-      return eval((this.transport.responseText || '').unfilterJSON());
-    } catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  dispatchException: function(exception) {
-    (this.options.onException || Prototype.emptyFunction)(this, exception);
-    Ajax.Responders.dispatch('onException', this, exception);
-  }
-});
-
-Ajax.Updater = Class.create();
-
-Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
-  initialize: function(container, url, options) {
-    this.container = {
-      success: (container.success || container),
-      failure: (container.failure || (container.success ? null : container))
-    }
-
-    this.transport = Ajax.getTransport();
-    this.setOptions(options);
-
-    var onComplete = this.options.onComplete || Prototype.emptyFunction;
-    this.options.onComplete = (function(transport, param) {
-      this.updateContent();
-      onComplete(transport, param);
-    }).bind(this);
-
-    this.request(url);
-  },
-
-  updateContent: function() {
-    var receiver = this.container[this.success() ? 'success' : 'failure'];
-    var response = this.transport.responseText;
-
-    if (!this.options.evalScripts) response = response.stripScripts();
-
-    if (receiver = $(receiver)) {
-      if (this.options.insertion)
-        new this.options.insertion(receiver, response);
-      else
-        receiver.update(response);
-    }
-
-    if (this.success()) {
-      if (this.onComplete)
-        setTimeout(this.onComplete.bind(this), 10);
-    }
-  }
-});
-
-Ajax.PeriodicalUpdater = Class.create();
-Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
-  initialize: function(container, url, options) {
-    this.setOptions(options);
-    this.onComplete = this.options.onComplete;
-
-    this.frequency = (this.options.frequency || 2);
-    this.decay = (this.options.decay || 1);
-
-    this.updater = {};
-    this.container = container;
-    this.url = url;
-
-    this.start();
-  },
-
-  start: function() {
-    this.options.onComplete = this.updateComplete.bind(this);
-    this.onTimerEvent();
-  },
-
-  stop: function() {
-    this.updater.options.onComplete = undefined;
-    clearTimeout(this.timer);
-    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
-  },
-
-  updateComplete: function(request) {
-    if (this.options.decay) {
-      this.decay = (request.responseText == this.lastText ?
-        this.decay * this.options.decay : 1);
-
-      this.lastText = request.responseText;
-    }
-    this.timer = setTimeout(this.onTimerEvent.bind(this),
-      this.decay * this.frequency * 1000);
-  },
-
-  onTimerEvent: function() {
-    this.updater = new Ajax.Updater(this.container, this.url, this.options);
-  }
-});
-function $(element) {
-  if (arguments.length > 1) {
-    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
-      elements.push($(arguments[i]));
-    return elements;
-  }
-  if (typeof element == 'string')
-    element = document.getElementById(element);
-  return Element.extend(element);
-}
-
-if (Prototype.BrowserFeatures.XPath) {
-  document._getElementsByXPath = function(expression, parentElement) {
-    var results = [];
-    var query = document.evaluate(expression, $(parentElement) || document,
-      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
-    for (var i = 0, length = query.snapshotLength; i < length; i++)
-      results.push(query.snapshotItem(i));
-    return results;
-  };
-
-  document.getElementsByClassName = function(className, parentElement) {
-    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
-    return document._getElementsByXPath(q, parentElement);
-  }
-
-} else document.getElementsByClassName = function(className, parentElement) {
-  var children = ($(parentElement) || document.body).getElementsByTagName('*');
-  var elements = [], child, pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
-  for (var i = 0, length = children.length; i < length; i++) {
-    child = children[i];
-    var elementClassName = child.className;
-    if (elementClassName.length == 0) continue;
-    if (elementClassName == className || elementClassName.match(pattern))
-      elements.push(Element.extend(child));
-  }
-  return elements;
-};
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Element) var Element = {};
-
-Element.extend = function(element) {
-  var F = Prototype.BrowserFeatures;
-  if (!element || !element.tagName || element.nodeType == 3 ||
-   element._extended || F.SpecificElementExtensions || element == window)
-    return element;
-
-  var methods = {}, tagName = element.tagName, cache = Element.extend.cache,
-   T = Element.Methods.ByTag;
-
-  // extend methods for all tags (Safari doesn't need this)
-  if (!F.ElementExtensions) {
-    Object.extend(methods, Element.Methods),
-    Object.extend(methods, Element.Methods.Simulated);
-  }
-
-  // extend methods for specific tags
-  if (T[tagName]) Object.extend(methods, T[tagName]);
-
-  for (var property in methods) {
-    var value = methods[property];
-    if (typeof value == 'function' && !(property in element))
-      element[property] = cache.findOrStore(value);
-  }
-
-  element._extended = Prototype.emptyFunction;
-  return element;
-};
-
-Element.extend.cache = {
-  findOrStore: function(value) {
-    return this[value] = this[value] || function() {
-      return value.apply(null, [this].concat($A(arguments)));
-    }
-  }
-};
-
-Element.Methods = {
-  visible: function(element) {
-    return $(element).style.display != 'none';
-  },
-
-  toggle: function(element) {
-    element = $(element);
-    Element[Element.visible(element) ? 'hide' : 'show'](element);
-    return element;
-  },
-
-  hide: function(element) {
-    $(element).style.display = 'none';
-    return element;
-  },
-
-  show: function(element) {
-    $(element).style.display = '';
-    return element;
-  },
-
-  remove: function(element) {
-    element = $(element);
-    element.parentNode.removeChild(element);
-    return element;
-  },
-
-  update: function(element, html) {
-    html = typeof html == 'undefined' ? '' : html.toString();
-    $(element).innerHTML = html.stripScripts();
-    setTimeout(function() {html.evalScripts()}, 10);
-    return element;
-  },
-
-  replace: function(element, html) {
-    element = $(element);
-    html = typeof html == 'undefined' ? '' : html.toString();
-    if (element.outerHTML) {
-      element.outerHTML = html.stripScripts();
-    } else {
-      var range = element.ownerDocument.createRange();
-      range.selectNodeContents(element);
-      element.parentNode.replaceChild(
-        range.createContextualFragment(html.stripScripts()), element);
-    }
-    setTimeout(function() {html.evalScripts()}, 10);
-    return element;
-  },
-
-  inspect: function(element) {
-    element = $(element);
-    var result = '<' + element.tagName.toLowerCase();
-    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
-      var property = pair.first(), attribute = pair.last();
-      var value = (element[property] || '').toString();
-      if (value) result += ' ' + attribute + '=' + value.inspect(true);
-    });
-    return result + '>';
-  },
-
-  recursivelyCollect: function(element, property) {
-    element = $(element);
-    var elements = [];
-    while (element = element[property])
-      if (element.nodeType == 1)
-        elements.push(Element.extend(element));
-    return elements;
-  },
-
-  ancestors: function(element) {
-    return $(element).recursivelyCollect('parentNode');
-  },
-
-  descendants: function(element) {
-    return $A($(element).getElementsByTagName('*')).each(Element.extend);
-  },
-
-  firstDescendant: function(element) {
-    element = $(element).firstChild;
-    while (element && element.nodeType != 1) element = element.nextSibling;
-    return $(element);
-  },
-
-  immediateDescendants: function(element) {
-    if (!(element = $(element).firstChild)) return [];
-    while (element && element.nodeType != 1) element = element.nextSibling;
-    if (element) return [element].concat($(element).nextSiblings());
-    return [];
-  },
-
-  previousSiblings: function(element) {
-    return $(element).recursivelyCollect('previousSibling');
-  },
-
-  nextSiblings: function(element) {
-    return $(element).recursivelyCollect('nextSibling');
-  },
-
-  siblings: function(element) {
-    element = $(element);
-    return element.previousSiblings().reverse().concat(element.nextSiblings());
-  },
-
-  match: function(element, selector) {
-    if (typeof selector == 'string')
-      selector = new Selector(selector);
-    return selector.match($(element));
-  },
-
-  up: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(element.parentNode);
-    var ancestors = element.ancestors();
-    return expression ? Selector.findElement(ancestors, expression, index) :
-      ancestors[index || 0];
-  },
-
-  down: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return element.firstDescendant();
-    var descendants = element.descendants();
-    return expression ? Selector.findElement(descendants, expression, index) :
-      descendants[index || 0];
-  },
-
-  previous: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
-    var previousSiblings = element.previousSiblings();
-    return expression ? Selector.findElement(previousSiblings, expression, index) :
-      previousSiblings[index || 0];
-  },
-
-  next: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
-    var nextSiblings = element.nextSiblings();
-    return expression ? Selector.findElement(nextSiblings, expression, index) :
-      nextSiblings[index || 0];
-  },
-
-  getElementsBySelector: function() {
-    var args = $A(arguments), element = $(args.shift());
-    return Selector.findChildElements(element, args);
-  },
-
-  getElementsByClassName: function(element, className) {
-    return document.getElementsByClassName(className, element);
-  },
-
-  readAttribute: function(element, name) {
-    element = $(element);
-    if (Prototype.Browser.IE) {
-      if (!element.attributes) return null;
-      var t = Element._attributeTranslations;
-      if (t.values[name]) return t.values[name](element, name);
-      if (t.names[name])  name = t.names[name];
-      var attribute = element.attributes[name];
-      return attribute ? attribute.nodeValue : null;
-    }
-    return element.getAttribute(name);
-  },
-
-  getHeight: function(element) {
-    return $(element).getDimensions().height;
-  },
-
-  getWidth: function(element) {
-    return $(element).getDimensions().width;
-  },
-
-  classNames: function(element) {
-    return new Element.ClassNames(element);
-  },
-
-  hasClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    var elementClassName = element.className;
-    if (elementClassName.length == 0) return false;
-    if (elementClassName == className ||
-        elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
-      return true;
-    return false;
-  },
-
-  addClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    Element.classNames(element).add(className);
-    return element;
-  },
-
-  removeClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    Element.classNames(element).remove(className);
-    return element;
-  },
-
-  toggleClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
-    return element;
-  },
-
-  observe: function() {
-    Event.observe.apply(Event, arguments);
-    return $A(arguments).first();
-  },
-
-  stopObserving: function() {
-    Event.stopObserving.apply(Event, arguments);
-    return $A(arguments).first();
-  },
-
-  // removes whitespace-only text node children
-  cleanWhitespace: function(element) {
-    element = $(element);
-    var node = element.firstChild;
-    while (node) {
-      var nextNode = node.nextSibling;
-      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
-        element.removeChild(node);
-      node = nextNode;
-    }
-    return element;
-  },
-
-  empty: function(element) {
-    return $(element).innerHTML.blank();
-  },
-
-  descendantOf: function(element, ancestor) {
-    element = $(element), ancestor = $(ancestor);
-    while (element = element.parentNode)
-      if (element == ancestor) return true;
-    return false;
-  },
-
-  scrollTo: function(element) {
-    element = $(element);
-    var pos = Position.cumulativeOffset(element);
-    window.scrollTo(pos[0], pos[1]);
-    return element;
-  },
-
-  getStyle: function(element, style) {
-    element = $(element);
-    style = style == 'float' ? 'cssFloat' : style.camelize();
-    var value = element.style[style];
-    if (!value) {
-      var css = document.defaultView.getComputedStyle(element, null);
-      value = css ? css[style] : null;
-    }
-    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
-    return value == 'auto' ? null : value;
-  },
-
-  getOpacity: function(element) {
-    return $(element).getStyle('opacity');
-  },
-
-  setStyle: function(element, styles, camelized) {
-    element = $(element);
-    var elementStyle = element.style;
-
-    for (var property in styles)
-      if (property == 'opacity') element.setOpacity(styles[property])
-      else
-        elementStyle[(property == 'float' || property == 'cssFloat') ?
-          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
-          (camelized ? property : property.camelize())] = styles[property];
-
-    return element;
-  },
-
-  setOpacity: function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1 || value === '') ? '' :
-      (value < 0.00001) ? 0 : value;
-    return element;
-  },
-
-  getDimensions: function(element) {
-    element = $(element);
-    var display = $(element).getStyle('display');
-    if (display != 'none' && display != null) // Safari bug
-      return {width: element.offsetWidth, height: element.offsetHeight};
-
-    // All *Width and *Height properties give 0 on elements with display none,
-    // so enable the element temporarily
-    var els = element.style;
-    var originalVisibility = els.visibility;
-    var originalPosition = els.position;
-    var originalDisplay = els.display;
-    els.visibility = 'hidden';
-    els.position = 'absolute';
-    els.display = 'block';
-    var originalWidth = element.clientWidth;
-    var originalHeight = element.clientHeight;
-    els.display = originalDisplay;
-    els.position = originalPosition;
-    els.visibility = originalVisibility;
-    return {width: originalWidth, height: originalHeight};
-  },
-
-  makePositioned: function(element) {
-    element = $(element);
-    var pos = Element.getStyle(element, 'position');
-    if (pos == 'static' || !pos) {
-      element._madePositioned = true;
-      element.style.position = 'relative';
-      // Opera returns the offset relative to the positioning context, when an
-      // element is position relative but top and left have not been defined
-      if (window.opera) {
-        element.style.top = 0;
-        element.style.left = 0;
-      }
-    }
-    return element;
-  },
-
-  undoPositioned: function(element) {
-    element = $(element);
-    if (element._madePositioned) {
-      element._madePositioned = undefined;
-      element.style.position =
-        element.style.top =
-        element.style.left =
-        element.style.bottom =
-        element.style.right = '';
-    }
-    return element;
-  },
-
-  makeClipping: function(element) {
-    element = $(element);
-    if (element._overflow) return element;
-    element._overflow = element.style.overflow || 'auto';
-    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
-      element.style.overflow = 'hidden';
-    return element;
-  },
-
-  undoClipping: function(element) {
-    element = $(element);
-    if (!element._overflow) return element;
-    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
-    element._overflow = null;
-    return element;
-  }
-};
-
-Object.extend(Element.Methods, {
-  childOf: Element.Methods.descendantOf,
-  childElements: Element.Methods.immediateDescendants
-});
-
-if (Prototype.Browser.Opera) {
-  Element.Methods._getStyle = Element.Methods.getStyle;
-  Element.Methods.getStyle = function(element, style) {
-    switch(style) {
-      case 'left':
-      case 'top':
-      case 'right':
-      case 'bottom':
-        if (Element._getStyle(element, 'position') == 'static') return null;
-      default: return Element._getStyle(element, style);
-    }
-  };
-}
-else if (Prototype.Browser.IE) {
-  Element.Methods.getStyle = function(element, style) {
-    element = $(element);
-    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
-    var value = element.style[style];
-    if (!value && element.currentStyle) value = element.currentStyle[style];
-
-    if (style == 'opacity') {
-      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
-        if (value[1]) return parseFloat(value[1]) / 100;
-      return 1.0;
-    }
-
-    if (value == 'auto') {
-      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
-        return element['offset'+style.capitalize()] + 'px';
-      return null;
-    }
-    return value;
-  };
-
-  Element.Methods.setOpacity = function(element, value) {
-    element = $(element);
-    var filter = element.getStyle('filter'), style = element.style;
-    if (value == 1 || value === '') {
-      style.filter = filter.replace(/alpha\([^\)]*\)/gi,'');
-      return element;
-    } else if (value < 0.00001) value = 0;
-    style.filter = filter.replace(/alpha\([^\)]*\)/gi, '') +
-      'alpha(opacity=' + (value * 100) + ')';
-    return element;
-  };
-
-  // IE is missing .innerHTML support for TABLE-related elements
-  Element.Methods.update = function(element, html) {
-    element = $(element);
-    html = typeof html == 'undefined' ? '' : html.toString();
-    var tagName = element.tagName.toUpperCase();
-    if (['THEAD','TBODY','TR','TD'].include(tagName)) {
-      var div = document.createElement('div');
-      switch (tagName) {
-        case 'THEAD':
-        case 'TBODY':
-          div.innerHTML = '<table><tbody>' +  html.stripScripts() + '</tbody></table>';
-          depth = 2;
-          break;
-        case 'TR':
-          div.innerHTML = '<table><tbody><tr>' +  html.stripScripts() + '</tr></tbody></table>';
-          depth = 3;
-          break;
-        case 'TD':
-          div.innerHTML = '<table><tbody><tr><td>' +  html.stripScripts() + '</td></tr></tbody></table>';
-          depth = 4;
-      }
-      $A(element.childNodes).each(function(node) { element.removeChild(node) });
-      depth.times(function() { div = div.firstChild });
-      $A(div.childNodes).each(function(node) { element.appendChild(node) });
-    } else {
-      element.innerHTML = html.stripScripts();
-    }
-    setTimeout(function() { html.evalScripts() }, 10);
-    return element;
-  }
-}
-else if (Prototype.Browser.Gecko) {
-  Element.Methods.setOpacity = function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1) ? 0.999999 :
-      (value === '') ? '' : (value < 0.00001) ? 0 : value;
-    return element;
-  };
-}
-
-Element._attributeTranslations = {
-  names: {
-    colspan:   "colSpan",
-    rowspan:   "rowSpan",
-    valign:    "vAlign",
-    datetime:  "dateTime",
-    accesskey: "accessKey",
-    tabindex:  "tabIndex",
-    enctype:   "encType",
-    maxlength: "maxLength",
-    readonly:  "readOnly",
-    longdesc:  "longDesc"
-  },
-  values: {
-    _getAttr: function(element, attribute) {
-      return element.getAttribute(attribute, 2);
-    },
-    _flag: function(element, attribute) {
-      return $(element).hasAttribute(attribute) ? attribute : null;
-    },
-    style: function(element) {
-      return element.style.cssText.toLowerCase();
-    },
-    title: function(element) {
-      var node = element.getAttributeNode('title');
-      return node.specified ? node.nodeValue : null;
-    }
-  }
-};
-
-(function() {
-  Object.extend(this, {
-    href: this._getAttr,
-    src:  this._getAttr,
-    type: this._getAttr,
-    disabled: this._flag,
-    checked:  this._flag,
-    readonly: this._flag,
-    multiple: this._flag
-  });
-}).call(Element._attributeTranslations.values);
-
-Element.Methods.Simulated = {
-  hasAttribute: function(element, attribute) {
-    var t = Element._attributeTranslations, node;
-    attribute = t.names[attribute] || attribute;
-    node = $(element).getAttributeNode(attribute);
-    return node && node.specified;
-  }
-};
-
-Element.Methods.ByTag = {};
-
-Object.extend(Element, Element.Methods);
-
-if (!Prototype.BrowserFeatures.ElementExtensions &&
- document.createElement('div').__proto__) {
-  window.HTMLElement = {};
-  window.HTMLElement.prototype = document.createElement('div').__proto__;
-  Prototype.BrowserFeatures.ElementExtensions = true;
-}
-
-Element.hasAttribute = function(element, attribute) {
-  if (element.hasAttribute) return element.hasAttribute(attribute);
-  return Element.Methods.Simulated.hasAttribute(element, attribute);
-};
-
-Element.addMethods = function(methods) {
-  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
-
-  if (!methods) {
-    Object.extend(Form, Form.Methods);
-    Object.extend(Form.Element, Form.Element.Methods);
-    Object.extend(Element.Methods.ByTag, {
-      "FORM":     Object.clone(Form.Methods),
-      "INPUT":    Object.clone(Form.Element.Methods),
-      "SELECT":   Object.clone(Form.Element.Methods),
-      "TEXTAREA": Object.clone(Form.Element.Methods)
-    });
-  }
-
-  if (arguments.length == 2) {
-    var tagName = methods;
-    methods = arguments[1];
-  }
-
-  if (!tagName) Object.extend(Element.Methods, methods || {});
-  else {
-    if (tagName.constructor == Array) tagName.each(extend);
-    else extend(tagName);
-  }
-
-  function extend(tagName) {
-    tagName = tagName.toUpperCase();
-    if (!Element.Methods.ByTag[tagName])
-      Element.Methods.ByTag[tagName] = {};
-    Object.extend(Element.Methods.ByTag[tagName], methods);
-  }
-
-  function copy(methods, destination, onlyIfAbsent) {
-    onlyIfAbsent = onlyIfAbsent || false;
-    var cache = Element.extend.cache;
-    for (var property in methods) {
-      var value = methods[property];
-      if (!onlyIfAbsent || !(property in destination))
-        destination[property] = cache.findOrStore(value);
-    }
-  }
-
-  function findDOMClass(tagName) {
-    var klass;
-    var trans = {
-      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
-      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
-      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
-      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
-      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
-      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
-      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
-      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
-      "FrameSet", "IFRAME": "IFrame"
-    };
-    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
-    if (window[klass]) return window[klass];
-    klass = 'HTML' + tagName + 'Element';
-    if (window[klass]) return window[klass];
-    klass = 'HTML' + tagName.capitalize() + 'Element';
-    if (window[klass]) return window[klass];
-
-    window[klass] = {};
-    window[klass].prototype = document.createElement(tagName).__proto__;
-    return window[klass];
-  }
-
-  if (F.ElementExtensions) {
-    copy(Element.Methods, HTMLElement.prototype);
-    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
-  }
-
-  if (F.SpecificElementExtensions) {
-    for (var tag in Element.Methods.ByTag) {
-      var klass = findDOMClass(tag);
-      if (typeof klass == "undefined") continue;
-      copy(T[tag], klass.prototype);
-    }
-  }
-
-  Object.extend(Element, Element.Methods);
-  delete Element.ByTag;
-};
-
-var Toggle = { display: Element.toggle };
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
-  this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
-  initialize: function(element, content) {
-    this.element = $(element);
-    this.content = content.stripScripts();
-
-    if (this.adjacency && this.element.insertAdjacentHTML) {
-      try {
-        this.element.insertAdjacentHTML(this.adjacency, this.content);
-      } catch (e) {
-        var tagName = this.element.tagName.toUpperCase();
-        if (['TBODY', 'TR'].include(tagName)) {
-          this.insertContent(this.contentFromAnonymousTable());
-        } else {
-          throw e;
-        }
-      }
-    } else {
-      this.range = this.element.ownerDocument.createRange();
-      if (this.initializeRange) this.initializeRange();
-      this.insertContent([this.range.createContextualFragment(this.content)]);
-    }
-
-    setTimeout(function() {content.evalScripts()}, 10);
-  },
-
-  contentFromAnonymousTable: function() {
-    var div = document.createElement('div');
-    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
-    return $A(div.childNodes[0].childNodes[0].childNodes);
-  }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
-  initializeRange: function() {
-    this.range.setStartBefore(this.element);
-  },
-
-  insertContent: function(fragments) {
-    fragments.each((function(fragment) {
-      this.element.parentNode.insertBefore(fragment, this.element);
-    }).bind(this));
-  }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
-  initializeRange: function() {
-    this.range.selectNodeContents(this.element);
-    this.range.collapse(true);
-  },
-
-  insertContent: function(fragments) {
-    fragments.reverse(false).each((function(fragment) {
-      this.element.insertBefore(fragment, this.element.firstChild);
-    }).bind(this));
-  }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
-  initializeRange: function() {
-    this.range.selectNodeContents(this.element);
-    this.range.collapse(this.element);
-  },
-
-  insertContent: function(fragments) {
-    fragments.each((function(fragment) {
-      this.element.appendChild(fragment);
-    }).bind(this));
-  }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
-  initializeRange: function() {
-    this.range.setStartAfter(this.element);
-  },
-
-  insertContent: function(fragments) {
-    fragments.each((function(fragment) {
-      this.element.parentNode.insertBefore(fragment,
-        this.element.nextSibling);
-    }).bind(this));
-  }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
-  initialize: function(element) {
-    this.element = $(element);
-  },
-
-  _each: function(iterator) {
-    this.element.className.split(/\s+/).select(function(name) {
-      return name.length > 0;
-    })._each(iterator);
-  },
-
-  set: function(className) {
-    this.element.className = className;
-  },
-
-  add: function(classNameToAdd) {
-    if (this.include(classNameToAdd)) return;
-    this.set($A(this).concat(classNameToAdd).join(' '));
-  },
-
-  remove: function(classNameToRemove) {
-    if (!this.include(classNameToRemove)) return;
-    this.set($A(this).without(classNameToRemove).join(' '));
-  },
-
-  toString: function() {
-    return $A(this).join(' ');
-  }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
- * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
- * license.  Please see http://www.yui-ext.com/ for more information. */
-
-var Selector = Class.create();
-
-Selector.prototype = {
-  initialize: function(expression) {
-    this.expression = expression.strip();
-    this.compileMatcher();
-  },
-
-  compileMatcher: function() {
-    // Selectors with namespaced attributes can't use the XPath version
-    if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression))
-      return this.compileXPathMatcher();
-
-    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
-        c = Selector.criteria, le, p, m;
-
-    if (Selector._cache[e]) {
-      this.matcher = Selector._cache[e]; return;
-    }
-    this.matcher = ["this.matcher = function(root) {",
-                    "var r = root, h = Selector.handlers, c = false, n;"];
-
-    while (e && le != e && (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        p = ps[i];
-        if (m = e.match(p)) {
-          this.matcher.push(typeof c[i] == 'function' ? c[i](m) :
-    	      new Template(c[i]).evaluate(m));
-          e = e.replace(m[0], '');
-          break;
-        }
-      }
-    }
-
-    this.matcher.push("return h.unique(n);\n}");
-    eval(this.matcher.join('\n'));
-    Selector._cache[this.expression] = this.matcher;
-  },
-
-  compileXPathMatcher: function() {
-    var e = this.expression, ps = Selector.patterns,
-        x = Selector.xpath, le,  m;
-
-    if (Selector._cache[e]) {
-      this.xpath = Selector._cache[e]; return;
-    }
-
-    this.matcher = ['.//*'];
-    while (e && le != e && (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        if (m = e.match(ps[i])) {
-          this.matcher.push(typeof x[i] == 'function' ? x[i](m) :
-            new Template(x[i]).evaluate(m));
-          e = e.replace(m[0], '');
-          break;
-        }
-      }
-    }
-
-    this.xpath = this.matcher.join('');
-    Selector._cache[this.expression] = this.xpath;
-  },
-
-  findElements: function(root) {
-    root = root || document;
-    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
-    return this.matcher(root);
-  },
-
-  match: function(element) {
-    return this.findElements(document).include(element);
-  },
-
-  toString: function() {
-    return this.expression;
-  },
-
-  inspect: function() {
-    return "#<Selector:" + this.expression.inspect() + ">";
-  }
-};
-
-Object.extend(Selector, {
-  _cache: {},
-
-  xpath: {
-    descendant:   "//*",
-    child:        "/*",
-    adjacent:     "/following-sibling::*[1]",
-    laterSibling: '/following-sibling::*',
-    tagName:      function(m) {
-      if (m[1] == '*') return '';
-      return "[local-name()='" + m[1].toLowerCase() +
-             "' or local-name()='" + m[1].toUpperCase() + "']";
-    },
-    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
-    id:           "[@id='#{1}']",
-    attrPresence: "[@#{1}]",
-    attr: function(m) {
-      m[3] = m[5] || m[6];
-      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
-    },
-    pseudo: function(m) {
-      var h = Selector.xpath.pseudos[m[1]];
-      if (!h) return '';
-      if (typeof h === 'function') return h(m);
-      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
-    },
-    operators: {
-      '=':  "[@#{1}='#{3}']",
-      '!=': "[@#{1}!='#{3}']",
-      '^=': "[starts-with(@#{1}, '#{3}')]",
-      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
-      '*=': "[contains(@#{1}, '#{3}')]",
-      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
-      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
-    },
-    pseudos: {
-      'first-child': '[not(preceding-sibling::*)]',
-      'last-child':  '[not(following-sibling::*)]',
-      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
-      'empty':       "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
-      'checked':     "[@checked]",
-      'disabled':    "[@disabled]",
-      'enabled':     "[not(@disabled)]",
-      'not': function(m) {
-        var e = m[6], p = Selector.patterns,
-            x = Selector.xpath, le, m, v;
-
-        var exclusion = [];
-        while (e && le != e && (/\S/).test(e)) {
-          le = e;
-          for (var i in p) {
-            if (m = e.match(p[i])) {
-              v = typeof x[i] == 'function' ? x[i](m) : new Template(x[i]).evaluate(m);
-              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
-              e = e.replace(m[0], '');
-              break;
-            }
-          }
-        }
-        return "[not(" + exclusion.join(" and ") + ")]";
-      },
-      'nth-child':      function(m) {
-        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
-      },
-      'nth-last-child': function(m) {
-        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
-      },
-      'nth-of-type':    function(m) {
-        return Selector.xpath.pseudos.nth("position() ", m);
-      },
-      'nth-last-of-type': function(m) {
-        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
-      },
-      'first-of-type':  function(m) {
-        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
-      },
-      'last-of-type':   function(m) {
-        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
-      },
-      'only-of-type':   function(m) {
-        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
-      },
-      nth: function(fragment, m) {
-        var mm, formula = m[6], predicate;
-        if (formula == 'even') formula = '2n+0';
-        if (formula == 'odd')  formula = '2n+1';
-        if (mm = formula.match(/^(\d+)$/)) // digit only
-          return '[' + fragment + "= " + mm[1] + ']';
-        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
-          if (mm[1] == "-") mm[1] = -1;
-          var a = mm[1] ? Number(mm[1]) : 1;
-          var b = mm[2] ? Number(mm[2]) : 0;
-          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
-          "((#{fragment} - #{b}) div #{a} >= 0)]";
-          return new Template(predicate).evaluate({
-            fragment: fragment, a: a, b: b });
-        }
-      }
-    }
-  },
-
-  criteria: {
-    tagName:      'n = h.tagName(n, r, "#{1}", c);   c = false;',
-    className:    'n = h.className(n, r, "#{1}", c); c = false;',
-    id:           'n = h.id(n, r, "#{1}", c);        c = false;',
-    attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
-    attr: function(m) {
-      m[3] = (m[5] || m[6]);
-      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
-    },
-    pseudo:       function(m) {
-      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
-      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
-    },
-    descendant:   'c = "descendant";',
-    child:        'c = "child";',
-    adjacent:     'c = "adjacent";',
-    laterSibling: 'c = "laterSibling";'
-  },
-
-  patterns: {
-    // combinators must be listed first
-    // (and descendant needs to be last combinator)
-    laterSibling: /^\s*~\s*/,
-    child:        /^\s*>\s*/,
-    adjacent:     /^\s*\+\s*/,
-    descendant:   /^\s/,
-
-    // selectors follow
-    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
-    id:           /^#([\w\-\*]+)(\b|$)/,
-    className:    /^\.([\w\-\*]+)(\b|$)/,
-    pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/,
-    attrPresence: /^\[([\w]+)\]/,
-    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/
-  },
-
-  handlers: {
-    // UTILITY FUNCTIONS
-    // joins two collections
-    concat: function(a, b) {
-      for (var i = 0, node; node = b[i]; i++)
-        a.push(node);
-      return a;
-    },
-
-    // marks an array of nodes for counting
-    mark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = true;
-      return nodes;
-    },
-
-    unmark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = undefined;
-      return nodes;
-    },
-
-    // mark each child node with its position (for nth calls)
-    // "ofType" flag indicates whether we're indexing for nth-of-type
-    // rather than nth-child
-    index: function(parentNode, reverse, ofType) {
-      parentNode._counted = true;
-      if (reverse) {
-        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
-          node = nodes[i];
-          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
-        }
-      } else {
-        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
-          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
-      }
-    },
-
-    // filters out duplicates and extends all nodes
-    unique: function(nodes) {
-      if (nodes.length == 0) return nodes;
-      var results = [], n;
-      for (var i = 0, l = nodes.length; i < l; i++)
-        if (!(n = nodes[i])._counted) {
-          n._counted = true;
-          results.push(Element.extend(n));
-        }
-      return Selector.handlers.unmark(results);
-    },
-
-    // COMBINATOR FUNCTIONS
-    descendant: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        h.concat(results, node.getElementsByTagName('*'));
-      return results;
-    },
-
-    child: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
-          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
-      }
-      return results;
-    },
-
-    adjacent: function(nodes) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        var next = this.nextElementSibling(node);
-        if (next) results.push(next);
-      }
-      return results;
-    },
-
-    laterSibling: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        h.concat(results, Element.nextSiblings(node));
-      return results;
-    },
-
-    nextElementSibling: function(node) {
-      while (node = node.nextSibling)
-	      if (node.nodeType == 1) return node;
-      return null;
-    },
-
-    previousElementSibling: function(node) {
-      while (node = node.previousSibling)
-        if (node.nodeType == 1) return node;
-      return null;
-    },
-
-    // TOKEN FUNCTIONS
-    tagName: function(nodes, root, tagName, combinator) {
-      tagName = tagName.toUpperCase();
-      var results = [], h = Selector.handlers;
-      if (nodes) {
-        if (combinator) {
-          // fastlane for ordinary descendant combinators
-          if (combinator == "descendant") {
-            for (var i = 0, node; node = nodes[i]; i++)
-              h.concat(results, node.getElementsByTagName(tagName));
-            return results;
-          } else nodes = this[combinator](nodes);
-          if (tagName == "*") return nodes;
-        }
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node.tagName.toUpperCase() == tagName) results.push(node);
-        return results;
-      } else return root.getElementsByTagName(tagName);
-    },
-
-    id: function(nodes, root, id, combinator) {
-      var targetNode = $(id), h = Selector.handlers;
-      if (!nodes && root == document) return targetNode ? [targetNode] : [];
-      if (nodes) {
-        if (combinator) {
-          if (combinator == 'child') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (targetNode.parentNode == node) return [targetNode];
-          } else if (combinator == 'descendant') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (Element.descendantOf(targetNode, node)) return [targetNode];
-          } else if (combinator == 'adjacent') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (Selector.handlers.previousElementSibling(targetNode) == node)
-                return [targetNode];
-          } else nodes = h[combinator](nodes);
-        }
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node == targetNode) return [targetNode];
-        return [];
-      }
-      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
-    },
-
-    className: function(nodes, root, className, combinator) {
-      if (nodes && combinator) nodes = this[combinator](nodes);
-      return Selector.handlers.byClassName(nodes, root, className);
-    },
-
-    byClassName: function(nodes, root, className) {
-      if (!nodes) nodes = Selector.handlers.descendant([root]);
-      var needle = ' ' + className + ' ';
-      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
-        nodeClassName = node.className;
-        if (nodeClassName.length == 0) continue;
-        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
-          results.push(node);
-      }
-      return results;
-    },
-
-    attrPresence: function(nodes, root, attr) {
-      var results = [];
-      for (var i = 0, node; node = nodes[i]; i++)
-        if (Element.hasAttribute(node, attr)) results.push(node);
-      return results;
-    },
-
-    attr: function(nodes, root, attr, value, operator) {
-      if (!nodes) nodes = root.getElementsByTagName("*");
-      var handler = Selector.operators[operator], results = [];
-      for (var i = 0, node; node = nodes[i]; i++) {
-        var nodeValue = Element.readAttribute(node, attr);
-        if (nodeValue === null) continue;
-        if (handler(nodeValue, value)) results.push(node);
-      }
-      return results;
-    },
-
-    pseudo: function(nodes, name, value, root, combinator) {
-      if (nodes && combinator) nodes = this[combinator](nodes);
-      if (!nodes) nodes = root.getElementsByTagName("*");
-      return Selector.pseudos[name](nodes, value, root);
-    }
-  },
-
-  pseudos: {
-    'first-child': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        if (Selector.handlers.previousElementSibling(node)) continue;
-          results.push(node);
-      }
-      return results;
-    },
-    'last-child': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        if (Selector.handlers.nextElementSibling(node)) continue;
-          results.push(node);
-      }
-      return results;
-    },
-    'only-child': function(nodes, value, root) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
-          results.push(node);
-      return results;
-    },
-    'nth-child':        function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root);
-    },
-    'nth-last-child':   function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, true);
-    },
-    'nth-of-type':      function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, false, true);
-    },
-    'nth-last-of-type': function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, true, true);
-    },
-    'first-of-type':    function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, "1", root, false, true);
-    },
-    'last-of-type':     function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, "1", root, true, true);
-    },
-    'only-of-type':     function(nodes, formula, root) {
-      var p = Selector.pseudos;
-      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
-    },
-
-    // handles the an+b logic
-    getIndices: function(a, b, total) {
-      if (a == 0) return b > 0 ? [b] : [];
-      return $R(1, total).inject([], function(memo, i) {
-        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
-        return memo;
-      });
-    },
-
-    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
-    nth: function(nodes, formula, root, reverse, ofType) {
-      if (nodes.length == 0) return [];
-      if (formula == 'even') formula = '2n+0';
-      if (formula == 'odd')  formula = '2n+1';
-      var h = Selector.handlers, results = [], indexed = [], m;
-      h.mark(nodes);
-      for (var i = 0, node; node = nodes[i]; i++) {
-        if (!node.parentNode._counted) {
-          h.index(node.parentNode, reverse, ofType);
-          indexed.push(node.parentNode);
-        }
-      }
-      if (formula.match(/^\d+$/)) { // just a number
-        formula = Number(formula);
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node.nodeIndex == formula) results.push(node);
-      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
-        if (m[1] == "-") m[1] = -1;
-        var a = m[1] ? Number(m[1]) : 1;
-        var b = m[2] ? Number(m[2]) : 0;
-        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
-        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
-          for (var j = 0; j < l; j++)
-            if (node.nodeIndex == indices[j]) results.push(node);
-        }
-      }
-      h.unmark(nodes);
-      h.unmark(indexed);
-      return results;
-    },
-
-    'empty': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        // IE treats comments as element nodes
-        if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
-        results.push(node);
-      }
-      return results;
-    },
-
-    'not': function(nodes, selector, root) {
-      var h = Selector.handlers, selectorType, m;
-      var exclusions = new Selector(selector).findElements(root);
-      h.mark(exclusions);
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node._counted) results.push(node);
-      h.unmark(exclusions);
-      return results;
-    },
-
-    'enabled': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node.disabled) results.push(node);
-      return results;
-    },
-
-    'disabled': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (node.disabled) results.push(node);
-      return results;
-    },
-
-    'checked': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (node.checked) results.push(node);
-      return results;
-    }
-  },
-
-  operators: {
-    '=':  function(nv, v) { return nv == v; },
-    '!=': function(nv, v) { return nv != v; },
-    '^=': function(nv, v) { return nv.startsWith(v); },
-    '$=': function(nv, v) { return nv.endsWith(v); },
-    '*=': function(nv, v) { return nv.include(v); },
-    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
-    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
-  },
-
-  matchElements: function(elements, expression) {
-    var matches = new Selector(expression).findElements(), h = Selector.handlers;
-    h.mark(matches);
-    for (var i = 0, results = [], element; element = elements[i]; i++)
-      if (element._counted) results.push(element);
-    h.unmark(matches);
-    return results;
-  },
-
-  findElement: function(elements, expression, index) {
-    if (typeof expression == 'number') {
-      index = expression; expression = false;
-    }
-    return Selector.matchElements(elements, expression || '*')[index || 0];
-  },
-
-  findChildElements: function(element, expressions) {
-    var exprs = expressions.join(','), expressions = [];
-    exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
-      expressions.push(m[1].strip());
-    });
-    var results = [], h = Selector.handlers;
-    for (var i = 0, l = expressions.length, selector; i < l; i++) {
-      selector = new Selector(expressions[i].strip());
-      h.concat(results, selector.findElements(element));
-    }
-    return (l > 1) ? h.unique(results) : results;
-  }
-});
-
-function $$() {
-  return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
-  reset: function(form) {
-    $(form).reset();
-    return form;
-  },
-
-  serializeElements: function(elements, getHash) {
-    var data = elements.inject({}, function(result, element) {
-      if (!element.disabled && element.name) {
-        var key = element.name, value = $(element).getValue();
-        if (value != null) {
-         	if (key in result) {
-            if (result[key].constructor != Array) result[key] = [result[key]];
-            result[key].push(value);
-          }
-          else result[key] = value;
-        }
-      }
-      return result;
-    });
-
-    return getHash ? data : Hash.toQueryString(data);
-  }
-};
-
-Form.Methods = {
-  serialize: function(form, getHash) {
-    return Form.serializeElements(Form.getElements(form), getHash);
-  },
-
-  getElements: function(form) {
-    return $A($(form).getElementsByTagName('*')).inject([],
-      function(elements, child) {
-        if (Form.Element.Serializers[child.tagName.toLowerCase()])
-          elements.push(Element.extend(child));
-        return elements;
-      }
-    );
-  },
-
-  getInputs: function(form, typeName, name) {
-    form = $(form);
-    var inputs = form.getElementsByTagName('input');
-
-    if (!typeName && !name) return $A(inputs).map(Element.extend);
-
-    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
-      var input = inputs[i];
-      if ((typeName && input.type != typeName) || (name && input.name != name))
-        continue;
-      matchingInputs.push(Element.extend(input));
-    }
-
-    return matchingInputs;
-  },
-
-  disable: function(form) {
-    form = $(form);
-    Form.getElements(form).invoke('disable');
-    return form;
-  },
-
-  enable: function(form) {
-    form = $(form);
-    Form.getElements(form).invoke('enable');
-    return form;
-  },
-
-  findFirstElement: function(form) {
-    return $(form).getElements().find(function(element) {
-      return element.type != 'hidden' && !element.disabled &&
-        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
-    });
-  },
-
-  focusFirstElement: function(form) {
-    form = $(form);
-    form.findFirstElement().activate();
-    return form;
-  },
-
-  request: function(form, options) {
-    form = $(form), options = Object.clone(options || {});
-
-    var params = options.parameters;
-    options.parameters = form.serialize(true);
-
-    if (params) {
-      if (typeof params == 'string') params = params.toQueryParams();
-      Object.extend(options.parameters, params);
-    }
-
-    if (form.hasAttribute('method') && !options.method)
-      options.method = form.method;
-
-    return new Ajax.Request(form.readAttribute('action'), options);
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
-  focus: function(element) {
-    $(element).focus();
-    return element;
-  },
-
-  select: function(element) {
-    $(element).select();
-    return element;
-  }
-}
-
-Form.Element.Methods = {
-  serialize: function(element) {
-    element = $(element);
-    if (!element.disabled && element.name) {
-      var value = element.getValue();
-      if (value != undefined) {
-        var pair = {};
-        pair[element.name] = value;
-        return Hash.toQueryString(pair);
-      }
-    }
-    return '';
-  },
-
-  getValue: function(element) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    return Form.Element.Serializers[method](element);
-  },
-
-  clear: function(element) {
-    $(element).value = '';
-    return element;
-  },
-
-  present: function(element) {
-    return $(element).value != '';
-  },
-
-  activate: function(element) {
-    element = $(element);
-    try {
-      element.focus();
-      if (element.select && (element.tagName.toLowerCase() != 'input' ||
-        !['button', 'reset', 'submit'].include(element.type)))
-        element.select();
-    } catch (e) {}
-    return element;
-  },
-
-  disable: function(element) {
-    element = $(element);
-    element.blur();
-    element.disabled = true;
-    return element;
-  },
-
-  enable: function(element) {
-    element = $(element);
-    element.disabled = false;
-    return element;
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Field = Form.Element;
-var $F = Form.Element.Methods.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
-  input: function(element) {
-    switch (element.type.toLowerCase()) {
-      case 'checkbox':
-      case 'radio':
-        return Form.Element.Serializers.inputSelector(element);
-      default:
-        return Form.Element.Serializers.textarea(element);
-    }
-  },
-
-  inputSelector: function(element) {
-    return element.checked ? element.value : null;
-  },
-
-  textarea: function(element) {
-    return element.value;
-  },
-
-  select: function(element) {
-    return this[element.type == 'select-one' ?
-      'selectOne' : 'selectMany'](element);
-  },
-
-  selectOne: function(element) {
-    var index = element.selectedIndex;
-    return index >= 0 ? this.optionValue(element.options[index]) : null;
-  },
-
-  selectMany: function(element) {
-    var values, length = element.length;
-    if (!length) return null;
-
-    for (var i = 0, values = []; i < length; i++) {
-      var opt = element.options[i];
-      if (opt.selected) values.push(this.optionValue(opt));
-    }
-    return values;
-  },
-
-  optionValue: function(opt) {
-    // extend element because hasAttribute may not be native
-    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
-  initialize: function(element, frequency, callback) {
-    this.frequency = frequency;
-    this.element   = $(element);
-    this.callback  = callback;
-
-    this.lastValue = this.getValue();
-    this.registerCallback();
-  },
-
-  registerCallback: function() {
-    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
-  },
-
-  onTimerEvent: function() {
-    var value = this.getValue();
-    var changed = ('string' == typeof this.lastValue && 'string' == typeof value
-      ? this.lastValue != value : String(this.lastValue) != String(value));
-    if (changed) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
-  initialize: function(element, callback) {
-    this.element  = $(element);
-    this.callback = callback;
-
-    this.lastValue = this.getValue();
-    if (this.element.tagName.toLowerCase() == 'form')
-      this.registerFormCallbacks();
-    else
-      this.registerCallback(this.element);
-  },
-
-  onElementEvent: function() {
-    var value = this.getValue();
-    if (this.lastValue != value) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  },
-
-  registerFormCallbacks: function() {
-    Form.getElements(this.element).each(this.registerCallback.bind(this));
-  },
-
-  registerCallback: function(element) {
-    if (element.type) {
-      switch (element.type.toLowerCase()) {
-        case 'checkbox':
-        case 'radio':
-          Event.observe(element, 'click', this.onElementEvent.bind(this));
-          break;
-        default:
-          Event.observe(element, 'change', this.onElementEvent.bind(this));
-          break;
-      }
-    }
-  }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-if (!window.Event) {
-  var Event = new Object();
-}
-
-Object.extend(Event, {
-  KEY_BACKSPACE: 8,
-  KEY_TAB:       9,
-  KEY_RETURN:   13,
-  KEY_ESC:      27,
-  KEY_LEFT:     37,
-  KEY_UP:       38,
-  KEY_RIGHT:    39,
-  KEY_DOWN:     40,
-  KEY_DELETE:   46,
-  KEY_HOME:     36,
-  KEY_END:      35,
-  KEY_PAGEUP:   33,
-  KEY_PAGEDOWN: 34,
-
-  element: function(event) {
-    return $(event.target || event.srcElement);
-  },
-
-  isLeftClick: function(event) {
-    return (((event.which) && (event.which == 1)) ||
-            ((event.button) && (event.button == 1)));
-  },
-
-  pointerX: function(event) {
-    return event.pageX || (event.clientX +
-      (document.documentElement.scrollLeft || document.body.scrollLeft));
-  },
-
-  pointerY: function(event) {
-    return event.pageY || (event.clientY +
-      (document.documentElement.scrollTop || document.body.scrollTop));
-  },
-
-  stop: function(event) {
-    if (event.preventDefault) {
-      event.preventDefault();
-      event.stopPropagation();
-    } else {
-      event.returnValue = false;
-      event.cancelBubble = true;
-    }
-  },
-
-  // find the first node with the given tagName, starting from the
-  // node the event was triggered on; traverses the DOM upwards
-  findElement: function(event, tagName) {
-    var element = Event.element(event);
-    while (element.parentNode && (!element.tagName ||
-        (element.tagName.toUpperCase() != tagName.toUpperCase())))
-      element = element.parentNode;
-    return element;
-  },
-
-  observers: false,
-
-  _observeAndCache: function(element, name, observer, useCapture) {
-    if (!this.observers) this.observers = [];
-    if (element.addEventListener) {
-      this.observers.push([element, name, observer, useCapture]);
-      element.addEventListener(name, observer, useCapture);
-    } else if (element.attachEvent) {
-      this.observers.push([element, name, observer, useCapture]);
-      element.attachEvent('on' + name, observer);
-    }
-  },
-
-  unloadCache: function() {
-    if (!Event.observers) return;
-    for (var i = 0, length = Event.observers.length; i < length; i++) {
-      Event.stopObserving.apply(this, Event.observers[i]);
-      Event.observers[i][0] = null;
-    }
-    Event.observers = false;
-  },
-
-  observe: function(element, name, observer, useCapture) {
-    element = $(element);
-    useCapture = useCapture || false;
-
-    if (name == 'keypress' &&
-      (Prototype.Browser.WebKit || element.attachEvent))
-      name = 'keydown';
-
-    Event._observeAndCache(element, name, observer, useCapture);
-  },
-
-  stopObserving: function(element, name, observer, useCapture) {
-    element = $(element);
-    useCapture = useCapture || false;
-
-    if (name == 'keypress' &&
-        (Prototype.Browser.WebKit || element.attachEvent))
-      name = 'keydown';
-
-    if (element.removeEventListener) {
-      element.removeEventListener(name, observer, useCapture);
-    } else if (element.detachEvent) {
-      try {
-        element.detachEvent('on' + name, observer);
-      } catch (e) {}
-    }
-  }
-});
-
-/* prevent memory leaks in IE */
-if (Prototype.Browser.IE)
-  Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
-  // set to true if needed, warning: firefox performance problems
-  // NOT neeeded for page scrolling, only if draggable contained in
-  // scrollable elements
-  includeScrollOffsets: false,
-
-  // must be called before calling withinIncludingScrolloffset, every time the
-  // page is scrolled
-  prepare: function() {
-    this.deltaX =  window.pageXOffset
-                || document.documentElement.scrollLeft
-                || document.body.scrollLeft
-                || 0;
-    this.deltaY =  window.pageYOffset
-                || document.documentElement.scrollTop
-                || document.body.scrollTop
-                || 0;
-  },
-
-  realOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.scrollTop  || 0;
-      valueL += element.scrollLeft || 0;
-      element = element.parentNode;
-    } while (element);
-    return [valueL, valueT];
-  },
-
-  cumulativeOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-    } while (element);
-    return [valueL, valueT];
-  },
-
-  positionedOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-      if (element) {
-        if(element.tagName=='BODY') break;
-        var p = Element.getStyle(element, 'position');
-        if (p == 'relative' || p == 'absolute') break;
-      }
-    } while (element);
-    return [valueL, valueT];
-  },
-
-  offsetParent: function(element) {
-    if (element.offsetParent) return element.offsetParent;
-    if (element == document.body) return element;
-
-    while ((element = element.parentNode) && element != document.body)
-      if (Element.getStyle(element, 'position') != 'static')
-        return element;
-
-    return document.body;
-  },
-
-  // caches x/y coordinate pair to use with overlap
-  within: function(element, x, y) {
-    if (this.includeScrollOffsets)
-      return this.withinIncludingScrolloffsets(element, x, y);
-    this.xcomp = x;
-    this.ycomp = y;
-    this.offset = this.cumulativeOffset(element);
-
-    return (y >= this.offset[1] &&
-            y <  this.offset[1] + element.offsetHeight &&
-            x >= this.offset[0] &&
-            x <  this.offset[0] + element.offsetWidth);
-  },
-
-  withinIncludingScrolloffsets: function(element, x, y) {
-    var offsetcache = this.realOffset(element);
-
-    this.xcomp = x + offsetcache[0] - this.deltaX;
-    this.ycomp = y + offsetcache[1] - this.deltaY;
-    this.offset = this.cumulativeOffset(element);
-
-    return (this.ycomp >= this.offset[1] &&
-            this.ycomp <  this.offset[1] + element.offsetHeight &&
-            this.xcomp >= this.offset[0] &&
-            this.xcomp <  this.offset[0] + element.offsetWidth);
-  },
-
-  // within must be called directly before
-  overlap: function(mode, element) {
-    if (!mode) return 0;
-    if (mode == 'vertical')
-      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
-        element.offsetHeight;
-    if (mode == 'horizontal')
-      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
-        element.offsetWidth;
-  },
-
-  page: function(forElement) {
-    var valueT = 0, valueL = 0;
-
-    var element = forElement;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-
-      // Safari fix
-      if (element.offsetParent == document.body)
-        if (Element.getStyle(element,'position')=='absolute') break;
-
-    } while (element = element.offsetParent);
-
-    element = forElement;
-    do {
-      if (!window.opera || element.tagName=='BODY') {
-        valueT -= element.scrollTop  || 0;
-        valueL -= element.scrollLeft || 0;
-      }
-    } while (element = element.parentNode);
-
-    return [valueL, valueT];
-  },
-
-  clone: function(source, target) {
-    var options = Object.extend({
-      setLeft:    true,
-      setTop:     true,
-      setWidth:   true,
-      setHeight:  true,
-      offsetTop:  0,
-      offsetLeft: 0
-    }, arguments[2] || {})
-
-    // find page position of source
-    source = $(source);
-    var p = Position.page(source);
-
-    // find coordinate system to use
-    target = $(target);
-    var delta = [0, 0];
-    var parent = null;
-    // delta [0,0] will do fine with position: fixed elements,
-    // position:absolute needs offsetParent deltas
-    if (Element.getStyle(target,'position') == 'absolute') {
-      parent = Position.offsetParent(target);
-      delta = Position.page(parent);
-    }
-
-    // correct by body offsets (fixes Safari)
-    if (parent == document.body) {
-      delta[0] -= document.body.offsetLeft;
-      delta[1] -= document.body.offsetTop;
-    }
-
-    // set position
-    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
-    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
-    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
-    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
-  },
-
-  absolutize: function(element) {
-    element = $(element);
-    if (element.style.position == 'absolute') return;
-    Position.prepare();
-
-    var offsets = Position.positionedOffset(element);
-    var top     = offsets[1];
-    var left    = offsets[0];
-    var width   = element.clientWidth;
-    var height  = element.clientHeight;
-
-    element._originalLeft   = left - parseFloat(element.style.left  || 0);
-    element._originalTop    = top  - parseFloat(element.style.top || 0);
-    element._originalWidth  = element.style.width;
-    element._originalHeight = element.style.height;
-
-    element.style.position = 'absolute';
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.width  = width + 'px';
-    element.style.height = height + 'px';
-  },
-
-  relativize: function(element) {
-    element = $(element);
-    if (element.style.position == 'relative') return;
-    Position.prepare();
-
-    element.style.position = 'relative';
-    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
-    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.height = element._originalHeight;
-    element.style.width  = element._originalWidth;
-  }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned.  For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (Prototype.Browser.WebKit) {
-  Position.cumulativeOffset = function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      if (element.offsetParent == document.body)
-        if (Element.getStyle(element, 'position') == 'absolute') break;
-
-      element = element.offsetParent;
-    } while (element);
-
-    return [valueL, valueT];
-  }
-}
-
-Element.addMethods();
\ No newline at end of file
diff --git a/downloader/lib/Magento/Framework/Archive.php b/downloader/lib/Magento/Framework/Archive.php
deleted file mode 100644
index b6de49dca171414d7735464d60c56a4e993d2bf1..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive.php
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework;
-
-/**
- * Class to work with archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Archive
-{
-    /**
-     * Archiver is used for compress.
-     */
-    const DEFAULT_ARCHIVER = 'gz';
-
-    /**
-     * Default packer for directory.
-     */
-    const TAPE_ARCHIVER = 'tar';
-
-    /**
-     * Current archiver is used for compress.
-     *
-     * @var \Magento\Framework\Archive\Tar|\Magento\Framework\Archive\Gz|\Magento\Framework\Archive\Bz
-     */
-    protected $_archiver = null;
-
-    /**
-     * Accessible formats for compress.
-     *
-     * @var array
-     */
-    protected $_formats = array(
-        'tar' => 'tar',
-        'gz' => 'gz',
-        'gzip' => 'gz',
-        'tgz' => 'tar.gz',
-        'tgzip' => 'tar.gz',
-        'bz' => 'bz',
-        'bzip' => 'bz',
-        'bzip2' => 'bz',
-        'bz2' => 'bz',
-        'tbz' => 'tar.bz',
-        'tbzip' => 'tar.bz',
-        'tbz2' => 'tar.bz',
-        'tbzip2' => 'tar.bz'
-    );
-
-    /**
-     * Create object of current archiver by $extension.
-     *
-     * @param string $extension
-     * @return \Magento\Framework\Archive\Tar|\Magento\Framework\Archive\Gz|\Magento\Framework\Archive\Bz
-     */
-    protected function _getArchiver($extension)
-    {
-        if (array_key_exists(strtolower($extension), $this->_formats)) {
-            $format = $this->_formats[$extension];
-        } else {
-            $format = self::DEFAULT_ARCHIVER;
-        }
-        $class = 'Magento\Framework\Archive\\' . ucfirst($format);
-        $this->_archiver = new $class();
-        return $this->_archiver;
-    }
-
-    /**
-     * Split current format to list of archivers.
-     *
-     * @param string $source
-     * @return array
-     */
-    protected function _getArchivers($source)
-    {
-        $ext = pathinfo($source, PATHINFO_EXTENSION);
-        if (!isset($this->_formats[$ext])) {
-            return array();
-        }
-        $format = $this->_formats[$ext];
-        if ($format) {
-            $archivers = explode('.', $format);
-            return $archivers;
-        }
-        return array();
-    }
-
-    /**
-     * Pack file or directory to archivers are parsed from extension.
-     *
-     * @param string $source
-     * @param string $destination
-     * @param bool $skipRoot skip first level parent
-     * @return string Path to file
-     */
-    public function pack($source, $destination = 'packed.tgz', $skipRoot = false)
-    {
-        $archivers = $this->_getArchivers($destination);
-        $interimSource = '';
-        for ($i = 0; $i < count($archivers); $i++) {
-            if ($i == count($archivers) - 1) {
-                $packed = $destination;
-            } else {
-                $packed = dirname($destination) . '/~tmp-' . microtime(true) . $archivers[$i] . '.' . $archivers[$i];
-            }
-            $source = $this->_getArchiver($archivers[$i])->pack($source, $packed, $skipRoot);
-            if ($interimSource && $i < count($archivers)) {
-                unlink($interimSource);
-            }
-            $interimSource = $source;
-        }
-        return $source;
-    }
-
-    /**
-     * Unpack file from archivers are parsed from extension.
-     * If $tillTar == true unpack file from archivers till
-     * meet TAR archiver.
-     *
-     * @param string $source
-     * @param string $destination
-     * @param bool $tillTar
-     * @param bool $clearInterm
-     * @return string Path to file
-     */
-    public function unpack($source, $destination = '.', $tillTar = false, $clearInterm = true)
-    {
-        $archivers = $this->_getArchivers($source);
-        $interimSource = '';
-        for ($i = count($archivers) - 1; $i >= 0; $i--) {
-            if ($tillTar && $archivers[$i] == self::TAPE_ARCHIVER) {
-                break;
-            }
-            if ($i == 0) {
-                $packed = rtrim($destination, '/') . '/';
-            } else {
-                $packed = rtrim(
-                    $destination,
-                    '/'
-                ) . '/~tmp-' . microtime(
-                    true
-                ) . $archivers[$i - 1] . '.' . $archivers[$i - 1];
-            }
-            $source = $this->_getArchiver($archivers[$i])->unpack($source, $packed);
-
-            //var_dump($packed, $source);
-
-            if ($clearInterm && $interimSource && $i >= 0) {
-                unlink($interimSource);
-            }
-            $interimSource = $source;
-        }
-        return $source;
-    }
-
-    /**
-     * Extract one file from TAR (Tape Archiver).
-     *
-     * @param string $file
-     * @param string $source
-     * @param string $destination
-     * @return string Path to file
-     */
-    public function extract($file, $source, $destination = '.')
-    {
-        $tarFile = $this->unpack($source, $destination, true);
-        $resFile = $this->_getArchiver(self::TAPE_ARCHIVER)->extract($file, $tarFile, $destination);
-        if (!$this->isTar($source)) {
-            unlink($tarFile);
-        }
-        return $resFile;
-    }
-
-    /**
-     * Check file is archive.
-     *
-     * @param string $file
-     * @return bool
-     */
-    public function isArchive($file)
-    {
-        $archivers = $this->_getArchivers($file);
-        if (count($archivers)) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Check file is TAR.
-     *
-     * @param mixed $file
-     * @return bool
-     */
-    public function isTar($file)
-    {
-        $archivers = $this->_getArchivers($file);
-        if (count($archivers) == 1 && $archivers[0] == self::TAPE_ARCHIVER) {
-            return true;
-        }
-        return false;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/AbstractArchive.php b/downloader/lib/Magento/Framework/Archive/AbstractArchive.php
deleted file mode 100644
index 8b0d26d6aca55655b209f565e17f4e710a05662d..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/AbstractArchive.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to work with archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Archive;
-
-class AbstractArchive
-{
-    /**
-     * Write data to file. If file can't be opened - throw exception
-     *
-     * @param string $destination
-     * @param string $data
-     * @return boolean
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _writeFile($destination, $data)
-    {
-        $destination = trim($destination);
-        if (false === file_put_contents($destination, $data)) {
-            throw new \Magento\Framework\Exception("Can't write to file: " . $destination);
-        }
-        return true;
-    }
-
-    /**
-     * Read data from file. If file can't be opened, throw to exception.
-     *
-     * @param string $source
-     * @return string
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _readFile($source)
-    {
-        $data = '';
-        if (is_file($source) && is_readable($source)) {
-            $data = @file_get_contents($source);
-            if ($data === false) {
-                throw new \Magento\Framework\Exception("Can't get contents from: " . $source);
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * Get file name from source (URI) without last extension.
-     *
-     * @param string $source
-     * @param bool $withExtension
-     * @return mixed|string
-     */
-    public function getFilename($source, $withExtension = false)
-    {
-        $file = str_replace(dirname($source) . '/', '', $source);
-        if (!$withExtension) {
-            $file = substr($file, 0, strrpos($file, '.'));
-        }
-        return $file;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/Bz.php b/downloader/lib/Magento/Framework/Archive/Bz.php
deleted file mode 100644
index 894eea72d9655325771c6a4245ba1b73aa2c2f5f..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/Bz.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to work with bzip2 archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Archive;
-
-class Bz extends \Magento\Framework\Archive\AbstractArchive implements \Magento\Framework\Archive\ArchiveInterface
-{
-    /**
-     * Pack file by BZIP2 compressor.
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
-     */
-    public function pack($source, $destination)
-    {
-        $fileReader = new \Magento\Framework\Archive\Helper\File($source);
-        $fileReader->open('r');
-
-        $archiveWriter = new \Magento\Framework\Archive\Helper\File\Bz($destination);
-        $archiveWriter->open('w');
-
-        while (!$fileReader->eof()) {
-            $archiveWriter->write($fileReader->read());
-        }
-
-        $fileReader->close();
-        $archiveWriter->close();
-
-        return $destination;
-    }
-
-    /**
-     * Unpack file by BZIP2 compressor.
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
-     */
-    public function unpack($source, $destination)
-    {
-        if (is_dir($destination)) {
-            $file = $this->getFilename($source);
-            $destination = $destination . $file;
-        }
-
-        $archiveReader = new \Magento\Framework\Archive\Helper\File\Bz($source);
-        $archiveReader->open('r');
-
-        $fileWriter = new \Magento\Framework\Archive\Helper\File($destination);
-        $fileWriter->open('w');
-
-        while (!$archiveReader->eof()) {
-            $fileWriter->write($archiveReader->read());
-        }
-
-        return $destination;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/Gz.php b/downloader/lib/Magento/Framework/Archive/Gz.php
deleted file mode 100644
index 78a41d7f598db9e7cc6b1af7f884057d77948a80..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/Gz.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to work with gz archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Archive;
-
-class Gz extends \Magento\Framework\Archive\AbstractArchive implements \Magento\Framework\Archive\ArchiveInterface
-{
-    /**
-     * Pack file by GZ compressor.
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
-     */
-    public function pack($source, $destination)
-    {
-        $fileReader = new \Magento\Framework\Archive\Helper\File($source);
-        $fileReader->open('r');
-
-        $archiveWriter = new \Magento\Framework\Archive\Helper\File\Gz($destination);
-        $archiveWriter->open('wb9');
-
-        while (!$fileReader->eof()) {
-            $archiveWriter->write($fileReader->read());
-        }
-
-        $fileReader->close();
-        $archiveWriter->close();
-
-        return $destination;
-    }
-
-    /**
-     * Unpack file by GZ compressor.
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
-     */
-    public function unpack($source, $destination)
-    {
-        if (is_dir($destination)) {
-            $file = $this->getFilename($source);
-            $destination = $destination . $file;
-        }
-
-        $archiveReader = new \Magento\Framework\Archive\Helper\File\Gz($source);
-        $archiveReader->open('r');
-
-        $fileWriter = new \Magento\Framework\Archive\Helper\File($destination);
-        $fileWriter->open('w');
-
-        while (!$archiveReader->eof()) {
-            $fileWriter->write($archiveReader->read());
-        }
-
-        return $destination;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/Helper/File.php b/downloader/lib/Magento/Framework/Archive/Helper/File.php
deleted file mode 100644
index 86ba32ffb4b2d72aae410fcb1ac74f1a6b81d750..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/Helper/File.php
+++ /dev/null
@@ -1,286 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Archive\Helper;
-
-/**
-* Helper class that simplifies files stream reading and writing
-*
-* @author      Magento Core Team <core@magentocommerce.com>
-*/
-class File
-{
-    /**
-     * Full path to directory where file located
-     *
-     * @var string
-     */
-    protected $_fileLocation;
-
-    /**
-     * File name
-     *
-     * @var string
-     */
-    protected $_fileName;
-
-    /**
-     * Full path (directory + filename) to file
-     *
-     * @var string
-     */
-    protected $_filePath;
-
-    /**
-     * File permissions that will be set if file opened in write mode
-     *
-     * @var int
-     */
-    protected $_chmod;
-
-    /**
-     * File handler
-     *
-     * @var pointer
-     */
-    protected $_fileHandler;
-
-    /**
-     * Set file path via constructor
-     *
-     * @param string $filePath
-     */
-    public function __construct($filePath)
-    {
-        $pathInfo = pathinfo($filePath);
-
-        $this->_filePath = $filePath;
-        $this->_fileLocation = isset($pathInfo['dirname']) ? $pathInfo['dirname'] : '';
-        $this->_fileName = isset($pathInfo['basename']) ? $pathInfo['basename'] : '';
-    }
-
-    /**
-     * Close file if it's not closed before object destruction
-     */
-    public function __destruct()
-    {
-        if ($this->_fileHandler) {
-            $this->_close();
-        }
-    }
-
-    /**
-     * Open file
-     *
-     * @param string $mode
-     * @param int $chmod
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    public function open($mode = 'w+', $chmod = 0666)
-    {
-        if ($this->_isWritableMode($mode)) {
-            if (!is_writable($this->_fileLocation)) {
-                throw new \Magento\Framework\Exception('Permission denied to write to ' . $this->_fileLocation);
-            }
-
-            if (is_file($this->_filePath) && !is_writable($this->_filePath)) {
-                throw new \Magento\Framework\Exception(
-                    "Can't open file " . $this->_fileName . " for writing. Permission denied."
-                );
-            }
-        }
-
-        if ($this->_isReadableMode($mode) && (!is_file($this->_filePath) || !is_readable($this->_filePath))) {
-            if (!is_file($this->_filePath)) {
-                throw new \Magento\Framework\Exception('File ' . $this->_filePath . ' does not exist');
-            }
-
-            if (!is_readable($this->_filePath)) {
-                throw new \Magento\Framework\Exception('Permission denied to read file ' . $this->_filePath);
-            }
-        }
-
-        $this->_open($mode);
-
-        $this->_chmod = $chmod;
-    }
-
-    /**
-     * Write data to file
-     *
-     * @param string $data
-     * @return void
-     */
-    public function write($data)
-    {
-        $this->_checkFileOpened();
-        $this->_write($data);
-    }
-
-    /**
-     * Read data from file
-     *
-     * @param int $length
-     * @return string|bool
-     */
-    public function read($length = 4096)
-    {
-        $data = false;
-        $this->_checkFileOpened();
-        if ($length > 0) {
-            $data = $this->_read($length);
-        }
-
-        return $data;
-    }
-
-    /**
-     * Check whether end of file reached
-     *
-     * @return bool
-     */
-    public function eof()
-    {
-        $this->_checkFileOpened();
-        return $this->_eof();
-    }
-
-    /**
-     * Close file
-     *
-     * @return void
-     */
-    public function close()
-    {
-        $this->_checkFileOpened();
-        $this->_close();
-        $this->_fileHandler = false;
-        @chmod($this->_filePath, $this->_chmod);
-    }
-
-    /**
-     * Implementation of file opening
-     *
-     * @param string $mode
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _open($mode)
-    {
-        $this->_fileHandler = @fopen($this->_filePath, $mode);
-
-        if (false === $this->_fileHandler) {
-            throw new \Magento\Framework\Exception('Failed to open file ' . $this->_filePath);
-        }
-    }
-
-    /**
-     * Implementation of writing data to file
-     *
-     * @param string $data
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _write($data)
-    {
-        $result = @fwrite($this->_fileHandler, $data);
-
-        if (false === $result) {
-            throw new \Magento\Framework\Exception('Failed to write data to ' . $this->_filePath);
-        }
-    }
-
-    /**
-     * Implementation of file reading
-     *
-     * @param int $length
-     * @return string|false
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _read($length)
-    {
-        $result = fread($this->_fileHandler, $length);
-
-        if (false === $result) {
-            throw new \Magento\Framework\Exception('Failed to read data from ' . $this->_filePath);
-        }
-
-        return $result;
-    }
-
-    /**
-     * Implementation of EOF indicator
-     *
-     * @return bool
-     */
-    protected function _eof()
-    {
-        return feof($this->_fileHandler);
-    }
-
-    /**
-     * Implementation of file closing
-     *
-     * @return void
-     */
-    protected function _close()
-    {
-        fclose($this->_fileHandler);
-    }
-
-    /**
-     * Check whether requested mode is writable mode
-     *
-     * @param string $mode
-     * @return int|false
-     */
-    protected function _isWritableMode($mode)
-    {
-        return preg_match('/(^[waxc])|(\+$)/', $mode);
-    }
-
-    /**
-     * Check whether requested mode is readable mode
-     *
-     * @param string $mode
-     * @return bool
-     */
-    protected function _isReadableMode($mode)
-    {
-        return !$this->_isWritableMode($mode);
-    }
-
-    /**
-     * Check whether file is opened
-     *
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _checkFileOpened()
-    {
-        if (!$this->_fileHandler) {
-            throw new \Magento\Framework\Exception('File not opened');
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/Helper/File/Bz.php b/downloader/lib/Magento/Framework/Archive/Helper/File/Bz.php
deleted file mode 100644
index 90e0e2d0033369420832713710a0c090692d579f..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/Helper/File/Bz.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Archive\Helper\File;
-
-/**
-* Helper class that simplifies bz2 files stream reading and writing
-*
-* @author      Magento Core Team <core@magentocommerce.com>
-*/
-class Bz extends \Magento\Framework\Archive\Helper\File
-{
-    /**
-     * Open bz archive file
-     *
-     * @param string $mode
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _open($mode)
-    {
-        $this->_fileHandler = @bzopen($this->_filePath, $mode);
-
-        if (false === $this->_fileHandler) {
-            throw new \Magento\Framework\Exception('Failed to open file ' . $this->_filePath);
-        }
-    }
-
-    /**
-     * Write data to bz archive
-     *
-     * @param string $data
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _write($data)
-    {
-        $result = @bzwrite($this->_fileHandler, $data);
-
-        if (false === $result) {
-            throw new \Magento\Framework\Exception('Failed to write data to ' . $this->_filePath);
-        }
-    }
-
-    /**
-     * Read data from bz archive
-     *
-     * @param int $length
-     * @return string
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _read($length)
-    {
-        $data = bzread($this->_fileHandler, $length);
-
-        if (false === $data) {
-            throw new \Magento\Framework\Exception('Failed to read data from ' . $this->_filePath);
-        }
-
-        return $data;
-    }
-
-    /**
-     * Close bz archive
-     *
-     * @return void
-     */
-    protected function _close()
-    {
-        bzclose($this->_fileHandler);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/Helper/File/Gz.php b/downloader/lib/Magento/Framework/Archive/Helper/File/Gz.php
deleted file mode 100644
index 556d128cd39fa11021d5fda8c114f81417d275f7..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/Helper/File/Gz.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Archive\Helper\File;
-
-/**
-* Helper class that simplifies gz files stream reading and writing
-*
-* @author      Magento Core Team <core@magentocommerce.com>
-*/
-class Gz extends \Magento\Framework\Archive\Helper\File
-{
-    /**
-     * @param string $mode
-     * @return void
-     * @see \Magento\Framework\Archive\Helper\File::_open()
-     */
-    protected function _open($mode)
-    {
-        $this->_fileHandler = @gzopen($this->_filePath, $mode);
-
-        if (false === $this->_fileHandler) {
-            throw new \Magento\Framework\Exception('Failed to open file ' . $this->_filePath);
-        }
-    }
-
-    /**
-     * @param string $data
-     * @return void
-     * @see \Magento\Framework\Archive\Helper\File::_write()
-     */
-    protected function _write($data)
-    {
-        $result = @gzwrite($this->_fileHandler, $data);
-
-        if (empty($result) && !empty($data)) {
-            throw new \Magento\Framework\Exception('Failed to write data to ' . $this->_filePath);
-        }
-    }
-
-    /**
-     * @param int $length
-     * @return string
-     * @see \Magento\Framework\Archive\Helper\File::_read()
-     */
-    protected function _read($length)
-    {
-        return gzread($this->_fileHandler, $length);
-    }
-
-    /**
-     * @return int|false
-     * @see \Magento\Framework\Archive\Helper\File::_eof()
-     */
-    protected function _eof()
-    {
-        return gzeof($this->_fileHandler);
-    }
-
-    /**
-     * @return void
-     * @see \Magento\Framework\Archive\Helper\File::_close()
-     */
-    protected function _close()
-    {
-        gzclose($this->_fileHandler);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Archive/Tar.php b/downloader/lib/Magento/Framework/Archive/Tar.php
deleted file mode 100644
index da98af616157eb05c6c5d55216fb56834f54c2ef..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Archive/Tar.php
+++ /dev/null
@@ -1,704 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Archive;
-
-/**
- * Class to work with tar archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Tar extends \Magento\Framework\Archive\AbstractArchive implements \Magento\Framework\Archive\ArchiveInterface
-{
-    /**
-     * Tar block size
-     *
-     * @const int
-     */
-    const TAR_BLOCK_SIZE = 512;
-
-    /**
-     * Keep file or directory for packing.
-     *
-     * @var string
-     */
-    protected $_currentFile;
-
-    /**
-     * Keep path to file or directory for packing.
-     *
-     * @var mixed
-     */
-    protected $_currentPath;
-
-    /**
-     * Skip first level parent directory. Example:
-     *   use test/fip.php instead test/test/fip.php;
-     *
-     * @var mixed
-     */
-    protected $_skipRoot;
-
-    /**
-     * Tarball data writer
-     *
-     * @var \Magento\Framework\Archive\Helper\File
-     */
-    protected $_writer;
-
-    /**
-     * Tarball data reader
-     *
-     * @var \Magento\Framework\Archive\Helper\File
-     */
-    protected $_reader;
-
-    /**
-     * Path to file where tarball should be placed
-     *
-     * @var string
-     */
-    protected $_destinationFilePath;
-
-    /**
-     * Initialize tarball writer
-     *
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _initWriter()
-    {
-        $this->_writer = new \Magento\Framework\Archive\Helper\File($this->_destinationFilePath);
-        $this->_writer->open('w');
-
-        return $this;
-    }
-
-    /**
-     * Returns string that is used for tar's header parsing
-     *
-     * @return string
-     */
-    final protected static function _getFormatParseHeader()
-    {
-        return 'a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2version/' .
-            'a32uname/a32gname/a8devmajor/a8devminor/a155prefix/a12closer';
-    }
-
-    /**
-     * Destroy tarball writer
-     *
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _destroyWriter()
-    {
-        if ($this->_writer instanceof \Magento\Framework\Archive\Helper\File) {
-            $this->_writer->close();
-            $this->_writer = null;
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get tarball writer
-     *
-     * @return \Magento\Framework\Archive\Helper\File
-     */
-    protected function _getWriter()
-    {
-        if (!$this->_writer) {
-            $this->_initWriter();
-        }
-
-        return $this->_writer;
-    }
-
-    /**
-     * Initialize tarball reader
-     *
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _initReader()
-    {
-        $this->_reader = new \Magento\Framework\Archive\Helper\File($this->_getCurrentFile());
-        $this->_reader->open('r');
-
-        return $this;
-    }
-
-    /**
-     * Destroy tarball reader
-     *
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _destroyReader()
-    {
-        if ($this->_reader instanceof \Magento\Framework\Archive\Helper\File) {
-            $this->_reader->close();
-            $this->_reader = null;
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get tarball reader
-     *
-     * @return \Magento\Framework\Archive\Helper\File
-     */
-    protected function _getReader()
-    {
-        if (!$this->_reader) {
-            $this->_initReader();
-        }
-
-        return $this->_reader;
-    }
-
-    /**
-     * Set option that define ability skip first catalog level.
-     *
-     * @param mixed $skipRoot
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _setSkipRoot($skipRoot)
-    {
-        $this->_skipRoot = $skipRoot;
-        return $this;
-    }
-
-    /**
-     * Set file which is packing.
-     *
-     * @param string $file
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _setCurrentFile($file)
-    {
-        $this->_currentFile = $file . (!is_link($file) && is_dir($file) && substr($file, -1) != '/' ? '/' : '');
-        return $this;
-    }
-
-    /**
-     * Set path to file where tarball should be placed
-     *
-     * @param string $destinationFilePath
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _setDestinationFilePath($destinationFilePath)
-    {
-        $this->_destinationFilePath = $destinationFilePath;
-        return $this;
-    }
-
-    /**
-     * Retrieve file which is packing.
-     *
-     * @return string
-     */
-    protected function _getCurrentFile()
-    {
-        return $this->_currentFile;
-    }
-
-    /**
-     * Set path to file which is packing.
-     *
-     * @param string $path
-     * @return \Magento\Framework\Archive\Tar
-     */
-    protected function _setCurrentPath($path)
-    {
-        if ($this->_skipRoot && is_dir($path)) {
-            $this->_currentPath = $path . (substr($path, -1) != '/' ? '/' : '');
-        } else {
-            $this->_currentPath = dirname($path) . '/';
-        }
-        return $this;
-    }
-
-    /**
-     * Retrieve path to file which is packing.
-     *
-     * @return string
-     */
-    protected function _getCurrentPath()
-    {
-        return $this->_currentPath;
-    }
-
-    /**
-     * Walk through directory and add to tar file or directory.
-     * Result is packed string on TAR format.
-     *
-     * @deprecated after 1.7.0.0
-     * @param boolean $skipRoot
-     * @return string
-     */
-    protected function _packToTar($skipRoot = false)
-    {
-        $file = $this->_getCurrentFile();
-        $header = '';
-        $data = '';
-        if (!$skipRoot) {
-            $header = $this->_composeHeader();
-            $data = $this->_readFile($file);
-            $data = str_pad($data, floor(((is_dir($file) ? 0 : filesize($file)) + 512 - 1) / 512) * 512, "\0");
-        }
-        $sub = '';
-        if (is_dir($file)) {
-            $treeDir = scandir($file);
-            if (empty($treeDir)) {
-                throw new \Magento\Framework\Exception('Can\'t scan dir: ' . $file);
-            }
-            array_shift($treeDir);
-            /* remove  './'*/
-            array_shift($treeDir);
-            /* remove  '../'*/
-            foreach ($treeDir as $item) {
-                $sub .= $this->_setCurrentFile($file . $item)->_packToTar(false);
-            }
-        }
-        $tarData = $header . $data . $sub;
-        $tarData = str_pad($tarData, floor((strlen($tarData) - 1) / 1536) * 1536, "\0");
-        return $tarData;
-    }
-
-    /**
-     * Recursively walk through file tree and create tarball
-     *
-     * @param boolean $skipRoot
-     * @param boolean $finalize
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _createTar($skipRoot = false, $finalize = false)
-    {
-        if (!$skipRoot) {
-            $this->_packAndWriteCurrentFile();
-        }
-
-        $file = $this->_getCurrentFile();
-
-        if (is_dir($file)) {
-            $dirFiles = scandir($file);
-
-            if (false === $dirFiles) {
-                throw new \Magento\Framework\Exception('Can\'t scan dir: ' . $file);
-            }
-
-            array_shift($dirFiles);
-            /* remove  './'*/
-            array_shift($dirFiles);
-            /* remove  '../'*/
-
-            foreach ($dirFiles as $item) {
-                $this->_setCurrentFile($file . $item)->_createTar();
-            }
-        }
-
-        if ($finalize) {
-            $this->_getWriter()->write(str_repeat("\0", self::TAR_BLOCK_SIZE * 12));
-        }
-    }
-
-    /**
-     * Write current file to tarball
-     *
-     * @return void
-     */
-    protected function _packAndWriteCurrentFile()
-    {
-        $archiveWriter = $this->_getWriter();
-        $archiveWriter->write($this->_composeHeader());
-
-        $currentFile = $this->_getCurrentFile();
-
-        $fileSize = 0;
-
-        if (is_file($currentFile) && !is_link($currentFile)) {
-            $fileReader = new \Magento\Framework\Archive\Helper\File($currentFile);
-            $fileReader->open('r');
-
-            while (!$fileReader->eof()) {
-                $archiveWriter->write($fileReader->read());
-            }
-
-            $fileReader->close();
-
-            $fileSize = filesize($currentFile);
-        }
-
-        $appendZerosCount = (self::TAR_BLOCK_SIZE - $fileSize % self::TAR_BLOCK_SIZE) % self::TAR_BLOCK_SIZE;
-        $archiveWriter->write(str_repeat("\0", $appendZerosCount));
-    }
-
-    /**
-     * Compose header for current file in TAR format.
-     * If length of file's name greater 100 characters,
-     * method breaks header into two pieces. First contains
-     * header and data with long name. Second contain only header.
-     *
-     * @param boolean $long
-     * @return string
-     */
-    protected function _composeHeader($long = false)
-    {
-        $file = $this->_getCurrentFile();
-        $path = $this->_getCurrentPath();
-        $infoFile = stat($file);
-        $nameFile = str_replace($path, '', $file);
-        $nameFile = str_replace('\\', '/', $nameFile);
-        $packedHeader = '';
-        $longHeader = '';
-        if (!$long && strlen($nameFile) > 100) {
-            $longHeader = $this->_composeHeader(true);
-            $longHeader .= str_pad($nameFile, floor((strlen($nameFile) + 512 - 1) / 512) * 512, "\0");
-        }
-        $header = array();
-        $header['100-name'] = $long ? '././@LongLink' : substr($nameFile, 0, 100);
-        $header['8-mode'] = $long ? '       ' : str_pad(
-            substr(sprintf("%07o", $infoFile['mode']), -4),
-            6,
-            '0',
-            STR_PAD_LEFT
-        );
-        $header['8-uid'] = $long || $infoFile['uid'] == 0 ? "\0\0\0\0\0\0\0" : sprintf("%07o", $infoFile['uid']);
-        $header['8-gid'] = $long || $infoFile['gid'] == 0 ? "\0\0\0\0\0\0\0" : sprintf("%07o", $infoFile['gid']);
-        $header['12-size'] = $long ? sprintf(
-            "%011o",
-            strlen($nameFile)
-        ) : sprintf(
-            "%011o",
-            is_dir($file) ? 0 : filesize($file)
-        );
-        $header['12-mtime'] = $long ? '00000000000' : sprintf("%011o", $infoFile['mtime']);
-        $header['8-check'] = sprintf('% 8s', '');
-        $header['1-type'] = $long ? 'L' : (is_link($file) ? 2 : (is_dir($file) ? 5 : 0));
-        $header['100-symlink'] = is_link($file) ? readlink($file) : '';
-        $header['6-magic'] = 'ustar ';
-        $header['2-version'] = ' ';
-        $a = function_exists('posix_getpwuid') ? posix_getpwuid(fileowner($file)) : array('name' => '');
-        $header['32-uname'] = $a['name'];
-        $a = function_exists('posix_getgrgid') ? posix_getgrgid(filegroup($file)) : array('name' => '');
-        $header['32-gname'] = $a['name'];
-        $header['8-devmajor'] = '';
-        $header['8-devminor'] = '';
-        $header['155-prefix'] = '';
-        $header['12-closer'] = '';
-
-        $packedHeader = '';
-        foreach ($header as $key => $element) {
-            $length = explode('-', $key);
-            $packedHeader .= pack('a' . $length[0], $element);
-        }
-
-        $checksum = 0;
-        for ($i = 0; $i < 512; $i++) {
-            $checksum += ord(substr($packedHeader, $i, 1));
-        }
-        $packedHeader = substr_replace($packedHeader, sprintf("%07o", $checksum) . "\0", 148, 8);
-
-        return $longHeader . $packedHeader;
-    }
-
-    /**
-     * Read TAR string from file, and unpacked it.
-     * Create files and directories information about discribed
-     * in the string.
-     *
-     * @param string $destination path to file is unpacked
-     * @return array list of files
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _unpackCurrentTar($destination)
-    {
-        $archiveReader = $this->_getReader();
-        $list = array();
-
-        while (!$archiveReader->eof()) {
-            $header = $this->_extractFileHeader();
-
-            if (!$header) {
-                continue;
-            }
-
-            $currentFile = $destination . $header['name'];
-            $dirname = dirname($currentFile);
-
-            if (in_array($header['type'], array("0", chr(0), ''))) {
-
-                if (!file_exists($dirname)) {
-                    $mkdirResult = @mkdir($dirname, 0777, true);
-
-                    if (false === $mkdirResult) {
-                        throw new \Magento\Framework\Exception('Failed to create directory ' . $dirname);
-                    }
-                }
-
-                $this->_extractAndWriteFile($header, $currentFile);
-                $list[] = $currentFile;
-            } elseif ($header['type'] == '5') {
-
-                if (!file_exists($dirname)) {
-                    $mkdirResult = @mkdir($currentFile, $header['mode'], true);
-
-                    if (false === $mkdirResult) {
-                        throw new \Magento\Framework\Exception('Failed to create directory ' . $currentFile);
-                    }
-                }
-                $list[] = $currentFile . '/';
-            } elseif ($header['type'] == '2') {
-
-                //we do not interrupt unpack process if symlink creation failed as symlinks are not so important
-                @symlink($header['symlink'], $currentFile);
-            }
-        }
-
-        return $list;
-    }
-
-    /**
-     * Get header from TAR string and unpacked it by format.
-     *
-     * @deprecated after 1.7.0.0
-     * @param resource $pointer
-     * @return string
-     */
-    protected function _parseHeader(&$pointer)
-    {
-        $firstLine = fread($pointer, 512);
-
-        if (strlen($firstLine) < 512) {
-            return false;
-        }
-
-        $fmt = self::_getFormatParseHeader();
-        $header = unpack($fmt, $firstLine);
-
-        $header['mode'] = $header['mode'] + 0;
-        $header['uid'] = octdec($header['uid']);
-        $header['gid'] = octdec($header['gid']);
-        $header['size'] = octdec($header['size']);
-        $header['mtime'] = octdec($header['mtime']);
-        $header['checksum'] = octdec($header['checksum']);
-
-        if ($header['type'] == "5") {
-            $header['size'] = 0;
-        }
-
-        $checksum = 0;
-        $firstLine = substr_replace($firstLine, '        ', 148, 8);
-        for ($i = 0; $i < 512; $i++) {
-            $checksum += ord(substr($firstLine, $i, 1));
-        }
-
-        $isUstar = 'ustar' == strtolower(substr($header['magic'], 0, 5));
-
-        $checksumOk = $header['checksum'] == $checksum;
-        if (isset($header['name']) && $checksumOk) {
-            if ($header['name'] == '././@LongLink' && $header['type'] == 'L') {
-                $realName = substr(
-                    fread($pointer, floor(($header['size'] + 512 - 1) / 512) * 512),
-                    0,
-                    $header['size']
-                );
-                $headerMain = $this->_parseHeader($pointer);
-                $headerMain['name'] = $realName;
-                return $headerMain;
-            } else {
-                if ($header['size'] > 0) {
-                    $header['data'] = substr(
-                        fread($pointer, floor(($header['size'] + 512 - 1) / 512) * 512),
-                        0,
-                        $header['size']
-                    );
-                } else {
-                    $header['data'] = '';
-                }
-                return $header;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Read and decode file header information from tarball
-     *
-     * @return array|boolean
-     */
-    protected function _extractFileHeader()
-    {
-        $archiveReader = $this->_getReader();
-
-        $headerBlock = $archiveReader->read(self::TAR_BLOCK_SIZE);
-
-        if (strlen($headerBlock) < self::TAR_BLOCK_SIZE) {
-            return false;
-        }
-
-        $header = unpack(self::_getFormatParseHeader(), $headerBlock);
-
-        $header['mode'] = octdec($header['mode']);
-        $header['uid'] = octdec($header['uid']);
-        $header['gid'] = octdec($header['gid']);
-        $header['size'] = octdec($header['size']);
-        $header['mtime'] = octdec($header['mtime']);
-        $header['checksum'] = octdec($header['checksum']);
-
-        if ($header['type'] == "5") {
-            $header['size'] = 0;
-        }
-
-        $checksum = 0;
-        $headerBlock = substr_replace($headerBlock, '        ', 148, 8);
-
-        for ($i = 0; $i < 512; $i++) {
-            $checksum += ord(substr($headerBlock, $i, 1));
-        }
-
-        $checksumOk = $header['checksum'] == $checksum;
-        if (isset($header['name']) && $checksumOk) {
-
-            if (!($header['name'] == '././@LongLink' && $header['type'] == 'L')) {
-                $header['name'] = trim($header['name']);
-                return $header;
-            }
-
-            $realNameBlockSize = floor(
-                ($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE
-            ) * self::TAR_BLOCK_SIZE;
-            $realNameBlock = $archiveReader->read($realNameBlockSize);
-            $realName = substr($realNameBlock, 0, $header['size']);
-
-            $headerMain = $this->_extractFileHeader();
-            $headerMain['name'] = trim($realName);
-            return $headerMain;
-        }
-
-        return false;
-    }
-
-    /**
-     * Extract next file from tarball by its $header information and save it to $destination
-     *
-     * @param array $fileHeader
-     * @param string $destination
-     * @return void
-     */
-    protected function _extractAndWriteFile($fileHeader, $destination)
-    {
-        $fileWriter = new \Magento\Framework\Archive\Helper\File($destination);
-        $fileWriter->open('w', $fileHeader['mode']);
-
-        $archiveReader = $this->_getReader();
-
-        $filesize = $fileHeader['size'];
-        $bytesExtracted = 0;
-
-        while ($filesize > $bytesExtracted && !$archiveReader->eof()) {
-            $block = $archiveReader->read(self::TAR_BLOCK_SIZE);
-            $nonExtractedBytesCount = $filesize - $bytesExtracted;
-
-            $data = substr($block, 0, $nonExtractedBytesCount);
-            $fileWriter->write($data);
-
-            $bytesExtracted += strlen($block);
-        }
-    }
-
-    /**
-     * Pack file to TAR (Tape Archiver).
-     *
-     * @param string $source
-     * @param string $destination
-     * @param boolean $skipRoot
-     * @return string
-     */
-    public function pack($source, $destination, $skipRoot = false)
-    {
-        $this->_setSkipRoot($skipRoot);
-        $source = realpath($source);
-        $tarData = $this->_setCurrentPath($source)->_setDestinationFilePath($destination)->_setCurrentFile($source);
-
-        $this->_initWriter();
-        $this->_createTar($skipRoot, true);
-        $this->_destroyWriter();
-
-        return $destination;
-    }
-
-    /**
-     * Unpack file from TAR (Tape Archiver).
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
-     */
-    public function unpack($source, $destination)
-    {
-        $this->_setCurrentFile($source)->_setCurrentPath($source);
-
-        $this->_initReader();
-        $this->_unpackCurrentTar($destination);
-        $this->_destroyReader();
-
-        return $destination;
-    }
-
-    /**
-     * Extract one file from TAR (Tape Archiver).
-     *
-     * @param string $file
-     * @param string $source
-     * @param string $destination
-     * @return string
-     */
-    public function extract($file, $source, $destination)
-    {
-        $this->_setCurrentFile($source);
-        $this->_initReader();
-
-        $archiveReader = $this->_getReader();
-        $extractedFile = '';
-
-        while (!$archiveReader->eof()) {
-            $header = $this->_extractFileHeader();
-            if ($header['name'] == $file) {
-                $extractedFile = $destination . basename($header['name']);
-                $this->_extractAndWriteFile($header, $extractedFile);
-                break;
-            }
-
-            if ($header['type'] != 5) {
-                $skipBytes = floor(
-                    ($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE
-                ) * self::TAR_BLOCK_SIZE;
-                $archiveReader->read($skipBytes);
-            }
-        }
-
-        $this->_destroyReader();
-        return $extractedFile;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/AbstractBackup.php b/downloader/lib/Magento/Framework/Backup/AbstractBackup.php
deleted file mode 100644
index 3bb169fb47bf8ba415c93714755ce2407b000d8b..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/AbstractBackup.php
+++ /dev/null
@@ -1,314 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-/**
- * Class to work with archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup;
-
-abstract class AbstractBackup implements \Magento\Framework\Backup\BackupInterface
-{
-    /**
-     * Backup name
-     *
-     * @var string
-     */
-    protected $_name;
-
-    /**
-     * Backup creation date
-     *
-     * @var int
-     */
-    protected $_time;
-
-    /**
-     * Backup file extension
-     *
-     * @var string
-     */
-    protected $_backupExtension;
-
-    /**
-     * Resource model
-     *
-     * @var object
-     */
-    protected $_resourceModel;
-
-    /**
-     * Magento's root directory
-     *
-     * @var string
-     */
-    protected $_rootDir;
-
-    /**
-     * Path to directory where backups stored
-     *
-     * @var string
-     */
-    protected $_backupsDir;
-
-    /**
-     * Is last operation completed successfully
-     *
-     * @var bool
-     */
-    protected $_lastOperationSucceed = false;
-
-    /**
-     * Last failed operation error message
-     *
-     * @var string
-     */
-    protected $_lastErrorMessage;
-
-    /**
-     * Set Backup Extension
-     *
-     * @param string $backupExtension
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setBackupExtension($backupExtension)
-    {
-        $this->_backupExtension = $backupExtension;
-        return $this;
-    }
-
-    /**
-     * Get Backup Extension
-     *
-     * @return string
-     */
-    public function getBackupExtension()
-    {
-        return $this->_backupExtension;
-    }
-
-    /**
-     * Set Resource Model
-     *
-     * @param object $resourceModel
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setResourceModel($resourceModel)
-    {
-        $this->_resourceModel = $resourceModel;
-        return $this;
-    }
-
-    /**
-     * Get Resource Model
-     *
-     * @return object
-     */
-    public function getResourceModel()
-    {
-        return $this->_resourceModel;
-    }
-
-    /**
-     * Set Time
-     *
-     * @param int $time
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setTime($time)
-    {
-        $this->_time = $time;
-        return $this;
-    }
-
-    /**
-     * Get Time
-     *
-     * @return int
-     */
-    public function getTime()
-    {
-        return $this->_time;
-    }
-
-    /**
-     * Set root directory of Magento installation
-     *
-     * @param string $rootDir
-     * @throws \Magento\Framework\Exception
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setRootDir($rootDir)
-    {
-        if (!is_dir($rootDir)) {
-            throw new \Magento\Framework\Exception('Bad root directory');
-        }
-
-        $this->_rootDir = $rootDir;
-        return $this;
-    }
-
-    /**
-     * Get Magento's root directory
-     * @return string
-     */
-    public function getRootDir()
-    {
-        return $this->_rootDir;
-    }
-
-    /**
-     * Set path to directory where backups stored
-     *
-     * @param string $backupsDir
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setBackupsDir($backupsDir)
-    {
-        $this->_backupsDir = $backupsDir;
-        return $this;
-    }
-
-    /**
-     * Get path to directory where backups stored
-     *
-     * @return string
-     */
-    public function getBackupsDir()
-    {
-        return $this->_backupsDir;
-    }
-
-    /**
-     * Get path to backup
-     *
-     * @return string
-     */
-    public function getBackupPath()
-    {
-        return $this->getBackupsDir() . '/' . $this->getBackupFilename();
-    }
-
-    /**
-     * Get backup file name
-     *
-     * @return string
-     */
-    public function getBackupFilename()
-    {
-        $filename = $this->getTime() . '_' . $this->getType();
-
-        $name = $this->getName();
-
-        if (!empty($name)) {
-            $filename .= '_' . $name;
-        }
-
-        $filename .= '.' . $this->getBackupExtension();
-
-        return $filename;
-    }
-
-    /**
-     * Check whether last operation completed successfully
-     *
-     * @return bool
-     */
-    public function getIsSuccess()
-    {
-        return $this->_lastOperationSucceed;
-    }
-
-    /**
-     * Get last error message
-     *
-     * @return string
-     */
-    public function getErrorMessage()
-    {
-        return $this->_lastErrorMessage;
-    }
-
-    /**
-     * Set error message
-     *
-     * @param string $errorMessage
-     * @return string
-     */
-    public function setErrorMessage($errorMessage)
-    {
-        $this->_lastErrorMessage = $errorMessage;
-    }
-
-    /**
-     * Set backup name
-     *
-     * @param string $name
-     * @param bool $applyFilter
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setName($name, $applyFilter = true)
-    {
-        if ($applyFilter) {
-            $name = $this->_filterName($name);
-        }
-        $this->_name = $name;
-        return $this;
-    }
-
-    /**
-     * Get backup name
-     *
-     * @return string
-     */
-    public function getName()
-    {
-        return $this->_name;
-    }
-
-    /**
-     * Get backup display name
-     *
-     * @return string
-     */
-    public function getDisplayName()
-    {
-        return str_replace('_', ' ', $this->_name);
-    }
-
-    /**
-     * Removes disallowed characters and replaces spaces with underscores
-     *
-     * @param string $name
-     * @return string
-     */
-    protected function _filterName($name)
-    {
-        $name = trim(preg_replace('/[^\da-zA-Z ]/', '', $name));
-        $name = preg_replace('/\s{2,}/', ' ', $name);
-        $name = str_replace(' ', '_', $name);
-
-        return $name;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Archive/Tar.php b/downloader/lib/Magento/Framework/Backup/Archive/Tar.php
deleted file mode 100644
index 15e99845f9e18d09ba96aff6a28838d67428c83f..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Archive/Tar.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup\Archive;
-
-/**
- * Extended version of \Magento\Framework\Archive\Tar that supports filtering
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Tar extends \Magento\Framework\Archive\Tar
-{
-    /**
-     * Filenames or filename parts that are used for filtering files
-     *
-     * @var array
-     */
-    protected $_skipFiles = array();
-
-    /**
-     * Overridden \Magento\Framework\Archive\Tar::_createTar method that does the same actions as it's parent but filters
-     * files using \Magento\Framework\Backup\Filesystem\Iterator\Filter
-     *
-     * @param bool $skipRoot
-     * @param bool $finalize
-     * @return void
-     * @see \Magento\Framework\Archive\Tar::_createTar()
-     */
-    protected function _createTar($skipRoot = false, $finalize = false)
-    {
-        $path = $this->_getCurrentFile();
-
-        $filesystemIterator = new \RecursiveIteratorIterator(
-            new \RecursiveDirectoryIterator($path),
-            \RecursiveIteratorIterator::SELF_FIRST
-        );
-
-        $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter($filesystemIterator, $this->_skipFiles);
-
-        foreach ($iterator as $item) {
-            $this->_setCurrentFile($item->getPathname());
-            $this->_packAndWriteCurrentFile();
-        }
-
-        if ($finalize) {
-            $this->_getWriter()->write(str_repeat("\0", self::TAR_BLOCK_SIZE * 12));
-        }
-    }
-
-    /**
-     * Set files that shouldn't be added to tarball
-     *
-     * @param array $skipFiles
-     * @return \Magento\Framework\Backup\Archive\Tar
-     */
-    public function setSkipFiles(array $skipFiles)
-    {
-        $this->_skipFiles = $skipFiles;
-        return $this;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/BackupInterface.php b/downloader/lib/Magento/Framework/Backup/BackupInterface.php
deleted file mode 100644
index 8e251153c2167aae44f96ab29a06270f259a8c01..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/BackupInterface.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Interface for work with archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup;
-
-interface BackupInterface
-{
-    /**
-     * Create Backup
-     *
-     * @return boolean
-     */
-    public function create();
-
-    /**
-     * Rollback Backup
-     *
-     * @return boolean
-     */
-    public function rollback();
-
-    /**
-     * Set Backup Extension
-     *
-     * @param string $backupExtension
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setBackupExtension($backupExtension);
-
-    /**
-     * Set Resource Model
-     *
-     * @param object $resourceModel
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setResourceModel($resourceModel);
-
-    /**
-     * Set Time
-     *
-     * @param int $time
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setTime($time);
-
-    /**
-     * Get Backup Type
-     *
-     * @return string
-     */
-    public function getType();
-
-    /**
-     * Set path to directory where backups stored
-     *
-     * @param string $backupsDir
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    public function setBackupsDir($backupsDir);
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Db.php b/downloader/lib/Magento/Framework/Backup/Db.php
deleted file mode 100644
index 171d9f3e5565e388b6abbb43b6133a989e291c60..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Db.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup;
-
-/**
- * Class to work with database backups
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Db extends \Magento\Framework\Backup\AbstractBackup
-{
-    /**
-     * @var \Magento\Framework\Backup\Db\BackupFactory
-     */
-    protected $_backupFactory;
-
-    /**
-     * @param \Magento\Framework\Backup\Db\BackupFactory $backupFactory
-     */
-    public function __construct(\Magento\Framework\Backup\Db\BackupFactory $backupFactory)
-    {
-        $this->_backupFactory = $backupFactory;
-    }
-
-    /**
-     * Implements Rollback functionality for Db
-     *
-     * @return bool
-     */
-    public function rollback()
-    {
-        set_time_limit(0);
-        ignore_user_abort(true);
-
-        $this->_lastOperationSucceed = false;
-
-        $archiveManager = new \Magento\Framework\Archive();
-        $source = $archiveManager->unpack($this->getBackupPath(), $this->getBackupsDir());
-
-        $file = new \Magento\Framework\Backup\Filesystem\Iterator\File($source);
-        foreach ($file as $statement) {
-            $this->getResourceModel()->runCommand($statement);
-        }
-        @unlink($source);
-
-        $this->_lastOperationSucceed = true;
-
-        return true;
-    }
-
-    /**
-     * Checks whether the line is last in sql command
-     *
-     * @param string $line
-     * @return bool
-     */
-    protected function _isLineLastInCommand($line)
-    {
-        $cleanLine = trim($line);
-        $lineLength = strlen($cleanLine);
-
-        $returnResult = false;
-        if ($lineLength > 0) {
-            $lastSymbolIndex = $lineLength - 1;
-            if ($cleanLine[$lastSymbolIndex] == ';') {
-                $returnResult = true;
-            }
-        }
-
-        return $returnResult;
-    }
-
-    /**
-     * Implements Create Backup functionality for Db
-     *
-     * @return bool
-     */
-    public function create()
-    {
-        set_time_limit(0);
-        ignore_user_abort(true);
-
-        $this->_lastOperationSucceed = false;
-
-        $backup = $this->_backupFactory->createBackupModel()->setTime(
-            $this->getTime()
-        )->setType(
-            $this->getType()
-        )->setPath(
-            $this->getBackupsDir()
-        )->setName(
-            $this->getName()
-        );
-
-        $backupDb = $this->_backupFactory->createBackupDbModel();
-        $backupDb->createBackup($backup);
-
-        $this->_lastOperationSucceed = true;
-
-        return true;
-    }
-
-    /**
-     * Get Backup Type
-     *
-     * @return string
-     */
-    public function getType()
-    {
-        return 'db';
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Db/BackupFactory.php b/downloader/lib/Magento/Framework/Backup/Db/BackupFactory.php
deleted file mode 100644
index 6b23522b09a734be5f640706a2a984ecde6c7595..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Db/BackupFactory.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup\Db;
-
-class BackupFactory
-{
-    /**
-     * Object manager
-     *
-     * @var \Magento\Framework\ObjectManager
-     */
-    private $_objectManager;
-
-    /**
-     * @var string
-     */
-    private $_backupInstanceName;
-
-    /**
-     * @var string
-     */
-    private $_backupDbInstanceName;
-
-    /**
-     * @param \Magento\Framework\ObjectManager $objectManager
-     * @param string $backupInstanceName
-     * @param string $backupDbInstanceName
-     */
-    public function __construct(\Magento\Framework\ObjectManager $objectManager, $backupInstanceName, $backupDbInstanceName)
-    {
-        $this->_objectManager = $objectManager;
-        $this->_backupInstanceName = $backupInstanceName;
-        $this->_backupDbInstanceName = $backupDbInstanceName;
-    }
-
-    /**
-     * Create backup model
-     *
-     * @param array $arguments
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function createBackupModel(array $arguments = array())
-    {
-        return $this->_objectManager->create($this->_backupInstanceName, $arguments);
-    }
-
-    /**
-     * Create backup Db model
-     *
-     * @param array $arguments
-     * @return \Magento\Framework\Backup\Db\BackupDbInterface
-     */
-    public function createBackupDbModel(array $arguments = array())
-    {
-        return $this->_objectManager->create($this->_backupDbInstanceName, $arguments);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Db/BackupInterface.php b/downloader/lib/Magento/Framework/Backup/Db/BackupInterface.php
deleted file mode 100644
index 8224b757686749f34f914c3eabc09ee0054281eb..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Db/BackupInterface.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup\Db;
-
-interface BackupInterface
-{
-    /**
-     * Set backup time
-     *
-     * @param int $time
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function setTime($time);
-
-    /**
-     * Set backup type
-     *
-     * @param string $type
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function setType($type);
-
-    /**
-     * Set backup path
-     *
-     * @param string $path
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function setPath($path);
-
-    /**
-     * Set backup name
-     *
-     * @param string $name
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function setName($name);
-
-    /**
-     * Open backup file (write or read mode)
-     *
-     * @param bool $write
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function open($write = false);
-
-    /**
-     * Write to backup file
-     *
-     * @param string $data
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function write($data);
-
-    /**
-     * Close open backup file
-     *
-     * @return \Magento\Framework\Backup\Db\BackupInterface
-     */
-    public function close();
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Exception/FtpValidationFailed.php b/downloader/lib/Magento/Framework/Backup/Exception/FtpValidationFailed.php
deleted file mode 100644
index 111ac6361e3ed9591aa272e6151003a97ee4a740..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Exception/FtpValidationFailed.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup\Exception;
-
-class FtpValidationFailed extends \Magento\Framework\Backup\BackupException
-{
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Exception/NotEnoughFreeSpace.php b/downloader/lib/Magento/Framework/Backup/Exception/NotEnoughFreeSpace.php
deleted file mode 100644
index 3399a4a9b459ce68b263c34920e0beddf9845e5c..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Exception/NotEnoughFreeSpace.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup\Exception;
-
-class NotEnoughFreeSpace extends \Magento\Framework\Backup\BackupException
-{
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Exception/NotEnoughPermissions.php b/downloader/lib/Magento/Framework/Backup/Exception/NotEnoughPermissions.php
deleted file mode 100644
index 6254eb856fdb7359d9ff7ea4bebc1f92f5bdd779..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Exception/NotEnoughPermissions.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup\Exception;
-
-class NotEnoughPermissions extends \Magento\Framework\Backup\BackupException
-{
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Factory.php b/downloader/lib/Magento/Framework/Backup/Factory.php
deleted file mode 100644
index 429114842f04722828ccb7f653da7c01108e5795..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Factory.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-/**
- * Backup object factory.
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup;
-
-class Factory
-{
-    /**
-     * Object manager
-     *
-     * @var \Magento\Framework\ObjectManager
-     */
-    private $_objectManager;
-
-    /**
-     * Backup type constant for database backup
-     */
-    const TYPE_DB = 'db';
-
-    /**
-     * Backup type constant for filesystem backup
-     */
-    const TYPE_FILESYSTEM = 'filesystem';
-
-    /**
-     * Backup type constant for full system backup(database + filesystem)
-     */
-    const TYPE_SYSTEM_SNAPSHOT = 'snapshot';
-
-    /**
-     * Backup type constant for media and database backup
-     */
-    const TYPE_MEDIA = 'media';
-
-    /**
-     * Backup type constant for full system backup excluding media folder
-     */
-    const TYPE_SNAPSHOT_WITHOUT_MEDIA = 'nomedia';
-
-    /**
-     * List of supported a backup types
-     *
-     * @var array
-     */
-    protected $_allowedTypes;
-
-    /**
-     * @param \Magento\Framework\ObjectManager $objectManager
-     */
-    public function __construct(\Magento\Framework\ObjectManager $objectManager)
-    {
-        $this->_objectManager = $objectManager;
-        $this->_allowedTypes = array(
-            self::TYPE_DB,
-            self::TYPE_FILESYSTEM,
-            self::TYPE_SYSTEM_SNAPSHOT,
-            self::TYPE_MEDIA,
-            self::TYPE_SNAPSHOT_WITHOUT_MEDIA
-        );
-    }
-
-    /**
-     * Create new backup instance
-     *
-     * @param string $type
-     * @return \Magento\Framework\Backup\BackupInterface
-     * @throws \Magento\Framework\Exception
-     */
-    public function create($type)
-    {
-        if (!in_array($type, $this->_allowedTypes)) {
-            throw new \Magento\Framework\Exception('Current implementation not supported this type (' . $type . ') of backup.');
-        }
-        $class = 'Magento\Framework\Backup\\' . ucfirst($type);
-        return $this->_objectManager->create($class);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem.php b/downloader/lib/Magento/Framework/Backup/Filesystem.php
deleted file mode 100644
index 483f8386db3adc4c9d6d3b769a04f71b05a7cd5b..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Filesystem.php
+++ /dev/null
@@ -1,287 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup;
-
-/**
- * Class to work with filesystem backups
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Filesystem extends \Magento\Framework\Backup\AbstractBackup
-{
-    /**
-     * Paths that ignored when creating or rolling back snapshot
-     *
-     * @var array
-     */
-    protected $_ignorePaths = array();
-
-    /**
-     * Whether use ftp account for rollback procedure
-     *
-     * @var bool
-     */
-    protected $_useFtp = false;
-
-    /**
-     * Ftp host
-     *
-     * @var string
-     */
-    protected $_ftpHost;
-
-    /**
-     * Ftp username
-     *
-     * @var string
-     */
-    protected $_ftpUser;
-
-    /**
-     * Password to ftp account
-     *
-     * @var string
-     */
-    protected $_ftpPass;
-
-    /**
-     * Ftp path to Magento installation
-     *
-     * @var string
-     */
-    protected $_ftpPath;
-
-    /**
-     * Implementation Rollback functionality for Filesystem
-     *
-     * @throws \Magento\Framework\Exception
-     * @return void
-     */
-    public function rollback()
-    {
-        $this->_lastOperationSucceed = false;
-
-        set_time_limit(0);
-        ignore_user_abort(true);
-
-        $rollbackWorker = $this->_useFtp ? new \Magento\Framework\Backup\Filesystem\Rollback\Ftp(
-            $this
-        ) : new \Magento\Framework\Backup\Filesystem\Rollback\Fs(
-            $this
-        );
-        $rollbackWorker->run();
-
-        $this->_lastOperationSucceed = true;
-    }
-
-    /**
-     * Implementation Create Backup functionality for Filesystem
-     *
-     * @throws \Magento\Framework\Exception
-     * @return void
-     */
-    public function create()
-    {
-        set_time_limit(0);
-        ignore_user_abort(true);
-
-        $this->_lastOperationSucceed = false;
-
-        $this->_checkBackupsDir();
-
-        $fsHelper = new \Magento\Framework\Backup\Filesystem\Helper();
-
-        $filesInfo = $fsHelper->getInfo(
-            $this->getRootDir(),
-            \Magento\Framework\Backup\Filesystem\Helper::INFO_READABLE | \Magento\Framework\Backup\Filesystem\Helper::INFO_SIZE,
-            $this->getIgnorePaths()
-        );
-
-        if (!$filesInfo['readable']) {
-            throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions(
-                'Not enough permissions to read files for backup'
-            );
-        }
-
-        $freeSpace = disk_free_space($this->getBackupsDir());
-
-        if (2 * $filesInfo['size'] > $freeSpace) {
-            throw new \Magento\Framework\Backup\Exception\NotEnoughFreeSpace('Not enough free space to create backup');
-        }
-
-        $tarTmpPath = $this->_getTarTmpPath();
-
-        $tarPacker = new \Magento\Framework\Backup\Archive\Tar();
-        $tarPacker->setSkipFiles($this->getIgnorePaths())->pack($this->getRootDir(), $tarTmpPath, true);
-
-        if (!is_file($tarTmpPath) || filesize($tarTmpPath) == 0) {
-            throw new \Magento\Framework\Exception('Failed to create backup');
-        }
-
-        $backupPath = $this->getBackupPath();
-
-        $gzPacker = new \Magento\Framework\Archive\Gz();
-        $gzPacker->pack($tarTmpPath, $backupPath);
-
-        if (!is_file($backupPath) || filesize($backupPath) == 0) {
-            throw new \Magento\Framework\Exception('Failed to create backup');
-        }
-
-        @unlink($tarTmpPath);
-
-        $this->_lastOperationSucceed = true;
-    }
-
-    /**
-     * Force class to use ftp for rollback procedure
-     *
-     * @param string $host
-     * @param string $username
-     * @param string $password
-     * @param string $path
-     * @return \Magento\Framework\Backup\Filesystem
-     */
-    public function setUseFtp($host, $username, $password, $path)
-    {
-        $this->_useFtp = true;
-        $this->_ftpHost = $host;
-        $this->_ftpUser = $username;
-        $this->_ftpPass = $password;
-        $this->_ftpPath = $path;
-        return $this;
-    }
-
-    /**
-     * Get backup type
-     *
-     * @see \Magento\Framework\Backup\BackupInterface::getType()
-     * @return string
-     */
-    public function getType()
-    {
-        return 'filesystem';
-    }
-
-    /**
-     * Add path that should be ignoring when creating or rolling back backup
-     *
-     * @param string|array $paths
-     * @return \Magento\Framework\Backup\Filesystem
-     */
-    public function addIgnorePaths($paths)
-    {
-        if (is_string($paths)) {
-            if (!in_array($paths, $this->_ignorePaths)) {
-                $this->_ignorePaths[] = $paths;
-            }
-        } else if (is_array($paths)) {
-            foreach ($paths as $path) {
-                $this->addIgnorePaths($path);
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * Get paths that should be ignored while creating or rolling back backup procedure
-     *
-     * @return array
-     */
-    public function getIgnorePaths()
-    {
-        return $this->_ignorePaths;
-    }
-
-    /**
-     * Set directory where backups saved and add it to ignore paths
-     *
-     * @param string $backupsDir
-     * @return \Magento\Framework\Backup\Filesystem
-     * @see \Magento\Framework\Backup\AbstractBackup::setBackupsDir()
-     */
-    public function setBackupsDir($backupsDir)
-    {
-        parent::setBackupsDir($backupsDir);
-        $this->addIgnorePaths($backupsDir);
-        return $this;
-    }
-
-    /**
-     * Getter for $_ftpPath variable
-     *
-     * @return string
-     */
-    public function getFtpPath()
-    {
-        return $this->_ftpPath;
-    }
-
-    /**
-     * Get ftp connection string
-     *
-     * @return string
-     */
-    public function getFtpConnectString()
-    {
-        return 'ftp://' . $this->_ftpUser . ':' . $this->_ftpPass . '@' . $this->_ftpHost . $this->_ftpPath;
-    }
-
-    /**
-     * Check backups directory existence and whether it's writeable
-     *
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _checkBackupsDir()
-    {
-        $backupsDir = $this->getBackupsDir();
-
-        if (!is_dir($backupsDir)) {
-            $backupsDirParentDirectory = basename($backupsDir);
-
-            if (!is_writeable($backupsDirParentDirectory)) {
-                throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions('Cant create backups directory');
-            }
-
-            mkdir($backupsDir);
-            chmod($backupsDir, 0777);
-        }
-
-        if (!is_writable($backupsDir)) {
-            throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions('Backups directory is not writeable');
-        }
-    }
-
-    /**
-     * Generate tmp name for tarball
-     *
-     * @return string
-     */
-    protected function _getTarTmpPath()
-    {
-        $tmpName = '~tmp-' . microtime(true) . '.tar';
-        return $this->getBackupsDir() . '/' . $tmpName;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem/Helper.php b/downloader/lib/Magento/Framework/Backup/Filesystem/Helper.php
deleted file mode 100644
index e3f6d105c8dad8e45170583731ef5a8b50283c01..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Filesystem/Helper.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup\Filesystem;
-
-/**
- * Filesystem helper
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Helper
-{
-    /**
-     * Constant can be used in getInfo() function as second parameter.
-     * Check whether directory and all files/sub directories are writable
-     *
-     * @const int
-     */
-    const INFO_WRITABLE = 1;
-
-    /**
-     * Constant can be used in getInfo() function as second parameter.
-     * Check whether directory and all files/sub directories are readable
-     *
-     * @const int
-     */
-    const INFO_READABLE = 2;
-
-    /**
-     * Constant can be used in getInfo() function as second parameter.
-     * Get directory size
-     *
-     * @const int
-     */
-    const INFO_SIZE = 4;
-
-    /**
-     * Constant can be used in getInfo() function as second parameter.
-     * Combination of INFO_WRITABLE, INFO_READABLE, INFO_SIZE
-     *
-     * @const int
-     */
-    const INFO_ALL = 7;
-
-    /**
-     * Recursively delete $path
-     *
-     * @param string $path
-     * @param array $skipPaths
-     * @param bool $removeRoot
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    public function rm($path, $skipPaths = array(), $removeRoot = false)
-    {
-        $filesystemIterator = new \RecursiveIteratorIterator(
-            new \RecursiveDirectoryIterator($path),
-            \RecursiveIteratorIterator::CHILD_FIRST
-        );
-
-        $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter($filesystemIterator, $skipPaths);
-
-        foreach ($iterator as $item) {
-            $item->isDir() ? @rmdir($item->__toString()) : @unlink($item->__toString());
-        }
-
-        if ($removeRoot && is_dir($path)) {
-            @rmdir($path);
-        }
-    }
-
-    /**
-     * Get information (readable, writable, size) about $path
-     *
-     * @param string $path
-     * @param int $infoOptions
-     * @param array $skipFiles
-     * @return array
-     */
-    public function getInfo($path, $infoOptions = self::INFO_ALL, $skipFiles = array())
-    {
-        $info = array();
-        if ($infoOptions & self::INFO_READABLE) {
-            $info['readable'] = true;
-        }
-
-        if ($infoOptions & self::INFO_WRITABLE) {
-            $info['writable'] = true;
-        }
-
-        if ($infoOptions & self::INFO_SIZE) {
-            $info['size'] = 0;
-        }
-
-        $filesystemIterator = new \RecursiveIteratorIterator(
-            new \RecursiveDirectoryIterator($path),
-            \RecursiveIteratorIterator::CHILD_FIRST
-        );
-
-        $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter($filesystemIterator, $skipFiles);
-
-        foreach ($iterator as $item) {
-            if ($item->isLink()) {
-                continue;
-            }
-
-            if ($infoOptions & self::INFO_WRITABLE && !$item->isWritable()) {
-                $info['writable'] = false;
-            }
-
-            if ($infoOptions & self::INFO_READABLE && !$item->isReadable()) {
-                $info['readable'] = false;
-            }
-
-            if ($infoOptions & self::INFO_SIZE && !$item->isDir()) {
-                $info['size'] += $item->getSize();
-            }
-        }
-
-        return $info;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem/Iterator/File.php b/downloader/lib/Magento/Framework/Backup/Filesystem/Iterator/File.php
deleted file mode 100644
index bac79304c28f5435e8cf12d572d72281ae86b49e..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Filesystem/Iterator/File.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-
-/**
- * File lines iterator
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup\Filesystem\Iterator;
-
-class File extends \SplFileObject
-{
-    /**
-     * The statement that was last read during iteration
-     *
-     * @var string
-     */
-    protected $_currentStatement = '';
-
-    /**
-     * Return current sql statement
-     *
-     * @return string
-     */
-    public function current()
-    {
-        return $this->_currentStatement;
-    }
-
-    /**
-     * Iterate to next sql statement in file
-     *
-     * @return void
-     */
-    public function next()
-    {
-        $this->_currentStatement = '';
-        while (!$this->eof()) {
-            $line = $this->fgets();
-            if (strlen(trim($line))) {
-                $this->_currentStatement .= $line;
-                if ($this->_isLineLastInCommand($line)) {
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     * Return to first statement
-     *
-     * @return void
-     */
-    public function rewind()
-    {
-        parent::rewind();
-        $this->next();
-    }
-
-    /**
-     * Check whether provided string is comment
-     *
-     * @param string $line
-     * @return bool
-     */
-    protected function _isComment($line)
-    {
-        return $line[0] == '#' || substr($line, 0, 2) == '--';
-    }
-
-    /**
-     * Check is line a last in sql command
-     *
-     * @param string $line
-     * @return bool
-     */
-    protected function _isLineLastInCommand($line)
-    {
-        $cleanLine = trim($line);
-        $lineLength = strlen($cleanLine);
-
-        $returnResult = false;
-        if ($lineLength > 0) {
-            $lastSymbolIndex = $lineLength - 1;
-            if ($cleanLine[$lastSymbolIndex] == ';') {
-                $returnResult = true;
-            }
-        }
-
-        return $returnResult;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/Fs.php b/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/Fs.php
deleted file mode 100644
index 69baa51fd80a01722a202887ccdb9be38d7b3d1b..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/Fs.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup\Filesystem\Rollback;
-
-/**
- * Rollback worker for rolling back via local filesystem
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Fs extends \Magento\Framework\Backup\Filesystem\Rollback\AbstractRollback
-{
-    /**
-     * Files rollback implementation via local filesystem
-     *
-     * @see \Magento\Framework\Backup\Filesystem\Rollback\AbstractRollback::run()
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    public function run()
-    {
-        $snapshotPath = $this->_snapshot->getBackupPath();
-
-        if (!is_file($snapshotPath) || !is_readable($snapshotPath)) {
-            throw new \Magento\Framework\Backup\Exception\CantLoadSnapshot('Cant load snapshot archive');
-        }
-
-        $fsHelper = new \Magento\Framework\Backup\Filesystem\Helper();
-
-        $filesInfo = $fsHelper->getInfo(
-            $this->_snapshot->getRootDir(),
-            \Magento\Framework\Backup\Filesystem\Helper::INFO_WRITABLE,
-            $this->_snapshot->getIgnorePaths()
-        );
-
-        if (!$filesInfo['writable']) {
-            throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions(
-                'Unable to make rollback because not all files are writable'
-            );
-        }
-
-        $archiver = new \Magento\Framework\Archive();
-
-        /**
-         * we need these fake initializations because all magento's files in filesystem will be deleted and autoloader
-         * wont be able to load classes that we need for unpacking
-         */
-        new \Magento\Framework\Archive\Tar();
-        new \Magento\Framework\Archive\Gz();
-        new \Magento\Framework\Archive\Helper\File('');
-        new \Magento\Framework\Archive\Helper\File\Gz('');
-
-        $fsHelper->rm($this->_snapshot->getRootDir(), $this->_snapshot->getIgnorePaths());
-        $archiver->unpack($snapshotPath, $this->_snapshot->getRootDir());
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/Ftp.php b/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/Ftp.php
deleted file mode 100644
index 29225ea73b24e989f5667cd657dffc3af55ff4b6..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/Ftp.php
+++ /dev/null
@@ -1,211 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Backup\Filesystem\Rollback;
-
-/**
- * Rollback worker for rolling back via ftp
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Ftp extends \Magento\Framework\Backup\Filesystem\Rollback\AbstractRollback
-{
-    /**
-     * Ftp client
-     *
-     * @var \Magento\Framework\System\Ftp
-     */
-    protected $_ftpClient;
-
-    /**
-     * Files rollback implementation via ftp
-     *
-     * @return void
-     * @throws \Magento\Framework\Exception
-     * @see \Magento\Framework\Backup\Filesystem\Rollback\AbstractRollback::run()
-     */
-    public function run()
-    {
-        $snapshotPath = $this->_snapshot->getBackupPath();
-
-        if (!is_file($snapshotPath) || !is_readable($snapshotPath)) {
-            throw new \Magento\Framework\Backup\Exception\CantLoadSnapshot('Cant load snapshot archive');
-        }
-
-        $this->_initFtpClient();
-        $this->_validateFtp();
-
-        $tmpDir = $this->_createTmpDir();
-        $this->_unpackSnapshot($tmpDir);
-
-        $fsHelper = new \Magento\Framework\Backup\Filesystem\Helper();
-
-        $this->_cleanupFtp();
-        $this->_uploadBackupToFtp($tmpDir);
-
-        $fsHelper->rm($tmpDir, array(), true);
-    }
-
-    /**
-     * Initialize ftp client and connect to ftp
-     *
-     * @return void
-     * @throws \Magento\Framework\Backup\Exception\FtpConnectionFailed
-     */
-    protected function _initFtpClient()
-    {
-        try {
-            $this->_ftpClient = new \Magento\Framework\System\Ftp();
-            $this->_ftpClient->connect($this->_snapshot->getFtpConnectString());
-        } catch (\Exception $e) {
-            throw new \Magento\Framework\Backup\Exception\FtpConnectionFailed($e->getMessage());
-        }
-    }
-
-    /**
-     * Perform ftp validation. Check whether ftp account provided points to current magento installation
-     *
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _validateFtp()
-    {
-        $validationFilename = '~validation-' . microtime(true) . '.tmp';
-        $validationFilePath = $this->_snapshot->getBackupsDir() . '/' . $validationFilename;
-
-        $fh = @fopen($validationFilePath, 'w');
-        @fclose($fh);
-
-        if (!is_file($validationFilePath)) {
-            throw new \Magento\Framework\Exception('Unable to validate ftp account');
-        }
-
-        $rootDir = $this->_snapshot->getRootDir();
-        $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($rootDir, '', $validationFilePath);
-
-        $fileExistsOnFtp = $this->_ftpClient->fileExists($ftpPath);
-        @unlink($validationFilePath);
-
-        if (!$fileExistsOnFtp) {
-            throw new \Magento\Framework\Backup\Exception\FtpValidationFailed('Failed to validate ftp account');
-        }
-    }
-
-    /**
-     * Unpack snapshot
-     *
-     * @param string $tmpDir
-     * @return void
-     */
-    protected function _unpackSnapshot($tmpDir)
-    {
-        $snapshotPath = $this->_snapshot->getBackupPath();
-
-        $archiver = new \Magento\Framework\Archive();
-        $archiver->unpack($snapshotPath, $tmpDir);
-    }
-
-    /**
-     * @throws \Magento\Framework\Exception
-     * @return string
-     */
-    protected function _createTmpDir()
-    {
-        $tmpDir = $this->_snapshot->getBackupsDir() . '/~tmp-' . microtime(true);
-
-        $result = @mkdir($tmpDir);
-
-        if (false === $result) {
-            throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions('Failed to create directory ' . $tmpDir);
-        }
-
-        return $tmpDir;
-    }
-
-    /**
-     * Delete magento and all files from ftp
-     *
-     * @return void
-     */
-    protected function _cleanupFtp()
-    {
-        $rootDir = $this->_snapshot->getRootDir();
-
-        $filesystemIterator = new \RecursiveIteratorIterator(
-            new \RecursiveDirectoryIterator($rootDir),
-            \RecursiveIteratorIterator::CHILD_FIRST
-        );
-
-        $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter(
-            $filesystemIterator,
-            $this->_snapshot->getIgnorePaths()
-        );
-
-        foreach ($iterator as $item) {
-            $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($rootDir, '', $item->__toString());
-            $ftpPath = str_replace('\\', '/', $ftpPath);
-
-            $this->_ftpClient->delete($ftpPath);
-        }
-    }
-
-    /**
-     * Perform files rollback
-     *
-     * @param string $tmpDir
-     * @return void
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _uploadBackupToFtp($tmpDir)
-    {
-        $filesystemIterator = new \RecursiveIteratorIterator(
-            new \RecursiveDirectoryIterator($tmpDir),
-            \RecursiveIteratorIterator::SELF_FIRST
-        );
-
-        $iterator = new \Magento\Framework\Backup\Filesystem\Iterator\Filter(
-            $filesystemIterator,
-            $this->_snapshot->getIgnorePaths()
-        );
-
-        foreach ($filesystemIterator as $item) {
-            $ftpPath = $this->_snapshot->getFtpPath() . '/' . str_replace($tmpDir, '', $item->__toString());
-            $ftpPath = str_replace('\\', '/', $ftpPath);
-
-            if ($item->isLink()) {
-                continue;
-            }
-
-            if ($item->isDir()) {
-                $this->_ftpClient->mkdirRecursive($ftpPath);
-            } else {
-                $result = $this->_ftpClient->put($ftpPath, $item->__toString());
-                if (false === $result) {
-                    throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions(
-                        'Failed to upload file ' . $item->__toString() . ' to ftp'
-                    );
-                }
-            }
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Media.php b/downloader/lib/Magento/Framework/Backup/Media.php
deleted file mode 100644
index 369007ffa94f1c9a93e349c78f4dbeddd6506b41..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Media.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to work media folder and database backups
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup;
-
-class Media extends \Magento\Framework\Backup\Snapshot
-{
-    /**
-     * Implementation Rollback functionality for Media
-     *
-     * @throws \Magento\Framework\Exception
-     * @return bool
-     */
-    public function rollback()
-    {
-        $this->_prepareIgnoreList();
-        return parent::rollback();
-    }
-
-    /**
-     * Implementation Create Backup functionality for Media
-     *
-     * @throws \Magento\Framework\Exception
-     * @return bool
-     */
-    public function create()
-    {
-        $this->_prepareIgnoreList();
-        return parent::create();
-    }
-
-    /**
-     * Overlap getType
-     *
-     * @return string
-     * @see \Magento\Framework\Backup\BackupInterface::getType()
-     */
-    public function getType()
-    {
-        return 'media';
-    }
-
-    /**
-     * Add all folders and files except media and db backup to ignore list
-     *
-     * @return \Magento\Framework\Backup\Media
-     */
-    protected function _prepareIgnoreList()
-    {
-        $rootDir = $this->getRootDir();
-        $map = array(
-            $rootDir => array('media', 'var', 'pub'),
-            $rootDir . '/pub' => array('media'),
-            $rootDir . '/var' => array($this->getDbBackupFilename())
-        );
-
-        foreach ($map as $path => $whiteList) {
-            foreach (new \DirectoryIterator($path) as $item) {
-                $filename = $item->getFilename();
-                if (!$item->isDot() && !in_array($filename, $whiteList)) {
-                    $this->addIgnorePaths($item->getPathname());
-                }
-            }
-        }
-
-        return $this;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Backup/Snapshot.php b/downloader/lib/Magento/Framework/Backup/Snapshot.php
deleted file mode 100644
index 4ebbe52c18a13be632e436df641a3dc64b4c532b..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Backup/Snapshot.php
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to work with full filesystem and database backups
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup;
-
-class Snapshot extends \Magento\Framework\Backup\Filesystem
-{
-    /**
-     * Database backup manager
-     *
-     * @var \Magento\Framework\Backup\Db
-     */
-    protected $_dbBackupManager;
-
-    /**
-     * Filesystem instance
-     *
-     * @var \Magento\Framework\App\Filesystem
-     */
-    protected $_filesystem;
-
-    /**
-     * @var \Magento\Framework\Backup\Factory
-     */
-    protected $_backupFactory;
-
-    /**
-     * @param \Magento\Framework\App\Filesystem $filesystem
-     * @param Factory $backupFactory
-     */
-    public function __construct(\Magento\Framework\App\Filesystem $filesystem, \Magento\Framework\Backup\Factory $backupFactory)
-    {
-        $this->_filesystem = $filesystem;
-        $this->_backupFactory = $backupFactory;
-    }
-
-    /**
-     * Implementation Rollback functionality for Snapshot
-     *
-     * @throws \Exception
-     * @return bool
-     */
-    public function rollback()
-    {
-        $result = parent::rollback();
-
-        $this->_lastOperationSucceed = false;
-
-        try {
-            $this->_getDbBackupManager()->rollback();
-        } catch (\Exception $e) {
-            $this->_removeDbBackup();
-            throw $e;
-        }
-
-        $this->_removeDbBackup();
-        $this->_lastOperationSucceed = true;
-
-        return $result;
-    }
-
-    /**
-     * Implementation Create Backup functionality for Snapshot
-     *
-     * @throws \Exception
-     * @return bool
-     */
-    public function create()
-    {
-        $this->_getDbBackupManager()->create();
-
-        try {
-            $result = parent::create();
-        } catch (\Exception $e) {
-            $this->_removeDbBackup();
-            throw $e;
-        }
-
-        $this->_lastOperationSucceed = false;
-        $this->_removeDbBackup();
-        $this->_lastOperationSucceed = true;
-
-        return $result;
-    }
-
-    /**
-     * Overlap getType
-     *
-     * @return string
-     * @see \Magento\Framework\Backup\BackupInterface::getType()
-     */
-    public function getType()
-    {
-        return 'snapshot';
-    }
-
-    /**
-     * Create Db Instance
-     *
-     * @return \Magento\Framework\Backup\BackupInterface
-     */
-    protected function _createDbBackupInstance()
-    {
-        return $this->_backupFactory->create(
-            \Magento\Framework\Backup\Factory::TYPE_DB
-        )->setBackupExtension(
-            'gz'
-        )->setTime(
-            $this->getTime()
-        )->setBackupsDir(
-            $this->_filesystem->getPath(\Magento\Framework\App\Filesystem::VAR_DIR)
-        )->setResourceModel(
-            $this->getResourceModel()
-        );
-    }
-
-    /**
-     * Get database backup manager
-     *
-     * @return \Magento\Framework\Backup\Db
-     */
-    protected function _getDbBackupManager()
-    {
-        if (is_null($this->_dbBackupManager)) {
-            $this->_dbBackupManager = $this->_createDbBackupInstance();
-        }
-
-        return $this->_dbBackupManager;
-    }
-
-    /**
-     * Set Db backup manager
-     *
-     * @param \Magento\Framework\Backup\AbstractBackup $manager
-     * @return \Magento\Framework\Backup\Snapshot
-     */
-    public function setDbBackupManager(\Magento\Framework\Backup\AbstractBackup $manager)
-    {
-        $this->_dbBackupManager = $manager;
-        return $this;
-    }
-
-    /**
-     * Get Db Backup Filemane
-     *
-     * @return string
-     */
-    public function getDbBackupFilename()
-    {
-        return $this->_getDbBackupManager()->getBackupFilename();
-    }
-
-    /**
-     * Remove Db backup after added it to the snapshot
-     *
-     * @return \Magento\Framework\Backup\Snapshot
-     */
-    protected function _removeDbBackup()
-    {
-        @unlink($this->_getDbBackupManager()->getBackupPath());
-        return $this;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Channel/VO.php b/downloader/lib/Magento/Framework/Connect/Channel/VO.php
deleted file mode 100644
index 162ca8e6f4a54f13cc4b380b49dd0cc577b7cc30..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Channel/VO.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Channel;
-
-use Magento\Framework\Connect\Validator;
-
-class VO implements \Iterator
-{
-    /**
-     * @var Validator|null
-     */
-    private $_validator = null;
-
-    /**
-     * @var array
-     */
-    protected $properties = array('name' => '', 'uri' => '', 'summary' => '');
-
-    /**
-     * @return void
-     */
-    public function rewind()
-    {
-        reset($this->properties);
-    }
-
-    /**
-     * @return bool
-     */
-    public function valid()
-    {
-        return current($this->properties) !== false;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function key()
-    {
-        return key($this->properties);
-    }
-
-    /**
-     * @return mixed
-     */
-    public function current()
-    {
-        return current($this->properties);
-    }
-
-    /**
-     * @return void
-     */
-    public function next()
-    {
-        next($this->properties);
-    }
-
-    /**
-     * @param string $var
-     * @return null|string
-     */
-    public function __get($var)
-    {
-        if (isset($this->properties[$var])) {
-            return $this->properties[$var];
-        }
-        return null;
-    }
-
-    /**
-     * @param string $var
-     * @param string $value
-     * @return void
-     */
-    public function __set($var, $value)
-    {
-        if (is_string($value)) {
-            $value = trim($value);
-        }
-        if (isset($this->properties[$var])) {
-            if ($value === null) {
-                $value = '';
-            }
-            $this->properties[$var] = $value;
-        }
-    }
-
-    /**
-     * @return array
-     */
-    public function toArray()
-    {
-        return array('channel' => $this->properties);
-    }
-
-    /**
-     * @param array $arr
-     * @return void
-     */
-    public function fromArray(array $arr)
-    {
-        foreach ($arr as $k => $v) {
-            $this->{$k} = $v;
-        }
-    }
-
-    /**
-     * @return Validator|null
-     */
-    private function validator()
-    {
-        if (is_null($this->_validator)) {
-            $this->_validator = new Validator();
-        }
-        return $this->_validator;
-    }
-
-    /**
-     * Stub for validation result
-     *
-     * @return bool
-     */
-    public function validate()
-    {
-        $v = $this->validator();
-        if (!$v->validatePackageName($this->name)) {
-            return false;
-        }
-        return true;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command.php b/downloader/lib/Magento/Framework/Connect/Command.php
deleted file mode 100644
index cc7459877a9ccc24aab629a391b525dd6ead39ef..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command.php
+++ /dev/null
@@ -1,446 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Connect Command abstract class. It cannot instantiate directly
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Command
-{
-    /**
-     * All commands list
-     * @var array
-     */
-    protected static $_commandsAll = array();
-
-    /**
-     * Commands list hash (key=class)
-     * @var array
-     */
-    protected static $_commandsByClass = array();
-
-    /**
-     * Frontend object
-     * @var \Magento\Framework\Connect\Frontend
-     */
-    protected static $_frontend = null;
-
-    /**
-     * Connect Config instance
-     * @var \Magento\Framework\Connect\Config
-     */
-    protected static $_config = null;
-
-    /**
-     * Validator instance
-     *
-     * @var \Magento\Framework\Connect\Validator
-     */
-    protected static $_validator = null;
-
-    /**
-     * Rest instance
-     *
-     * @var \Magento\Framework\Connect\Rest
-     */
-    protected static $_rest = null;
-
-    /**
-     * Cache config instance
-     *
-     * @var \Magento\Framework\Connect\Singleconfig
-     */
-    protected static $_sconfig = null;
-
-    /**
-     * Called class name
-     *
-     * @var string
-     */
-    protected $_class;
-
-    /**
-     * Packager instance
-     *
-     * @var \Magento\Framework\Connect\Packager
-     */
-    protected static $_packager = null;
-
-    /**
-     * @var array
-     */
-    protected static $_return = array();
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $class = $this->_class = get_class($this);
-        if (__CLASS__ == $class) {
-            throw new \Exception("You shouldn't instantiate {$class} directly!");
-        }
-        $this->commandsInfo = self::$_commandsByClass[$class];
-    }
-
-    /**
-     * Get command info (static)
-     *
-     * @param string $name command name
-     * @return array|boolean
-     */
-    public static function commandInfo($name)
-    {
-        $name = strtolower($name);
-        if (!isset(self::$_commandsAll[$name])) {
-            return false;
-        }
-        return self::$_commandsAll[$name];
-    }
-
-    /**
-     * Get command info for current command object
-     *
-     * @param string $name
-     * @return array|boolean
-     */
-    public function getCommandInfo($name)
-    {
-        if (!isset(self::$_commandsByClass[$this->_class][$name])) {
-            return false;
-        }
-        return self::$_commandsByClass[$this->_class][$name];
-    }
-
-    /**
-     * Run command
-     *
-     * @param string $command
-     * @param string $options
-     * @param string $params
-     * @return mixed
-     * @throws \Exception If there's no needed method
-     */
-    public function run($command, $options, $params)
-    {
-        $data = $this->getCommandInfo($command);
-        $method = $data['function'];
-        if (!method_exists($this, $method)) {
-            throw new \Exception("{$method} does't exist in class " . $this->_class);
-        }
-        return $this->{$method}($command, $options, $params);
-    }
-
-    /**
-     * Static functions
-     */
-
-    /**
-     * Static
-     * @param string $commandName
-     * @return mixed
-     * @throws \UnexpectedValueException
-     */
-    public static function getInstance($commandName)
-    {
-        if (!isset(self::$_commandsAll[$commandName])) {
-            throw new \UnexpectedValueException("Cannot find command {$commandName}");
-        }
-        $currentCommand = self::$_commandsAll[$commandName];
-        return new $currentCommand['class']();
-    }
-
-    /**
-     * Cache config setter
-     *
-     * @param \Magento\Framework\Connect\Singleconfig $obj
-     * @return void
-     * @static
-     */
-    public static function setSconfig($obj)
-    {
-        self::$_sconfig = $obj;
-    }
-
-    /**
-     * Cache config getter
-     *
-     * @return \Magento\Framework\Connect\Singleconfig
-     */
-    public function getSconfig()
-    {
-        return self::$_sconfig;
-    }
-
-    /**
-     * Sets frontend object for all commands
-     *
-     * @param \Magento\Framework\Connect\Frontend $obj
-     * @return void
-     */
-    public static function setFrontendObject($obj)
-    {
-        self::$_frontend = $obj;
-    }
-
-    /**
-     * Set config object for all commands
-     *
-     * @param \Magento\Framework\Connect\Config $obj
-     * @return void
-     */
-    public static function setConfigObject($obj)
-    {
-        self::$_config = $obj;
-    }
-
-    /**
-     * Non-static getter for config
-     *
-     * @return \Magento\Framework\Connect\Config
-     */
-    public function config()
-    {
-        return self::$_config;
-    }
-
-    /**
-     * Non-static getter for UI
-     *
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function ui()
-    {
-        return self::$_frontend;
-    }
-
-    /**
-     * Get validator object
-     *
-     * @return \Magento\Framework\Connect\Validator
-     */
-    public function validator()
-    {
-        if (is_null(self::$_validator)) {
-            self::$_validator = new \Magento\Framework\Connect\Validator();
-        }
-        return self::$_validator;
-    }
-
-    /**
-     * Get rest object
-     *
-     * @return \Magento\Framework\Connect\Rest
-     */
-    public function rest()
-    {
-        if (is_null(self::$_rest)) {
-            self::$_rest = new \Magento\Framework\Connect\Rest(self::config()->protocol);
-        }
-        return self::$_rest;
-    }
-
-    /**
-     * Get commands list sorted
-     *
-     * @return array
-     */
-    public static function getCommands()
-    {
-        if (!count(self::$_commandsAll)) {
-            self::registerCommands();
-        }
-        ksort(self::$_commandsAll);
-        return self::$_commandsAll;
-    }
-
-    /**
-     * Get Getopt args from command definitions
-     * and parse them
-     *
-     * @param string $command
-     * @return void|array
-     */
-    public static function getGetoptArgs($command)
-    {
-        $commandInfo = self::commandInfo($command);
-        $short_args = '';
-        $long_args = array();
-        if (empty($commandInfo) || empty($commandInfo['options'])) {
-            return;
-        }
-        reset($commandInfo['options']);
-        while (list($option, $info) = each($commandInfo['options'])) {
-            $larg = $sarg = '';
-            if (isset($info['arg'])) {
-                if ($info['arg'][0] == '(') {
-                    $larg = '==';
-                    $sarg = '::';
-                } else {
-                    $larg = '=';
-                    $sarg = ':';
-                }
-            }
-            if (isset($info['shortopt'])) {
-                $short_args .= $info['shortopt'] . $sarg;
-            }
-            $long_args[] = $option . $larg;
-        }
-        return array($short_args, $long_args);
-    }
-
-    /**
-     * Try to register commands automatically
-     *
-     * @return void
-     */
-    public static function registerCommands()
-    {
-        $pathCommands = __DIR__ . '/' . basename(__FILE__, ".php");
-        $f = new \DirectoryIterator($pathCommands);
-        foreach ($f as $file) {
-            /** @var $file \DirectoryIterator */
-            if (!$file->isFile()) {
-                continue;
-            }
-            $pattern = preg_match("/(.*)_Header\.php/imsu", $file->getFilename(), $matches);
-            if (!$pattern) {
-                continue;
-            }
-            include $file->getPathname();
-            if (!isset($commands)) {
-                continue;
-            }
-            $class = __CLASS__ . "_" . $matches[1];
-            foreach ($commands as $k => $v) {
-                $commands[$k]['class'] = $class;
-                self::$_commandsAll[$k] = $commands[$k];
-            }
-            self::$_commandsByClass[$class] = $commands;
-        }
-    }
-
-    /**
-     * Add Error message
-     *
-     * @param string $command
-     * @param string $message
-     * @return null
-     */
-    public function doError($command, $message)
-    {
-        return $this->ui()->doError($command, $message);
-    }
-
-    /**
-     * Set command return
-     *
-     * @param string $key
-     * @param mixed $val
-     * @return void
-     */
-    public static function setReturn($key, $val)
-    {
-        self::$_return[$key] = $val;
-    }
-
-    /**
-     * Get command return
-     *
-     * @param string $key
-     * @param bool $clear
-     * @return array|null
-     */
-    public static function getReturn($key, $clear = true)
-    {
-        if (isset(self::$_return[$key])) {
-            $out = self::$_return[$key];
-            if ($clear) {
-                unset(self::$_return[$key]);
-            }
-            return $out;
-        }
-        return null;
-    }
-
-    /**
-     * Cleanup command params from empty strings
-     *
-     * @param array $params by reference
-     * @return void
-     */
-    public function cleanupParams(array &$params)
-    {
-        $newParams = array();
-        if (!count($params)) {
-            return;
-        }
-        foreach ($params as $v) {
-            if (is_string($v)) {
-                $v = trim($v);
-                if (!strlen($v)) {
-                    continue;
-                }
-            }
-            $newParams[] = $v;
-        }
-        $params = $newParams;
-    }
-
-    /**
-     * Splits first command argument: channel/package
-     * to two arguments if found in top of array
-     *
-     * @param array $params
-     * @return void
-     */
-    public function splitPackageArgs(array &$params)
-    {
-        if (!count($params) || !isset($params[0])) {
-            return;
-        }
-        if ($this->validator()->validateUrl($params[0])) {
-            return;
-        }
-        if (preg_match("@([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)@ims", $params[0], $subs)) {
-            $params[0] = $subs[2];
-            array_unshift($params, $subs[1]);
-        }
-    }
-
-    /**
-     * Get packager instance
-     *
-     * @return \Magento\Framework\Connect\Packager
-     */
-    public function getPackager()
-    {
-        if (!self::$_packager) {
-            self::$_packager = new \Magento\Framework\Connect\Packager();
-        }
-        return self::$_packager;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Channels.php b/downloader/lib/Magento/Framework/Connect/Command/Channels.php
deleted file mode 100644
index fd5e95174de9726d4415db16fca98decd439a438..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Channels.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Channels extends \Magento\Framework\Connect\Command
-{
-    /**
-     * List available channels
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doList($command, $options, $params)
-    {
-
-        try {
-            $title = "Available channels:";
-            $aliasT = "Available aliases:";
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $data = $cache->getData();
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-                $data = $cache->getData();
-            }
-            $out = array($command => array('data' => $data, 'title' => $title, 'title_aliases' => $aliasT));
-            $this->ui()->output($out);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Channel-delete callback method
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doDelete($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) != 1) {
-                throw new \Exception("Parameters count should be equal to 1");
-            }
-            $packager = $this->getPackager();
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $cache->deleteChannel($params[0]);
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            } else {
-                $config = $this->config();
-                $cache = $this->getSconfig();
-                $cache->deleteChannel($params[0]);
-            }
-            $this->ui()->output("Successfully deleted");
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Channel-add callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doAdd($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) != 1) {
-                throw new \Exception("Parameters count should be equal to 1");
-            }
-            $url = $params[0];
-            $rest = $this->rest();
-            $rest->setChannel($url);
-            $data = $rest->getChannelInfo();
-            $data->url = $url;
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $cache->addChannel($data->name, $url);
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-                $cache->addChannel($data->name, $url);
-            }
-
-            $this->ui()->output("Successfully added: " . $url);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Get information about given channel callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doInfo($command, $options, $params)
-    {
-    }
-
-    /**
-     * Channel-alias
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doAlias($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) != 2) {
-                throw new \Exception("Parameters count should be equal to 2");
-            }
-
-            $packager = $this->getPackager();
-            $chanUrl = $params[0];
-            $alias = $params[1];
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $cache->addChannelAlias($chanUrl, $alias);
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-                $cache->addChannelAlias($chanUrl, $alias);
-            }
-            $this->ui()->output("Successfully added: " . $alias);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doLogin($command, $options, $params)
-    {
-    }
-
-    /**
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doLogout($command, $options, $params)
-    {
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Channels_Header.php b/downloader/lib/Magento/Framework/Connect/Command/Channels_Header.php
deleted file mode 100644
index 3e119c714d05f0a050a7987877867a88d663aec3..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Channels_Header.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'list-channels' => array(
-        'summary' => 'List Available Channels',
-        'function' => 'doList',
-        'shortcut' => 'lc',
-        'options' => array(),
-        'doc' => '
-List all available channels for installation.
-'
-    ),
-    'channel-delete' => array(
-        'summary' => 'Remove a Channel From the List',
-        'function' => 'doDelete',
-        'shortcut' => 'cde',
-        'options' => array(),
-        'doc' => '<channel name>
-Delete a channel from the registry.  You may not
-remove any channel that has installed packages.
-'
-    ),
-    'channel-add' => array(
-        'summary' => 'Add a Channel',
-        'function' => 'doAdd',
-        'shortcut' => 'ca',
-        'options' => array(),
-        'doc' => '<channel.xml>
-Add a private channel to the channel list.  Note that all
-public channels should be synced using "update-channels".
-Parameter may be either a local file or remote URL to a
-channel.xml.
-'
-    ),
-    'channel-info' => array(
-        'summary' => 'Retrieve Information on a Channel',
-        'function' => 'doInfo',
-        'shortcut' => 'ci',
-        'options' => array(),
-        'doc' => '<package>
-List the files in an installed package.
-'
-    ),
-    'channel-alias' => array(
-        'summary' => 'Specify an alias to a channel name',
-        'function' => 'doAlias',
-        'shortcut' => 'cha',
-        'options' => array(),
-        'doc' => '<channel> <alias>
-Specify a specific alias to use for a channel name.
-The alias may not be an existing channel name or
-alias.
-'
-    ),
-    'channel-login' => array(
-        'summary' => 'Connects and authenticates to remote channel server',
-        'shortcut' => 'cli',
-        'function' => 'doLogin',
-        'options' => array(),
-        'doc' => '<channel name>
-Log in to a remote channel server.  If <channel name> is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first.  The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems).  After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.'
-    ),
-    'channel-logout' => array(
-        'summary' => 'Logs out from the remote channel server',
-        'shortcut' => 'clo',
-        'function' => 'doLogout',
-        'options' => array(),
-        'doc' => '<channel name>
-Logs out from a remote channel server.  If <channel name> is not supplied,
-the default channel is used. This command does not actually connect to the
-remote server, it only deletes the stored username and password from your user
-configuration.'
-    )
-);
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Config.php b/downloader/lib/Magento/Framework/Connect/Command/Config.php
deleted file mode 100644
index 2a244b4e94d474efedad3034c2a248648c5b9332..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Config.php
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Configuration command callbacks
- *
- * @throws \Exception
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect\Command;
-
-class Config extends \Magento\Framework\Connect\Command
-{
-    /**
-     * Parameters constants
-     */
-    const PARAM_KEY = 0;
-
-    const PARAM_VAL = 1;
-
-    /**
-     * Show config variable
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doConfigShow($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            $values = array();
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-            foreach ($config as $k => $v) {
-                $values[$k] = $v;
-            }
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            $data = array($command => array('data' => $values));
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Set config variable
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doConfigSet($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            if (count($params) < 2) {
-                throw new \Exception("Parameters count should be >= 2");
-            }
-            $key = strtolower($params[self::PARAM_KEY]);
-            $val = strval($params[self::PARAM_VAL]);
-            $packager = $this->getPackager();
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if (!$ftp) {
-                $config = $this->config();
-                $ftp = $config->remote_config;
-            }
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            }
-
-            if (!$config->hasKey($key)) {
-                throw new \Exception("No such config variable: {$key}!");
-            }
-            if (!$config->validate($key, $val)) {
-                $possible = $this->config()->possible($key);
-                $type = $this->config()->type($key);
-                $errString = "Invalid value specified for {$key}!";
-                throw new \Exception($errString);
-            }
-            if ($ftp) {
-                $packager->writeToRemoteConfig($config, $ftpObj);
-            }
-            $this->config()->{$key} = $val;
-            $this->ui()->output('Success');
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Get config var
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doConfigGet($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            if (count($params) < 1) {
-                throw new \Exception("Parameters count should be >= 1");
-            }
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-            $key = strtolower($params[self::PARAM_KEY]);
-            if (!$config->hasKey($key)) {
-                throw new \Exception("No such config variable '{$key}'!");
-            }
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            $this->ui()->output($config->{$key});
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Config help
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doConfigHelp($command, $options, $params)
-    {
-        try {
-            $this->cleanupParams($params);
-            if (count($params) < 1) {
-                throw new \Exception("Parameters count should be >= 1");
-            }
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-
-            $key = strtolower($params[self::PARAM_KEY]);
-            if (!$this->config()->hasKey($key)) {
-                throw new \Exception("No such config variable '{$key}'!");
-            }
-
-            $possible = $config->possible($key);
-            $type = $config->type($key);
-            $doc = $config->doc($key);
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            $data = array();
-            $data[$command]['data'] = array(
-                'name' => array('Variable name', $key),
-                'type' => array('Value type', $type),
-                'possible' => array('Possible values', $possible),
-                'doc' => $doc
-            );
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Config_Header.php b/downloader/lib/Magento/Framework/Connect/Command/Config_Header.php
deleted file mode 100644
index 2d6892ade0d71801985d22c493559f9de131302d..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Config_Header.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'config-show' => array(
-        'summary' => 'Show All Settings',
-        'function' => 'doConfigShow',
-        'shortcut' => 'csh',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'show configuration variables for another channel',
-                'arg' => 'CHAN'
-            )
-        ),
-        'doc' => '[layer]
-Displays all configuration values.  An optional argument
-may be used to tell which configuration layer to display.  Valid
-configuration layers are "user", "system" and "default". To display
-configurations for different channels, set the default_channel
-configuration variable and run config-show again.
-'
-    ),
-    'config-get' => array(
-        'summary' => 'Show One Setting',
-        'function' => 'doConfigGet',
-        'shortcut' => 'cg',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'show configuration variables for another channel',
-                'arg' => 'CHAN'
-            )
-        ),
-        'doc' => '<parameter> [layer]
-Displays the value of one configuration parameter.  The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in.  Valid configuration
-layers are "user", "system" and "default".  If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified.  The configuration value will be retrieved for the channel
-specified by the default_channel configuration variable.
-'
-    ),
-    'config-set' => array(
-        'summary' => 'Change Setting',
-        'function' => 'doConfigSet',
-        'shortcut' => 'cs',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'show configuration variables for another channel',
-                'arg' => 'CHAN'
-            )
-        ),
-        'doc' => '<parameter> <value> [layer]
-Sets the value of one configuration parameter.  The first argument is
-the name of the parameter, the second argument is the new value.  Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense.  An optional
-third argument may be used to specify in which layer to set the
-configuration parameter.  The default layer is "user".  The
-configuration value will be set for the current channel, which
-is controlled by the default_channel configuration variable.
-'
-    ),
-    'config-help' => array(
-        'summary' => 'Show Information About Setting',
-        'function' => 'doConfigHelp',
-        'shortcut' => 'ch',
-        'options' => array(),
-        'doc' => '[parameter]
-Displays help for a configuration parameter.  Without arguments it
-displays help for all configuration parameters.
-'
-    )
-);
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Install.php b/downloader/lib/Magento/Framework/Connect/Command/Install.php
deleted file mode 100644
index 9a2197e25f0539408e2b008b0c8b2948e2c1b6a6..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Install.php
+++ /dev/null
@@ -1,591 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Install extends \Magento\Framework\Connect\Command
-{
-    /**
-     * Install action callback
-     *
-     * @throws \Exception
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @param array $objects
-     * @return array|null
-     */
-    public function doInstall($command, $options, $params, $objects = array())
-    {
-        $this->cleanupParams($params);
-
-        $installFileMode = $command === 'install-file';
-
-        /** @var $ftpObj \Magento\Framework\Connect\Ftp */
-        $ftpObj = null;
-        $ftp = empty($options['ftp']) ? false : $options['ftp'];
-        /** @var $packager \Magento\Framework\Connect\Packager */
-        $packager = $this->getPackager();
-        /** @var $cache \Magento\Framework\Connect\Singleconfig */
-        /** @var $config \Magento\Framework\Connect\Config */
-        if ($ftp) {
-            list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-        } else {
-            $cache = $this->getSconfig();
-            $config = $this->config();
-        }
-
-        try {
-            $forceMode = isset($options['force']);
-            $upgradeAllMode = $command == 'upgrade-all';
-            $upgradeMode = $command == 'upgrade' || $command == 'upgrade-all';
-            $noFilesInstall = isset($options['nofiles']);
-            $withDepsMode = !isset($options['nodeps']);
-            $ignoreModifiedMode = true || !isset($options['ignorelocalmodification']);
-            $clearInstallMode = $command == 'install' && !$forceMode;
-            $installAll = isset($options['install_all']);
-            $channelAuth = isset($options['auth']) ? $options['auth'] : array();
-
-            $rest = $this->rest();
-            if (empty($config->magento_root)) {
-                $config->magento_root = dirname(dirname($_SERVER['SCRIPT_FILENAME']));
-            }
-            chdir($config->magento_root);
-            $dirCache = '/' . $config->downloader_path . '/' . \Magento\Framework\Connect\Config::DEFAULT_CACHE_PATH;
-            $dirTmp = '/' . \Magento\Framework\Connect\Package\Reader::PATH_TO_TEMPORARY_DIRECTORY;
-            $dirMedia = '/media';
-            $isWritable = true;
-            if ($ftp) {
-                $cwd = $ftpObj->getcwd();
-                $ftpObj->mkdirRecursive($cwd . $dirCache, 0777);
-                $ftpObj->chdir($cwd);
-                $ftpObj->mkdirRecursive($cwd . $dirTmp, 0777);
-                $ftpObj->chdir($cwd);
-                $ftpObj->mkdirRecursive($cwd . $dirMedia, 0777);
-                $ftpObj->chdir($cwd);
-                $err = "Please check for sufficient ftp write file permissions.";
-            } else {
-                @mkdir($config->magento_root . $dirCache, 0777, true);
-                @mkdir($config->magento_root . $dirTmp, 0777, true);
-                @mkdir($config->magento_root . $dirMedia, 0777, true);
-                $isWritable = is_writable(
-                    $config->magento_root
-                ) && is_writable(
-                    $config->magento_root . '/' . $config->downloader_path
-                ) && is_writable(
-                    $config->magento_root . $dirCache
-                ) && is_writable(
-                    $config->magento_root . $dirTmp
-                ) && is_writable(
-                    $config->magento_root . $dirMedia
-                );
-                $err = "Please check for sufficient write file permissions.";
-            }
-            $isWritable = $isWritable && is_writable(
-                $config->magento_root . $dirMedia
-            ) && is_writable(
-                $config->magento_root . $dirCache
-            ) && is_writable(
-                $config->magento_root . $dirTmp
-            );
-            if (!$isWritable) {
-                $this->doError($command, $err);
-                throw new \Exception(
-                    'Your Magento folder does not have sufficient write permissions, which downloader requires.'
-                );
-            }
-            if (!empty($channelAuth)) {
-                $rest->getLoader()->setCredentials($channelAuth['username'], $channelAuth['password']);
-            }
-
-            if ($installFileMode) {
-                if (count($params) < 1) {
-                    throw new \Exception("Argument should be: filename");
-                }
-                $filename = $params[0];
-                if (!@file_exists($filename)) {
-                    throw new \Exception("File '{$filename}' not found");
-                }
-                if (!@is_readable($filename)) {
-                    throw new \Exception("File '{$filename}' is not readable");
-                }
-
-                $package = new \Magento\Framework\Connect\Package($filename);
-                $package->setConfig($config);
-                $package->validate();
-                $errors = $package->getErrors();
-                if (count($errors)) {
-                    throw new \Exception("Package file is invalid\n" . implode("\n", $errors));
-                }
-
-                $pChan = $package->getChannel();
-                $pName = $package->getName();
-                $pVer = $package->getVersion();
-
-                if (!($cache->isChannelName($pChan) || $cache->isChannelAlias($pChan))) {
-                    throw new \Exception(
-                        "The '{$pChan}' channel is not installed. Please use the MAGE shell " .
-                        "script to install the '{$pChan}' channel."
-                    );
-                }
-
-                $conflicts = $cache->hasConflicts($pChan, $pName, $pVer);
-
-                if (false !== $conflicts) {
-                    $conflicts = implode(", ", $conflicts);
-                    if ($forceMode) {
-                        $this->doError($command, "Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
-                    } else {
-                        throw new \Exception("Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
-                    }
-                }
-
-                $conflicts = $package->checkPhpDependencies();
-                if (true !== $conflicts) {
-                    $conflicts = implode(",", $conflicts);
-                    $err = "Package {$pChan}/{$pName} {$pVer} depends on PHP extensions: " . $conflicts;
-                    if ($forceMode) {
-                        $this->doError($command, $err);
-                    } else {
-                        throw new \Exception($err);
-                    }
-                }
-
-                $conflicts = $package->checkPhpVersion();
-                if (true !== $conflicts) {
-                    $err = "Package {$pChan}/{$pName} {$pVer}: " . $conflicts;
-                    if ($forceMode) {
-                        $this->doError($command, $err);
-                    } else {
-                        throw new \Exception($err);
-                    }
-                }
-
-                if (!$noFilesInstall) {
-                    if ($ftp) {
-                        $packager->processInstallPackageFtp($package, $filename, $config, $ftpObj);
-                    } else {
-                        $packager->processInstallPackage($package, $filename, $config);
-                    }
-                }
-                $cache->addPackage($package);
-                $installedDeps = array();
-                $installedDepsAssoc = array();
-                $installedDepsAssoc[] = array('channel' => $pChan, 'name' => $pName, 'version' => $pVer);
-                $installedDeps[] = array($pChan, $pName, $pVer);
-
-                $title = isset($options['title']) ? $options['title'] : "Package installed: ";
-                $out = array(
-                    $command => array('data' => $installedDeps, 'assoc' => $installedDepsAssoc, 'title' => $title)
-                );
-
-                if ($ftp) {
-                    $packager->writeToRemoteCache($cache, $ftpObj);
-                    @unlink($config->getFilename());
-                }
-
-                $this->ui()->output($out);
-                return $out[$command]['data'];
-            }
-
-            if (!$upgradeAllMode) {
-                if (count($params) < 2) {
-                    throw new \Exception("Argument should be: channelName packageName");
-                }
-                $channel = $params[0];
-                $package = $params[1];
-                $argVersionMax = isset($params[2]) ? $params[2] : false;
-                $argVersionMin = isset($params[3]) ? $params[3] : false;
-
-                $cache->checkChannel($channel, $config, $rest);
-                $channelName = $cache->chanName($channel);
-                $this->ui()->output("Checking dependencies of packages");
-                $packagesToInstall = $packager->getDependenciesList(
-                    $channelName,
-                    $package,
-                    $cache,
-                    $config,
-                    $argVersionMax,
-                    $argVersionMin,
-                    $withDepsMode,
-                    false,
-                    $rest
-                );
-                /*
-                 * process 'failed' results
-                 */
-                if (count($packagesToInstall['failed'])) {
-                    $showError = !count($packagesToInstall['result']);
-                    foreach ($packagesToInstall['failed'] as $failed) {
-                        $msg = "Package {$failed['channel']}/{$failed['name']} failed: " . $failed['reason'];
-                        if ($showError) {
-                            $this->doError($command, $msg);
-                        } else {
-                            $this->ui()->output($msg);
-                        }
-                    }
-                }
-                $packagesToInstall = $packagesToInstall['result'];
-            } else {
-                if (empty($params[0])) {
-                    $channels = $cache->getChannelNames();
-                } else {
-                    $channel = $params[0];
-                    if (!$cache->isChannel($channel)) {
-                        throw new \Exception("'{$channel}' is not existant channel name / valid uri");
-                    }
-                    $channels = $cache->chanName($channel);
-                }
-                $packagesToInstall = array();
-                $neededToUpgrade = $packager->getUpgradesList($channels, $cache, $config, $rest);
-                foreach ($neededToUpgrade as $chan => $packages) {
-                    foreach ($packages as $name => $data) {
-                        $versionTo = $data['to'];
-                        $tmp = $packager->getDependenciesList(
-                            $chan,
-                            $name,
-                            $cache,
-                            $config,
-                            $versionTo,
-                            $versionTo,
-                            $withDepsMode,
-                            false,
-                            $rest
-                        );
-                        if (count($tmp['result'])) {
-                            $packagesToInstall = array_merge($packagesToInstall, $tmp['result']);
-                        }
-                    }
-                }
-            }
-
-            /**
-             * Make installation
-             */
-            $installedDeps = array();
-            $installedDepsAssoc = array();
-
-            foreach ($packagesToInstall as $package) {
-                try {
-                    $pName = $package['name'];
-                    $pChan = $package['channel'];
-                    $pVer = $package['downloaded_version'];
-                    $pInstallState = $package['install_state'];
-                    $rest->setChannel($cache->chanUrl($pChan));
-
-                    /**
-                     * Skip existing packages
-                     */
-                    if ($upgradeMode && $cache->hasPackage(
-                        $pChan,
-                        $pName,
-                        $pVer,
-                        $pVer
-                    ) || 'already_installed' == $pInstallState && !$forceMode
-                    ) {
-                        $this->ui()->output("Already installed: {$pChan}/{$pName} {$pVer}, skipping");
-                        continue;
-                    }
-
-                    if ('incompartible' == $pInstallState) {
-                        $this->ui()->output(
-                            "Package incompartible with installed Magento: {$pChan}/{$pName} {$pVer}, skipping"
-                        );
-                        continue;
-                    }
-
-                    $conflicts = $cache->hasConflicts($pChan, $pName, $pVer);
-
-                    if (false !== $conflicts) {
-                        $conflicts = implode(", ", $conflicts);
-                        if ($forceMode) {
-                            $this->doError(
-                                $command,
-                                "Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts
-                            );
-                        } else {
-                            throw new \Exception("Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
-                        }
-                    }
-
-                    /**
-                     * Modifications
-                     */
-                    if (($upgradeMode || $pInstallState == 'upgrade') && !$ignoreModifiedMode) {
-                        if ($ftp) {
-                            $modifications = $packager->getRemoteModifiedFiles($pChan, $pName, $cache, $config, $ftp);
-                        } else {
-                            $modifications = $packager->getLocalModifiedFiles($pChan, $pName, $cache, $config);
-                        }
-                        if (count($modifications) > 0) {
-                            $this->ui()->output('Changed locally: ');
-                            foreach ($modifications as $row) {
-                                if (!$ftp) {
-                                    $this->ui()->output($config->magento_root . '/' . $row);
-                                } else {
-                                    $this->ui()->output($row);
-                                }
-                            }
-                        }
-                    }
-
-                    if ($ftp) {
-                        $cwd = $ftpObj->getcwd();
-                        $dir = $cwd .
-                            '/' .
-                            $config->downloader_path .
-                            '/' .
-                            \Magento\Framework\Connect\Config::DEFAULT_CACHE_PATH .
-                            '/' .
-                            trim(
-                                $pChan,
-                                "\\/"
-                            );
-                        $ftpObj->mkdirRecursive($dir, 0777);
-                        $ftpObj->chdir($cwd);
-                    } else {
-                        $dir = $config->getChannelCacheDir($pChan);
-                        @mkdir($dir, 0777, true);
-                    }
-                    $dir = $config->getChannelCacheDir($pChan);
-                    $packageFileName = $pName . "-" . $pVer . ".tgz";
-                    $file = $dir . '/' . $packageFileName;
-                    if (!@file_exists($file)) {
-                        $this->ui()->output("Starting to download {$packageFileName} ...");
-                        $rest->downloadPackageFileOfRelease($pName, $pVer, $file);
-                        $this->ui()->output(sprintf("...done: %s bytes", number_format(filesize($file))));
-                    }
-
-                    /**
-                     * Remove old version package before install new
-                     */
-                    if ($cache->hasPackage($pChan, $pName)) {
-                        if ($ftp) {
-                            $packager->processUninstallPackageFtp($pChan, $pName, $cache, $ftpObj);
-                        } else {
-                            $packager->processUninstallPackage($pChan, $pName, $cache, $config);
-                        }
-                        $cache->deletePackage($pChan, $pName);
-                    }
-
-                    $package = new \Magento\Framework\Connect\Package($file);
-                    if ($clearInstallMode && $pInstallState != 'upgrade' && !$installAll) {
-                        $this->validator()->validateContents($package->getContents(), $config);
-                        $errors = $this->validator()->getErrors();
-                        if (count($errors)) {
-                            throw new \Exception("Package '{$pName}' is invalid\n" . implode("\n", $errors));
-                        }
-                    }
-
-                    $conflicts = $package->checkPhpDependencies();
-                    if (true !== $conflicts) {
-                        $conflicts = implode(",", $conflicts);
-                        $err = "Package {$pChan}/{$pName} {$pVer} depends on PHP extensions: " . $conflicts;
-                        if ($forceMode) {
-                            $this->doError($command, $err);
-                        } else {
-                            throw new \Exception($err);
-                        }
-                    }
-
-                    $conflicts = $package->checkPhpVersion();
-                    if (true !== $conflicts) {
-                        $err = "Package {$pChan}/{$pName} {$pVer}: " . $conflicts;
-                        if ($forceMode) {
-                            $this->doError($command, $err);
-                        } else {
-                            throw new \Exception($err);
-                        }
-                    }
-
-                    if (!$noFilesInstall) {
-                        $this->ui()->output("Installing package {$pChan}/{$pName} {$pVer}");
-                        if ($ftp) {
-                            $packager->processInstallPackageFtp($package, $file, $config, $ftpObj);
-                        } else {
-                            $packager->processInstallPackage($package, $file, $config);
-                        }
-                        $this->ui()->output("Package {$pChan}/{$pName} {$pVer} installed successfully");
-                    }
-                    $cache->addPackage($package);
-
-                    $installedDepsAssoc[] = array('channel' => $pChan, 'name' => $pName, 'version' => $pVer);
-                    $installedDeps[] = array($pChan, $pName, $pVer);
-                } catch (\Exception $e) {
-                    $this->doError($command, $e->getMessage());
-                }
-            }
-
-            $title = isset($options['title']) ? $options['title'] : "Package installed: ";
-            $out = array(
-                $command => array('data' => $installedDeps, 'assoc' => $installedDepsAssoc, 'title' => $title)
-            );
-
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-
-            $this->ui()->output($out);
-            return $out[$command]['data'];
-        } catch (\Exception $e) {
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Upgrade action callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return array|null
-     */
-    public function doUpgrade($command, $options, $params)
-    {
-        $options['title'] = "Package upgraded: ";
-        return $this->doInstall($command, $options, $params);
-    }
-
-    /**
-     * Updgrade action callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return array|null
-     */
-    public function doUpgradeAll($command, $options, $params)
-    {
-        $options['title'] = "Package upgraded: ";
-        return $this->doInstall($command, $options, $params);
-    }
-
-    /**
-     * Uninstall package callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return array|null
-     */
-    public function doUninstall($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            if (count($params) != 2) {
-                throw new \Exception("Argument count should be = 2");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-            /** @var $packager \Magento\Framework\Connect\Packager */
-            $packager = $this->getPackager();
-            $withDepsMode = !isset($options['nodeps']) ? false : (bool)$options['nodeps'];
-            $forceMode = isset($options['force']);
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            /** @var $cache \Magento\Framework\Connect\Singleconfig */
-            /** @var $config \Magento\Framework\Connect\Config */
-            /** @var $ftpObj \Magento\Framework\Connect\Ftp */
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            $channel = $cache->chanName($channel);
-            if (!$cache->hasPackage($channel, $package)) {
-                throw new \Exception("Package is not installed");
-            }
-
-            $deletedPackages = array();
-            $list = $packager->getUninstallList($channel, $package, $cache, $config, $withDepsMode);
-            foreach ($list['list'] as $packageData) {
-                try {
-                    $reqd = $cache->requiredByOtherPackages(
-                        $packageData['channel'],
-                        $packageData['name'],
-                        $list['list']
-                    );
-                    if (count($reqd)) {
-                        $errMessage = "{$packageData['channel']}/{$packageData['name']} " .
-                            "{$packageData['version']} is required by: ";
-                        $t = array();
-                        foreach ($reqd as $r) {
-                            $t[] = $r['channel'] . "/" . $r['name'] . " " . $r['version'];
-                        }
-                        $errMessage .= implode(", ", $t);
-                        if ($forceMode) {
-                            $this->ui()->output("Warning: " . $errMessage);
-                        } else {
-                            throw new \Exception($errMessage);
-                        }
-                    }
-                } catch (\Exception $e) {
-                    if ($forceMode) {
-                        $this->doError($command, $e->getMessage());
-                    } else {
-                        throw new \Exception($e->getMessage());
-                    }
-                }
-            }
-            foreach ($list['list'] as $packageData) {
-                try {
-                    list($chan, $pack) = array($packageData['channel'], $packageData['name']);
-                    $packageName = $packageData['channel'] . "/" . $packageData['name'];
-                    $this->ui()->output("Starting to uninstall {$packageName} ");
-                    if ($ftp) {
-                        $packager->processUninstallPackageFtp($chan, $pack, $cache, $ftpObj);
-                    } else {
-                        $packager->processUninstallPackage($chan, $pack, $cache, $config);
-                    }
-                    $cache->deletePackage($chan, $pack);
-                    $deletedPackages[] = array($chan, $pack);
-                    $this->ui()->output("Package {$packageName} uninstalled");
-                } catch (\Exception $e) {
-                    if ($forceMode) {
-                        $this->doError($command, $e->getMessage());
-                    } else {
-                        throw new \Exception($e->getMessage());
-                    }
-                }
-            }
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-            $out = array($command => array('data' => $deletedPackages, 'title' => 'Package deleted: '));
-            $this->ui()->output($out);
-            return $out[$command]['data'];
-        } catch (\Exception $e) {
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Install_Header.php b/downloader/lib/Magento/Framework/Connect/Command/Install_Header.php
deleted file mode 100644
index da341457f642546ef9a5a8d8c4370caaf17c1944..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Install_Header.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'install-file' => array(
-        'summary' => 'Install Package Archive File',
-        'function' => 'doInstall',
-        'shortcut' => 'if',
-        'options' => array(),
-        'doc' => ''
-    ),
-    'install' => array(
-        'summary' => 'Install Package',
-        'function' => 'doInstall',
-        'shortcut' => 'i',
-        'options' => array(
-            'force' => array('shortopt' => 'f', 'doc' => 'will overwrite newer installed packages'),
-            'loose' => array('shortopt' => 'l', 'doc' => 'do not check for recommended dependency version'),
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, install anyway'),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'alldeps' => array('shortopt' => 'a', 'doc' => 'install all required and optional dependencies'),
-            'pretend' => array('shortopt' => 'p', 'doc' => 'Only list the packages that would be downloaded'),
-            'ftp=' => array('shortopt' => 'r=', 'doc' => 'Remote side FTP connect string')
-        ),
-        'doc' => '[channel/]<package> ...
-Installs one or more PEAR packages.  You can specify a package to
-install in four ways:
-
-"Package-1.0.tgz" : installs from a local file
-
-"http://example.com/Package-1.0.tgz" : installs from
-anywhere on the net.
-
-"package.xml" : installs the package described in
-package.xml.  Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-"Package[-version/state][.tar]" : queries your default channel\'s server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-To retrieve Package version 1.1, use "Package-1.1," to retrieve
-Package state beta, use "Package-beta."  To retrieve an uncompressed
-file, append .tar (make sure there is no file by the same name first)
-
-To download a package from another channel, prefix with the channel name like
-"channel/Package"
-
-More than one package may be specified at once.  It is ok to mix these
-four ways of specifying packages.
-'
-    ),
-    'upgrade' => array(
-        'summary' => 'Upgrade Package',
-        'function' => 'doUpgrade',
-        'shortcut' => 'up',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'upgrade packages from a specific channel',
-                'arg' => 'CHAN'
-            ),
-            'force' => array('shortopt' => 'f', 'doc' => 'overwrite newer installed packages'),
-            'loose' => array('shortopt' => 'l', 'doc' => 'do not check for recommended dependency version'),
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, upgrade anyway'),
-            'register-only' => array(
-                'shortopt' => 'r',
-                'doc' => 'do not install files, only register the package as upgraded'
-            ),
-            'nobuild' => array('shortopt' => 'B', 'doc' => 'don\'t build C extensions'),
-            'nocompress' => array('shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading'),
-            'installroot' => array(
-                'shortopt' => 'R',
-                'arg' => 'DIR',
-                'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)'
-            ),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'alldeps' => array('shortopt' => 'a', 'doc' => 'install all required and optional dependencies'),
-            'onlyreqdeps' => array('shortopt' => 'o', 'doc' => 'install all required dependencies'),
-            'offline' => array('shortopt' => 'O', 'doc' => 'do not attempt to download any urls or contact channels'),
-            'pretend' => array('shortopt' => 'p', 'doc' => 'Only list the packages that would be downloaded')
-        ),
-        'doc' => '<package> ...
-Upgrades one or more PEAR packages.  See documentation for the
-"install" command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-'
-    ),
-    'upgrade-all' => array(
-        'summary' => 'Upgrade All Packages',
-        'function' => 'doUpgradeAll',
-        'shortcut' => 'ua',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'upgrade packages from a specific channel',
-                'arg' => 'CHAN'
-            ),
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, upgrade anyway'),
-            'register-only' => array(
-                'shortopt' => 'r',
-                'doc' => 'do not install files, only register the package as upgraded'
-            ),
-            'nobuild' => array('shortopt' => 'B', 'doc' => 'don\'t build C extensions'),
-            'nocompress' => array('shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading'),
-            'installroot' => array(
-                'shortopt' => 'R',
-                'arg' => 'DIR',
-                'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM'
-            ),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'loose' => array('doc' => 'do not check for recommended dependency version')
-        ),
-        'doc' => '
-WARNING: This function is deprecated in favor of using the upgrade command with no params
-
-Upgrades all packages that have a newer release available.  Upgrades are
-done only if there is a release available of the state specified in
-"preferred_state" (currently {config preferred_state}), or a state considered
-more stable.
-'
-    ),
-    'uninstall' => array(
-        'summary' => 'Un-install Package',
-        'function' => 'doUninstall',
-        'shortcut' => 'un',
-        'options' => array(
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, uninstall anyway'),
-            'register-only' => array(
-                'shortopt' => 'r',
-                'doc' => 'do not remove files, only register the packages as not installed'
-            ),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'offline' => array('shortopt' => 'O', 'doc' => 'do not attempt to uninstall remotely')
-        ),
-        'doc' => '[channel/]<package> ...
-Uninstalls one or more PEAR packages.  More than one package may be
-specified at once.  Prefix with channel name to uninstall from a
-channel not in your default channel ({config default_channel})
-'
-    )
-);
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Package.php b/downloader/lib/Magento/Framework/Connect/Command/Package.php
deleted file mode 100644
index ad6ecaad5e215458ba5664ea4f0ee7c7d12af4a2..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Package.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Package extends \Magento\Framework\Connect\Command
-{
-    /**
-     * Dependencies list
-     * @var array
-     */
-    private $_depsList = array();
-
-    /**
-     * Releases list
-     * @var array
-     */
-    private $_releasesList = array();
-
-    /**
-     * Package command callback
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void|null
-     */
-    public function doPackage($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        if (count($params) < 1) {
-            return $this->doError($command, "Parameters count should be >= 1");
-        }
-
-        $file = strtolower($params[0]);
-        $file = realpath($file);
-
-        if (!file_exists($file)) {
-            return $this->doError($command, "File {$params[0]} doesn't exist");
-        }
-
-        try {
-            $packager = new \Magento\Framework\Connect\Package($file);
-            $res = $packager->validate();
-            if (!$res) {
-                $this->doError($command, implode("\n", $packager->getErrors()));
-                return;
-            }
-            $packager->save(dirname($file));
-            $this->ui()->output('Done building package');
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Display/get installation information for package
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void|array
-     */
-    public function doPackagePrepare($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        $channelAuth = array();
-        if (isset($options['auth'])) {
-            $channelAuth = $options['auth'];
-            $options['auth'] = null;
-        }
-        try {
-
-            if (count($params) < 2) {
-                return $this->doError($command, "Argument count should be >= 2");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-
-            $argVersionMin = isset($params[3]) ? $params[3] : false;
-            $argVersionMax = isset($params[2]) ? $params[2] : false;
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            $packager = $this->getPackager();
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            $rest = new \Magento\Framework\Connect\Rest($config->protocol);
-            if (!empty($channelAuth)) {
-                $rest->getLoader()->setCredentials($channelAuth['username'], $channelAuth['password']);
-            }
-
-            $cache->checkChannel($channel, $config, $rest);
-
-            $data = $packager->getDependenciesList(
-                $channel,
-                $package,
-                $cache,
-                $config,
-                $argVersionMax,
-                $argVersionMin,
-                true,
-                false,
-                $rest
-            );
-
-            $result = array();
-            foreach ($data['result'] as $_package) {
-                $_result['channel'] = $_package['channel'];
-                $_result['name'] = $_package['name'];
-                $_result['version'] = $_package['downloaded_version'];
-                $_result['stability'] = $_package['stability'];
-                $_result['install_state'] = $_package['install_state'];
-                $_result['message'] = $_package['message'];
-                $result[] = $_result;
-            }
-            if (!count($data['result']) && isset($data['failed']) && !empty($data['failed'])) {
-                foreach ($data['failed'] as $_package) {
-                    $reason = $_package['channel'] . '/' . $_package['name'] . ': ' . $_package['reason'];
-                    $this->doError($command, $reason);
-                }
-            }
-
-            $this->ui()->output(
-                array(
-                    $command => array(
-                        'data' => $result,
-                        'title' => "Package installation information for {$params[1]}: "
-                    )
-                )
-            );
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Display/get dependencies
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void|array
-     */
-    public function doPackageDependencies($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) < 2) {
-                return $this->doError($command, "Argument count should be >= 2");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-
-            $argVersionMin = isset($params[3]) ? $params[3] : false;
-            $argVersionMax = isset($params[2]) ? $params[2] : false;
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            $packager = $this->getPackager();
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-            $data = $packager->getDependenciesList(
-                $channel,
-                $package,
-                $cache,
-                $config,
-                $argVersionMax,
-                $argVersionMin
-            );
-            $this->ui()->output(
-                array($command => array('data' => $data['deps'], 'title' => "Package deps for {$params[1]}: "))
-            );
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doConvert($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) < 1) {
-                throw new \Exception("Arguments should be: source.tgz [target.tgz]");
-            }
-            $sourceFile = $params[0];
-            $converter = new \Magento\Framework\Connect\Converter();
-            $targetFile = isset($params[1]) ? $params[1] : false;
-            $result = $converter->convertPearToMage($sourceFile, $targetFile);
-            $this->ui()->output("Saved to: " . $result);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Package_Header.php b/downloader/lib/Magento/Framework/Connect/Command/Package_Header.php
deleted file mode 100644
index c7d207aed90061efa87889200ec5dcabb2ba435f..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Package_Header.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'package' => array(
-        'summary' => 'Build Package',
-        'function' => 'doPackage',
-        'shortcut' => 'p',
-        'options' => array(
-            'nocompress' => array('shortopt' => 'Z', 'doc' => 'Do not gzip the package file'),
-            'showname' => array('shortopt' => 'n', 'doc' => 'Print the name of the packaged file.')
-        ),
-        'doc' => '[descfile] [descfile2]
-Creates a PEAR package from its description file (usually called
-package.xml).  If a second packagefile is passed in, then
-the packager will check to make sure that one is a package.xml
-version 1.0, and the other is a package.xml version 2.0.  The
-package.xml version 1.0 will be saved as "package.xml" in the archive,
-and the other as "package2.xml" in the archive"
-'
-    ),
-    'package-dependencies' => array(
-        'summary' => 'Show package dependencies',
-        'function' => 'doPackageDependencies',
-        'shortcut' => 'pd',
-        'options' => array(),
-        'doc' => '<package-file> or <package.xml> or <install-package-name>
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.'
-    ),
-    'package-prepare' => array(
-        'summary' => 'Show installation information of package',
-        'function' => 'doPackagePrepare',
-        'shortcut' => 'pp',
-        'options' => array(),
-        'doc' => '<package-file> or <package.xml> or <install-package-name>
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.'
-    ),
-    'convert' => array(
-        'summary' => 'Convert old magento PEAR package to new format',
-        'function' => 'doConvert',
-        'shortcut' => 'conv',
-        'options' => array(),
-        'doc' => ''
-    )
-);
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Registry.php b/downloader/lib/Magento/Framework/Connect/Command/Registry.php
deleted file mode 100644
index 007ad21dc1c33af80a8e0b23897ac7935e06573f..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Registry.php
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Registry extends \Magento\Framework\Connect\Command
-{
-    const PACKAGE_PEAR_DIR = 'pearlib/php/.registry';
-
-    /**
-     * List-installed callback
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doList($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $ftpObj) = $packager->getRemoteCache($ftp);
-            } else {
-                $cache = $this->getSconfig();
-            }
-            if (!empty($params[0])) {
-                $chanName = $conf->chanName($params[0]);
-                $data = $cache->getInstalledPackages($chanName);
-            } else {
-                $data = $cache->getInstalledPackages();
-            }
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->ui()->output(
-                array($command => array('data' => $data, 'channel-title' => "Installed package for channel '%s' :"))
-            );
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * List-files callback
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doFileList($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-        try {
-            $channel = false;
-            if (count($params) < 2) {
-                throw new \Exception("Argument count should be = 2");
-            }
-            $channel = $params[0];
-            $package = $params[1];
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $confif = $this->config();
-            }
-            if (!$cache->hasPackage($channel, $package)) {
-                return $this->ui()->output("No package found: {$channel}/{$package}");
-            }
-
-            $p = $cache->getPackageObject($channel, $package);
-            $contents = $p->getContents();
-            if ($ftp) {
-                $ftpObj->close();
-            }
-            if (!count($contents)) {
-                return $this->ui()->output("No contents for package {$package}");
-            }
-            $title = "Contents of '{$package}': ";
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-
-            $this->ui()->output(array($command => array('data' => $contents, 'title' => $title)));
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Installed package info
-     * info command callback
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doInfo($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-
-        $cache = null;
-        $ftp = empty($options['ftp']) ? false : $options['ftp'];
-        try {
-            $channel = false;
-            if (count($params) < 2) {
-                throw new \Exception("Argument count should be = 2");
-            }
-            $channel = $params[0];
-            $package = $params[1];
-            $packager = $this->getPackager();
-            if ($ftp) {
-                list($cache, $ftpObj) = $packager->getRemoteCache($ftp);
-            } else {
-                $cache = $this->getSconfig();
-            }
-
-            if (!$cache->isChannel($channel)) {
-                throw new \Exception("'{$channel}' is not a valid installed channel name/uri");
-            }
-            $channelUri = $cache->chanUrl($channel);
-            $rest = $this->rest();
-            $rest->setChannel($channelUri);
-            $releases = $rest->getReleases($package);
-            if (false === $releases) {
-                throw new \Exception("No information found about {$channel}/{$package}");
-            }
-            $data = array($command => array('releases' => $releases));
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            if ($ftp && isset($cache)) {
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Synchronize manually installed package info with local cache
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doSync($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            $packager = $this->getPackager();
-            $cache = null;
-            $config = null;
-            $ftpObj = null;
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $config = $this->config();
-                $cache = $this->getSconfig();
-            }
-            if ($this->_checkPearData($config)) {
-                $this->doSyncPear($command, $options, $params);
-            }
-
-            $packageDir = $config->magento_root . '/' . \Magento\Framework\Connect\Package::PACKAGE_XML_DIR;
-            if (is_dir($packageDir)) {
-                $entries = scandir($packageDir);
-                foreach ((array)$entries as $entry) {
-                    $path = $packageDir . '/' . $entry;
-                    $info = pathinfo($path);
-                    if ($entry == '.' || $entry == '..' || is_dir($path) || $info['extension'] != 'xml') {
-                        continue;
-                    }
-
-                    if (is_readable($path)) {
-                        $data = file_get_contents($path);
-                        if ($data === false) {
-                            continue;
-                        }
-
-                        $package = new \Magento\Framework\Connect\Package($data);
-                        $name = $package->getName();
-                        $channel = $package->getChannel();
-                        $version = $package->getVersion();
-                        if (!$cache->isChannel($channel) && $channel == $config->root_channel) {
-                            $cache->addChannel($channel, $config->root_channel_uri);
-                        }
-                        if (!$cache->hasPackage($channel, $name, $version, $version)) {
-                            $cache->addPackage($package);
-                            $this->ui()->output("Successfully added: {$channel}/{$name}-{$version}");
-                        }
-                    }
-                }
-                if ($ftp) {
-                    $packager->writeToRemoteCache($cache, $ftpObj);
-                }
-            }
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Synchronize packages installed earlier (by pear installer) with local cache
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return array|true
-     */
-    public function doSyncPear($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            $packager = $this->getPackager();
-            $cache = null;
-            $config = null;
-            $ftpObj = null;
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $config = $this->config();
-                $cache = $this->getSconfig();
-            }
-
-            $pkglist = array();
-            if (!$this->_checkPearData($config)) {
-                return $pkglist;
-            }
-
-            $pearStorage = $config->magento_root . '/' . $config->downloader_path . '/' . self::PACKAGE_PEAR_DIR;
-            $channels = array(
-                '.channel.connect.magentocommerce.com_community',
-                '.channel.connect.magentocommerce.com_core'
-            );
-            foreach ($channels as $channel) {
-                $channelDirectory = $pearStorage . '/' . $channel;
-                if (!file_exists($channelDirectory) || !is_dir($channelDirectory)) {
-                    continue;
-                }
-
-                $dp = opendir($channelDirectory);
-                if (!$dp) {
-                    continue;
-                }
-
-                while ($ent = readdir($dp)) {
-                    if ($ent[0] == '.' || substr($ent, -4) != '.reg') {
-                        continue;
-                    }
-                    $pkglist[] = array('file' => $ent, 'channel' => $channel);
-                }
-                closedir($dp);
-            }
-
-            $package = new \Magento\Framework\Connect\Package();
-            foreach ($pkglist as $pkg) {
-                $pkgFilename = $pearStorage . '/' . $pkg['channel'] . '/' . $pkg['file'];
-                if (!file_exists($pkgFilename)) {
-                    continue;
-                }
-                $data = file_get_contents($pkgFilename);
-                $data = unserialize($data);
-
-                $package->importDataV1x($data);
-                $name = $package->getName();
-                $channel = $package->getChannel();
-                $version = $package->getVersion();
-                if (!$cache->isChannel($channel) && $channel == $config->root_channel) {
-                    $cache->addChannel($channel, $config->root_channel_uri);
-                }
-                if (!$cache->hasPackage($channel, $name, $version, $version)) {
-                    $cache->addPackage($package);
-
-                    if ($ftp) {
-                        $localXml = tempnam(sys_get_temp_dir(), 'package');
-                        @file_put_contents($localXml, $package->getPackageXml());
-
-                        if (is_file($localXml)) {
-                            $ftpDir = $ftpObj->getcwd();
-                            $remoteXmlPath = $ftpDir . '/' . \Magento\Framework\Connect\Package::PACKAGE_XML_DIR;
-                            $remoteXml = $package->getReleaseFilename() . '.xml';
-                            $ftpObj->mkdirRecursive($remoteXmlPath);
-                            $ftpObj->upload($remoteXml, $localXml, 0777, 0666);
-                            $ftpObj->chdir($ftpDir);
-                        }
-                    } else {
-                        $destDir = rtrim(
-                            $config->magento_root,
-                            "\\/"
-                        ) . '/' . \Magento\Framework\Connect\Package::PACKAGE_XML_DIR;
-                        $destFile = $package->getReleaseFilename() . '.xml';
-                        $dest = $destDir . '/' . $destFile;
-
-                        @mkdir($destDir, 0777, true);
-                        @file_put_contents($dest, $package->getPackageXml());
-                        @chmod($dest, 0666);
-                    }
-
-                    $this->ui()->output("Successfully added: {$channel}/{$name}-{$version}");
-                }
-            }
-
-            $config->sync_pear = true;
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-
-        return true;
-    }
-
-    /**
-     * Check is need to sync old pear data
-     * 
-     * @param \Magento\Framework\Connect\Config $config
-     * @return bool
-     */
-    protected function _checkPearData($config)
-    {
-        $pearStorage = $config->magento_root . '/' . $config->downloader_path . '/' . self::PACKAGE_PEAR_DIR;
-        return !$config->sync_pear && file_exists($pearStorage) && is_dir($pearStorage);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Registry_Header.php b/downloader/lib/Magento/Framework/Connect/Command/Registry_Header.php
deleted file mode 100644
index 2a566c5a99ddb97886bb18b73b80458e2fa6b095..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Registry_Header.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'list-installed' => array(
-        'summary' => 'List Installed Packages In The Default Channel',
-        'function' => 'doList',
-        'shortcut' => 'l',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'list installed packages from this channel',
-                'arg' => 'CHAN'
-            ),
-            'allchannels' => array('shortopt' => 'a', 'doc' => 'list installed packages from all channels')
-        ),
-        'doc' => '<package>
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir}).  With a parameter, it
-lists the files in a package.
-'
-    ),
-    'list-files' => array(
-        'summary' => 'List Files In Installed Package',
-        'function' => 'doFileList',
-        'shortcut' => 'fl',
-        'options' => array(),
-        'doc' => '<package>
-List the files in an installed package.
-'
-    ),
-    'info' => array(
-        'summary' => 'Display information about a package',
-        'function' => 'doInfo',
-        'shortcut' => 'in',
-        'options' => array(),
-        'doc' => '<package>
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.'
-    ),
-    'sync' => array(
-        'summary' => 'Synchronize Manually Installed Packages',
-        'function' => 'doSync',
-        'shortcut' => 'snc',
-        'options' => array(),
-        'doc' => '<package>
-Synchronize manually installed package info with local cache.'
-    ),
-    'sync-pear' => array(
-        'summary' => 'Synchronize already Installed Packages by pear',
-        'function' => 'doSyncPear',
-        'shortcut' => 'sncp',
-        'options' => array(),
-        'doc' => '<package>
-Synchronize already Installed Packages by pear.'
-    )
-);
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Remote.php b/downloader/lib/Magento/Framework/Connect/Command/Remote.php
deleted file mode 100644
index eea83de6dfe393d16ceca329c3a970aa021fc2be..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Remote.php
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Remote extends \Magento\Framework\Connect\Command
-{
-    /**
-     * List-upgrades callback
-     * @param srting $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doListUpgrades($command, $options, $params)
-    {
-
-        $this->cleanupParams($params);
-        try {
-            $packager = new \Magento\Framework\Connect\Packager();
-            $channelAuth = isset($options['auth']) ? $options['auth'] : array();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            if (!empty($params[0])) {
-                $channels = $params[0];
-                $cache->getChannel($channels);
-            } else {
-                $channels = $cache->getChannelNames();
-            }
-            $rest = $this->rest();
-            if (!empty($channelAuth)) {
-                $rest->getLoader()->setCredentials($channelAuth['username'], $channelAuth['password']);
-            }
-            $ups = $packager->getUpgradesList($channels, $cache, $config, $rest);
-
-            if (count($ups)) {
-                $data = array($command => array('data' => $ups));
-            } else {
-                $data = "No upgrades available";
-            }
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * List available
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doListAvailable($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            $packager = new \Magento\Framework\Connect\Packager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            if (!empty($params[0])) {
-                $channels = array($params[0]);
-                $cache->getChannel($channels[0]);
-            } else {
-                $channels = $cache->getChannelNames();
-            }
-
-
-
-            $packs = array();
-            foreach ($channels as $channel) {
-                try {
-                    $chan = $cache->getChannel($channel);
-                    $uri = $cache->chanUrl($channel);
-
-                    $rest = $this->rest();
-                    $rest->setChannel($uri);
-
-                    $packages = $rest->getPackages();
-                    if (!count($packages)) {
-                        $this->ui()->output("Channel '{$channel}' has no packages");
-                        continue;
-                    }
-                    $packs[$channel]['title'] = "Packages for channel '" . $channel . "':";
-                    foreach ($packages as $p) {
-                        $packageName = $p['n'];
-                        $releases = array();
-                        foreach ($p['r'] as $k => $r) {
-                            $releases[$r] = $rest->shortStateToLong($k);
-                        }
-                        $packs[$channel]['packages'][$packageName]['releases'] = $releases;
-                    }
-                } catch (\Exception $e) {
-                    $this->doError($command, $e->getMessage());
-                }
-            }
-            $dataOut = array();
-            $dataOut[$command] = array('data' => $packs);
-            $this->ui()->output($dataOut);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Download command callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doDownload($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-        try {
-            if (count($params) < 2) {
-                throw new \Exception("Arguments should be: channel Package");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            $chan = $cache->getChannel($channel);
-            $uri = $cache->chanUrl($channel);
-
-            $rest = $this->rest();
-            $rest->setChannel($uri);
-            $c = $rest->getReleases($package);
-            if (!count($c)) {
-                throw new \Exception("No releases found for package");
-            }
-            $version = $cache->detectVersionFromRestArray($c);
-            $dir = $config->getChannelCacheDir($channel);
-            $file = $dir . '/' . $package . "-" . $version . ".tgz";
-            $rest->downloadPackageFileOfRelease($package, $version, $file);
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-            $this->ui()->output("Saved to: " . $file);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Clear cache command callback
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doClearCache($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            $packager = new \Magento\Framework\Connect\Packager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $ftpObj) = $packager->getRemoteCache($ftp);
-                $cache->clear();
-                $packager->writeToRemoteCache($cache, $ftpObj);
-            } else {
-                $cache = $this->getSconfig();
-                $cache->clear();
-            }
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Command/Remote_Header.php b/downloader/lib/Magento/Framework/Connect/Command/Remote_Header.php
deleted file mode 100644
index 418fd5eb254d6694ddb40d5a5a323960b638beb9..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Command/Remote_Header.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'list-upgrades' => array(
-        'summary' => 'List Available Upgrades',
-        'function' => 'doListUpgrades',
-        'shortcut' => 'lu',
-        'options' => array(
-            'channelinfo' => array('shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure')
-        ),
-        'doc' => '[preferred_state]
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.)
-or the state passed as the second parameter.'
-    ),
-    'list-available' => array(
-        'summary' => 'List Available Packages',
-        'function' => 'doListAvailable',
-        'shortcut' => 'la',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'specify a channel other than the default channel',
-                'arg' => 'CHAN'
-            ),
-            'channelinfo' => array('shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure')
-        ),
-        'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.'
-    ),
-    'download' => array(
-        'summary' => 'Download Package',
-        'function' => 'doDownload',
-        'shortcut' => 'd',
-        'options' => array('nocompress' => array('shortopt' => 'Z', 'doc' => 'download an uncompressed (.tar) file')),
-        'doc' => '<package>...
-Download package tarballs.  The files will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.'
-    ),
-    'clear-cache' => array(
-        'summary' => 'Clear Web Services Cache',
-        'function' => 'doClearCache',
-        'shortcut' => 'cc',
-        'options' => array(),
-        'doc' => '
-Clear the XML-RPC/REST cache.  See also the cache_ttl configuration
-parameter.
-'
-    )
-);
diff --git a/downloader/lib/Magento/Framework/Connect/Config.php b/downloader/lib/Magento/Framework/Connect/Config.php
deleted file mode 100644
index 398d9d46281eab6f5440764f8ef5864f851b2eaa..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Config.php
+++ /dev/null
@@ -1,615 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Magento Connect Config
- *
- * @property string php_ini
- * @property string protocol
- * @property string preferred_state
- * @property string use_custom_permissions_mode
- * @property string global_dir_mode
- * @property string global_file_mode
- * @property string downloader_path
- * @property string magento_root
- * @property string root_channel_uri
- * @property string root_channel
- * @property string remote_config
- * @property string sync_pear
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect;
-
-class Config implements \Iterator
-{
-    /**
-     * Config file name
-     *
-     * @var string
-     */
-    protected $_configFile;
-
-    /**
-     * Config loaded from file
-     *
-     * @var bool
-     */
-    protected $_configLoaded;
-
-    /**
-     * Save file even if it not modified
-     *
-     * @var bool
-     */
-    protected $_forceSave = false;
-
-    /**
-     * Stores last error message
-     *
-     * @var string
-     */
-    protected $_configError = '';
-
-    /**
-     * Header string
-     */
-    const HEADER = "::ConnectConfig::v::1.0::";
-
-    /**
-     * Default paths
-     */
-    const DEFAULT_DOWNLOADER_PATH = "downloader";
-
-    const DEFAULT_CACHE_PATH = ".cache";
-
-    /**
-     * Array of default properties
-     * @var array
-     */
-    protected $defaultProperties = array();
-
-    /**
-     * Array of properties
-     *
-     * @var array
-     */
-    protected $properties = array();
-
-    /**
-     * Constructor loads the data from config file
-     * @param string $configFile
-     */
-    public function __construct($configFile = "connect.cfg")
-    {
-        $this->initProperties();
-        $this->_configFile = $configFile;
-        $this->load();
-    }
-
-    /**
-     * Initialise Properties and Default Properties
-     *
-     * @return void
-     */
-    protected function initProperties()
-    {
-        $this->defaultProperties = array(
-            'php_ini' => array(
-                'type' => 'file',
-                'value' => '',
-                'prompt' => 'location of php.ini',
-                'doc' => "It's a location of PHP.ini to use blah",
-                'possible' => '/path/php.ini'
-            ),
-            'protocol' => array(
-                'type' => 'set',
-                'value' => 'http',
-                'prompt' => 'preffered protocol',
-                'doc' => 'preffered protocol',
-                'rules' => array('http', 'ftp')
-            ),
-            'preferred_state' => array(
-                'type' => 'set',
-                'value' => 'stable',
-                'prompt' => 'preferred package state',
-                'doc' => 'preferred package state',
-                'rules' => array('beta', 'alpha', 'stable', 'devel')
-            ),
-            'use_custom_permissions_mode' => array(
-                'type' => 'bool',
-                'value' => false,
-                'prompt' => 'Use custom permissions for directory and file creation',
-                'doc' => 'Use custom permissions for directory and file creation',
-                'possible' => 'true, false'
-            ),
-            'global_dir_mode' => array(
-                'type' => 'octal',
-                'value' => 0777,
-                'prompt' => 'directory creation mode',
-                'doc' => 'directory creation mode',
-                'possible' => '0777, 0666 etc.'
-            ),
-            'global_file_mode' => array(
-                'type' => 'octal',
-                'value' => 0666,
-                'prompt' => 'file creation mode',
-                'doc' => 'file creation mode',
-                'possible' => '0777, 0666 etc.'
-            ),
-            'downloader_path' => array(
-                'type' => 'dir',
-                'value' => 'downloader',
-                'prompt' => 'relative path, location of magento downloader',
-                'doc' => "relative path, location of magento downloader",
-                'possible' => 'path'
-            ),
-            'magento_root' => array(
-                'type' => 'dir',
-                'value' => '',
-                'prompt' => 'location of magento root dir',
-                'doc' => "Location of magento",
-                'possible' => '/path'
-            ),
-            'root_channel_uri' => array(
-                'type' => 'string',
-                'value' => 'connect20.magentocommerce.com/community',
-                'prompt' => '',
-                'doc' => "",
-                'possible' => ''
-            ),
-            'root_channel' => array(
-                'type' => 'string',
-                'value' => 'community',
-                'prompt' => '',
-                'doc' => "",
-                'possible' => ''
-            ),
-            'remote_config' => array(
-                'type' => 'string',
-                'value' => '',
-                'prompt' => '',
-                'doc' => "",
-                'possible' => 'ftp://name:password@host.com:port/path/to/folder/'
-            ),
-            'sync_pear' => array('type' => 'boolean', 'value' => false, 'prompt' => '', 'doc' => "", 'possible' => '')
-        );
-        $this->properties = $this->defaultProperties;
-    }
-
-    /**
-     * Retrieve Downloader Path
-     *
-     * @return string
-     */
-    public function getDownloaderPath()
-    {
-        return $this->magento_root . '/' . $this->downloader_path;
-    }
-
-    /**
-     * Retrieve Packages Cache \Directory
-     *
-     * @return string
-     */
-    public function getPackagesCacheDir()
-    {
-        return $this->getDownloaderPath() . '/' . self::DEFAULT_CACHE_PATH;
-    }
-
-    /**
-     * Retrieve Channel Cache \Directory
-     *
-     * @param string $channel
-     * @return string
-     */
-    public function getChannelCacheDir($channel)
-    {
-        $channel = trim($channel, "\\/");
-        return $this->getPackagesCacheDir() . '/' . $channel;
-    }
-
-    /**
-     * Get Config file name
-     *
-     * @return string
-     */
-    public function getFilename()
-    {
-        return $this->_configFile;
-    }
-
-    /**
-     * Load data from config file
-     *
-     * @return bool
-     */
-    public function load()
-    {
-        $this->_configLoaded = false;
-        if (!is_file($this->_configFile)) {
-            if (!$this->save()) {
-                $this->_configError = 'Config file does not exists please save Settings';
-            } else {
-                $this->_configLoaded = true;
-                return true;
-            }
-            return false;
-        }
-
-        try {
-            $f = fopen($this->_configFile, "r");
-            fseek($f, 0, SEEK_SET);
-        } catch (\Exception $e) {
-            $this->_configError = "Cannot open config file {$this->_configFile} please check file permission";
-            return false;
-        }
-
-        clearstatcache();
-        $size = filesize($this->_configFile);
-        if (!$size) {
-            $this->_configError = "Wrong config file size {$this->_configFile} please save Settings again";
-            return false;
-        }
-
-        $headerLen = strlen(self::HEADER);
-        try {
-            $contents = fread($f, $headerLen);
-            if (self::HEADER != $contents) {
-                $this->_configError = "Wrong configuration file {$this->_configFile} please save Settings again";
-                return false;
-            }
-
-            $size -= $headerLen;
-            $contents = fread($f, $size);
-        } catch (\Exception $e) {
-            $this->_configError = "Configuration file {$this->_configFile} read error '{$e->getMessage()}'" .
-                " please save Settings again";
-            return false;
-        }
-        $data = @unserialize($contents);
-        if ($data === false) {
-            $this->_configError = "Wrong configuration file {$this->_configFile} please save Settings again";
-            return false;
-        }
-        foreach ($data as $k => $v) {
-            $this->{$k} = $v;
-        }
-        @fclose($f);
-        $this->_configLoaded = true;
-        return true;
-    }
-
-    /**
-     * Save config file on the disk or over ftp
-     *
-     * @return bool
-     */
-    public function store()
-    {
-        $result = false;
-        if ($this->_forceSave || $this->_configLoaded || strlen($this->remote_config) > 0) {
-            $data = serialize($this->toArray());
-            if (strlen($this->remote_config) > 0) {
-                //save config over ftp
-                $confFile = $this->downloader_path . '/' . "connect.cfg";
-                try {
-                    $ftpObj = new \Magento\Framework\Connect\Ftp();
-                    $ftpObj->connect($this->remote_config);
-                } catch (\Exception $e) {
-                    $this->_configError = 'Cannot access to deployment FTP path. ' .
-                        'Check deployment FTP Installation path settings.';
-                    return $result;
-                }
-                try {
-                    $tempFile = tempnam(sys_get_temp_dir(), 'config');
-                    $f = fopen($tempFile, "w+");
-                    fwrite($f, self::HEADER);
-                    fwrite($f, $data);
-                    fclose($f);
-                } catch (\Exception $e) {
-                    $this->_configError = 'Cannot access to temporary file storage to save Settings.' .
-                        'Contact your system administrator.';
-                    return $result;
-                }
-                try {
-                    $result = $ftpObj->upload($confFile, $tempFile);
-                    $ftpObj->close();
-                } catch (\Exception $e) {
-                    $this->_configError = 'Cannot write file over FTP. ' .
-                        'Check deployment FTP Installation path settings.';
-                    return $result;
-                }
-                if (!$result) {
-                    $this->_configError = '';
-                }
-            } elseif (is_file($this->_configFile) && is_writable($this->_configFile) || is_writable(getcwd())) {
-                try {
-                    $f = fopen($this->_configFile, "w+");
-                    fwrite($f, self::HEADER);
-                    fwrite($f, $data);
-                    fclose($f);
-                    $result = true;
-                } catch (\Exception $e) {
-                    $result = false;
-                }
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Validate value for configuration key
-     *
-     * @param string $key
-     * @param mixed $val
-     * @return bool
-     */
-    public function validate($key, $val)
-    {
-        $rules = $this->extractField($key, 'rules');
-        if (null === $rules) {
-            return true;
-        } elseif (is_array($rules)) {
-            return in_array($val, $rules);
-        }
-        return false;
-    }
-
-    /**
-     * Get possible values for configuration key
-     *
-     * @param string $key
-     * @return null|string
-     */
-    public function possible($key)
-    {
-        $data = $this->getKey($key);
-        if (!$data) {
-            return null;
-        }
-        if ('set' == $data['type']) {
-            return implode("|", $data['rules']);
-        }
-        if (!empty($data['possible'])) {
-            return $data['possible'];
-        }
-        return "<" . $data['type'] . ">";
-    }
-
-    /**
-     * Get type of key
-     *
-     * @param string $key
-     * @return mixed|null
-     */
-    public function type($key)
-    {
-        return $this->extractField($key, 'type');
-    }
-
-    /**
-     * Get documentation information
-     *
-     * @param string $key
-     * @return mixed|null
-     */
-    public function doc($key)
-    {
-        return $this->extractField($key, 'doc');
-    }
-
-    /**
-     * Get property of key
-     *
-     * @param string $key
-     * @param string $field
-     * @return null|string
-     */
-    public function extractField($key, $field)
-    {
-        if (!isset($this->properties[$key][$field])) {
-            return null;
-        }
-        return $this->properties[$key][$field];
-    }
-
-    /**
-     * Check Key exists in properties array
-     *
-     * @param string $fld
-     * @return bool
-     */
-    public function hasKey($fld)
-    {
-        return isset($this->properties[$fld]);
-    }
-
-    /**
-     * Get all Key properties
-     *
-     * @param string $fld
-     * @return string|string[]|int|bool|null
-     */
-    public function getKey($fld)
-    {
-        if ($this->hasKey($fld)) {
-            return $this->properties[$fld];
-        }
-        return null;
-    }
-
-    /**
-     * Set the internal pointer of the Properties array to its first element
-     *
-     * @return void
-     */
-    public function rewind()
-    {
-        reset($this->properties);
-    }
-
-    /**
-     * Validate current property
-     *
-     * @return bool
-     */
-    public function valid()
-    {
-        return current($this->properties) !== false;
-    }
-
-    /**
-     * Get Key of current property
-     *
-     * @return mixed
-     */
-    public function key()
-    {
-        return key($this->properties);
-    }
-
-    /**
-     * Get current Property
-     *
-     * @return mixed
-     */
-    public function current()
-    {
-        return current($this->properties);
-    }
-
-    /**
-     * Advance the internal array pointer of the Properties array
-     *
-     * @return void
-     */
-    public function next()
-    {
-        next($this->properties);
-    }
-
-    /**
-     * Retrieve value of property
-     *
-     * @param string $var
-     * @return null
-     */
-    public function __get($var)
-    {
-        if (isset($this->properties[$var]['value'])) {
-            return $this->properties[$var]['value'];
-        }
-        return null;
-    }
-
-    /**
-     * Set value of property
-     *
-     * @param string $var
-     * @param mixed $value
-     * @return void
-     */
-    public function __set($var, $value)
-    {
-        if (is_string($value)) {
-            $value = trim($value);
-        }
-        if (isset($this->properties[$var])) {
-            if ($value === null) {
-                $value = '';
-            }
-            if ($this->properties[$var]['value'] !== $value) {
-                $this->properties[$var]['value'] = $value;
-                $this->store();
-            }
-        }
-    }
-
-    /**
-     * Prepare Array of class properties
-     *
-     * @param bool $withRules
-     * @return array
-     */
-    public function toArray($withRules = false)
-    {
-        $out = array();
-        foreach ($this as $k => $v) {
-            $out[$k] = $withRules ? $v : $v['value'];
-        }
-        return $out;
-    }
-
-    /**
-     * Return default config value by key
-     *
-     * @param string $key
-     * @return mixed
-     */
-    public function getDefaultValue($key)
-    {
-        if (isset($this->defaultProperties[$key]['value'])) {
-            return $this->defaultProperties[$key]['value'];
-        }
-        return false;
-    }
-
-    /**
-     * Check is config loaded
-     *
-     * @return string
-     */
-    public function isLoaded()
-    {
-        return $this->_configLoaded;
-    }
-
-    /**
-     * Retrieve error message
-     *
-     * @return string
-     */
-    public function getError()
-    {
-        return $this->_configError;
-    }
-
-    /**
-     * Save config
-     *
-     * @return string
-     */
-    public function save()
-    {
-        $forceSave = $this->_forceSave;
-        $this->_forceSave = true;
-
-        $result = $this->store();
-
-        $this->_forceSave = $forceSave;
-
-        return $result;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Converter.php b/downloader/lib/Magento/Framework/Connect/Converter.php
deleted file mode 100644
index 6f8c31842047b2565abc14fd3f3ab6fbb55649a8..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Converter.php
+++ /dev/null
@@ -1,350 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class for convertiong old magento PEAR packages to new one
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-final class Converter
-{
-    /**
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archiver;
-
-    /**
-     *
-     * @return \Magento\Framework\Archive
-     */
-    public function arc()
-    {
-        if (!$this->_archiver) {
-            $this->_archiver = new \Magento\Framework\Archive();
-        }
-        return $this->_archiver;
-    }
-
-    /**
-     * @return Package
-     */
-    public function newPackage()
-    {
-        return new \Magento\Framework\Connect\Package();
-    }
-
-    /**
-     *
-     * @return Pear_Package_Parser_v2
-     */
-    public function oldPackageReader()
-    {
-        return new Pear_Package_Parser_v2();
-    }
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * @param string $channel
-     * @return string
-     */
-    public function convertChannelName($channel)
-    {
-        return str_replace("connect.magentocommerce.com/", "", $channel);
-    }
-
-    /**
-     * Convert package dependencies - urls - by ref
-     * @param array $oldDeps  ref to array
-     * @return array
-     */
-    public function convertPackageDependencies($oldDeps)
-    {
-        $out = array();
-        if (empty($oldDeps['required']['package'])) {
-            return $out;
-        }
-        $deps = $oldDeps['required']['package'];
-        if (!isset($deps[0])) {
-            $deps = array($deps);
-        }
-        for ($i = 0,$c = count($deps); $i < $c; $i++) {
-            $deps[$i]['min_version'] = isset($deps[$i]['min']) ? $deps[$i]['min'] : false;
-            $deps[$i]['max_version'] = isset($deps[$i]['max']) ? $deps[$i]['max'] : false;
-            $deps[$i]['channel'] = $this->convertChannelName($deps[$i]['channel']);
-            $out[] = $deps[$i];
-        }
-
-        return $out;
-    }
-
-    /**
-     * @param array $oldLicense
-     * @return array|bool|float|int|string
-     */
-    public function convertLicense($oldLicense)
-    {
-        if (is_scalar($oldLicense)) {
-            return $oldLicense;
-        }
-        return array($oldLicense['_content'], $oldLicense['attribs']['uri']);
-    }
-
-    /**
-     * @param array $maintainers
-     * @return array
-     */
-    public function convertMaintainers($maintainers)
-    {
-        if (!is_array($maintainers) || !count($maintainers)) {
-            return array();
-        }
-        $out = array();
-        foreach ($maintainers as $row) {
-            $out[] = array('name' => $row['name'], 'email' => $row['email'], 'user' => 'auto-converted');
-        }
-        return $out;
-    }
-
-    /**
-     * @var array
-     */
-    protected $fileMap = array();
-
-    /**
-     * Conver pear package object to magento object
-     * @param Pear_Package_V2 $pearObject
-     * @return \Magento\Framework\Connect\Package
-     */
-    public function convertPackageObject($pearObject)
-    {
-        $data = array();
-        $mageObject = $this->newPackage();
-
-
-
-        $map = array(
-            'name' => null,
-            'version' => array('getterArgs' => array('release')),
-            'package_deps' => array(
-                'getter' => 'getDependencies',
-                'converter' => 'convertPackageDependencies',
-                'setter' => 'setDependencyPackages'
-            ),
-            'stability' => array('getter' => 'getState', 'getterArgs' => array('release')),
-            'license' => array('getterArgs' => array(true), 'converter' => 'convertLicense', 'noArrayWrap' => true),
-            'summary' => null,
-            'description' => null,
-            'notes' => null,
-            'date' => null,
-            'time' => null,
-            'authors' => array('converter' => 'convertMaintainers', 'getter' => 'getMaintainers'),
-            'channel' => array('converter' => 'convertChannelName')
-        );
-        foreach ($map as $field => $rules) {
-
-            if (empty($rules)) {
-                $rules = array('setter' => '', 'getter' => '');
-            }
-
-            if (empty($rules['getter'])) {
-                $rules['getter'] = 'get' . ucfirst($field);
-            }
-
-            $useSetter = empty($rules['noSetter']);
-            $useGetter = empty($rules['noGetter']);
-
-
-            if (empty($rules['setter'])) {
-                $rules['setter'] = 'set' . ucfirst($field);
-            }
-            if (empty($rules['getterArgs'])) {
-                $rules['getterArgs'] = array();
-            } elseif (!is_array($rules['getterArgs'])) {
-                throw new \Exception("Invalid 'getterArgs' for '{$field}', should be array");
-            }
-
-            if ($useGetter
-                && (!method_exists($pearObject, $rules['getter'])
-                    || !is_callable([$pearObject, $rules['getter']])
-                )
-            ) {
-                $mName = get_class($pearObject) . "::" . $rules['getter'];
-                throw new \Exception('No getter method exists: ' . $mName);
-            }
-
-            if ($useSetter
-                && (!method_exists($mageObject, $rules['setter'])
-                    || !is_callable([$mageObject, $rules['setter']])
-                )
-            ) {
-                $mName = get_class($mageObject) . "::" . $rules['setter'];
-                throw new \Exception('No setter method exists: ' . $mName);
-            }
-
-            $useConverter = !empty($rules['converter']);
-
-            if ($useConverter && !method_exists($this, $rules['converter'])) {
-                $mName = get_class($this) . "::" . $rules['converter'];
-                throw new \Exception('No converter method exists: ' . $mName);
-            }
-
-            if ($useGetter) {
-                $getData = call_user_func_array(array($pearObject, $rules['getter']), $rules['getterArgs']);
-            } else {
-                $getData = array();
-            }
-
-            if ($useConverter) {
-                $args = array();
-                if (!$useGetter && !$useSetter) {
-                    $args = array($pearObject, $mageObject);
-                } elseif (!$useSetter) {
-                    $args = array($mageObject, $getData);
-                } else {
-                    $args = array($getData);
-                }
-                $getData = call_user_func_array(array($this, $rules['converter']), $args);
-            }
-
-            $noWrap = !empty($rules['noArrayWrap']);
-            if ($useSetter) {
-                $setData = call_user_func_array(
-                    array($mageObject, $rules['setter']),
-                    $noWrap ? $getData : array($getData)
-                );
-            }
-        }
-        return $mageObject;
-    }
-
-    /**
-     * Convert PEAR package to Magento package
-     * @param string $sourceFile  path to PEAR .tgz
-     * @param string|false $destFile    path to newly-created Magento .tgz, false to specify auto
-     * @return bool
-     */
-    public function convertPearToMage($sourceFile, $destFile = false)
-    {
-        try {
-            if (!file_exists($sourceFile)) {
-                throw new \Exception("File doesn't exist: {$sourceFile}");
-            }
-            $arc = $this->arc();
-            $tempDir = "tmp-" . basename($sourceFile) . uniqid();
-            $outDir = "out-" . basename($sourceFile) . uniqid();
-            $outDir = rtrim($outDir, "\\/");
-            \Magento\Framework\System\Dirs::mkdirStrict($outDir);
-            \Magento\Framework\System\Dirs::mkdirStrict($tempDir);
-
-            $result = $arc->unpack($sourceFile, $tempDir);
-            if (!$result) {
-                throw new \Exception("'{$sourceFile}' was not unpacked");
-            }
-
-            $result = rtrim($result, "\\/");
-            $packageXml = $result . '/package.xml';
-            if (!file_exists($packageXml)) {
-                throw new \Exception("No package.xml found inside '{$sourceFile}'");
-            }
-
-            $reader = $this->oldPackageReader();
-            $data = file_get_contents($packageXml);
-
-            $pearObject = $reader->parsePackage($data, $packageXml);
-            $mageObject = $this->convertPackageObject($pearObject);
-            if (!$mageObject->validate()) {
-                throw new \Exception("Package validation failed.\n" . implode("\n", $mageObject->getErrors()));
-            }
-
-            /**
-             * Calculate destination file if false
-             */
-            if (false === $destFile) {
-                $pathinfo = pathinfo($sourceFile);
-                $destFile = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-converted';
-                if (isset($pathinfo['extension'])) {
-                    $destFile .= "." . $pathinfo['extension'];
-                }
-            }
-
-            $target = new \Magento\Framework\Connect\Package\Target("target.xml");
-            $targets = $target->getTargets();
-            $mageObject->setTarget($target);
-            $validRoles = array_keys($targets);
-            $data = $pearObject->getFilelist();
-            $pathSource = dirname(
-                $pearObject->getPackageFile()
-            ) . '/' . $pearObject->getName() . "-" . $pearObject->getVersion();
-
-            $filesToDo = array();
-            foreach ($data as $file => $row) {
-                $name = $row['name'];
-                $role = $row['role'];
-                if (!in_array($role, $validRoles)) {
-                    $role = 'mage';
-                }
-                $baseName = ltrim($targets[$role], "\\/.");
-                $baseName = rtrim($baseName, "\\/");
-                $sourceFile = $pathSource . '/' . $name;
-                $targetFile = $outDir . '/' . $baseName . '/' . $name;
-                if (file_exists($sourceFile)) {
-                    \Magento\Framework\System\Dirs::mkdirStrict(dirname($targetFile));
-                    $copy = @copy($sourceFile, $targetFile);
-                    if (false === $copy) {
-                        throw new \Exception("Cannot copy '{$sourceFile}' to '{$targetFile}'");
-                    }
-                }
-                $filesToDo[] = array('name' => $name, 'role' => $role);
-            }
-            $cwd = getcwd();
-            @chdir($outDir);
-            foreach ($filesToDo as $fileToDo) {
-                $mageObject->addContent($fileToDo['name'], $fileToDo['role']);
-            }
-            $mageObject->save(getcwd());
-            @chdir($cwd);
-            $filename = $outDir . '/' . $mageObject->getReleaseFilename() . ".tgz";
-            if (@file_exists($destFile)) {
-                @unlink($destFile);
-            }
-            \Magento\Framework\System\Dirs::mkdirStrict(dirname($destFile));
-            $copy = @copy($filename, $destFile);
-            if (false === $copy) {
-                throw new \Exception("Cannot copy '{$filename}' to '{$destFile}'");
-            }
-            \Magento\Framework\System\Dirs::rm($tempDir);
-            \Magento\Framework\System\Dirs::rm($outDir);
-        } catch (\Exception $e) {
-            throw $e;
-        }
-        return $destFile;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Frontend.php b/downloader/lib/Magento/Framework/Connect/Frontend.php
deleted file mode 100644
index bc5640bf078be0e3d4c88c899802f94e8d542770..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Frontend.php
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-class Frontend
-{
-    /**
-     * Silent flag. If set no output is produced to view.
-     * Should be used in derived classes.
-     *
-     * @var bool
-     */
-    protected $_silent = false;
-
-    /**
-     * Capture mode. If set command output should be collected
-     * by derived class impplementation
-     *
-     * @var bool
-     */
-    protected $_capture = false;
-
-    /**
-     * push/pop variable for capture
-     *
-     * @var array
-     */
-    protected $_captureSaved = array();
-
-    /**
-     * push/pop variable for silent
-     *
-     * @var array
-     */
-    protected $_silentSaved = array();
-
-    /**
-     * Errors list
-     *
-     * @var array
-     */
-    protected $_errors = array();
-
-    /**
-     * Add error to errors list
-     *
-     * @param mixed $data
-     * @return void
-     */
-    public function addError($data)
-    {
-        $this->_errors[] = $data;
-    }
-
-    /**
-     * Get errors, clear errors list with first param
-     *
-     * @param bool $clear
-     * @return array
-     */
-    public function getErrors($clear = true)
-    {
-        if (!$clear) {
-            return $this->_errors;
-        }
-        $out = $this->_errors;
-        $this->clearErrors();
-        return $out;
-    }
-
-    /**
-     * Clear errors array
-     *
-     * @return void
-     */
-    public function clearErrors()
-    {
-        $this->_errors = array();
-    }
-
-    /**
-     * Are there any errros?
-     *
-     * @return bool
-     */
-    public function hasErrors()
-    {
-        return count($this->_errors) != 0;
-    }
-
-    /**
-     * Error processing
-     * @param string $command
-     * @param string $message
-     * @return void
-     */
-    public function doError($command, $message)
-    {
-        $this->addError(array($command, $message));
-    }
-
-    /**
-     * Save capture state
-     *
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function pushCapture()
-    {
-        array_push($this->_captureSaved, $this->_capture);
-        return $this;
-    }
-
-    /**
-     * Restore capture state
-     *
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function popCapture()
-    {
-        $this->_capture = array_pop($this->_captureSaved);
-        return $this;
-    }
-
-    /**
-     * Set capture mode
-     *
-     * @param bool $arg true by default
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function setCapture($arg = true)
-    {
-        $this->_capture = $arg;
-        return $this;
-    }
-
-    /**
-     * Getter for capture mode
-     *
-     * @return bool
-     */
-    public function isCapture()
-    {
-        return $this->_capture;
-    }
-
-    /**
-     * Log stub
-     *
-     * @param string $msg
-     * @return void
-     */
-    public function log($msg)
-    {
-    }
-
-    /**
-     * Ouptut method
-     *
-     * @param array $data
-     * @return void
-     */
-    public function output($data)
-    {
-    }
-
-    /**
-     * Get instance of derived class
-     *
-     * @param string $class CLI for example will produce \Magento\Framework\Connect\Frontend\CLI
-     * @return object
-     */
-    public static function getInstance($class)
-    {
-        $class = __CLASS__ . "_" . $class;
-        return new $class();
-    }
-
-    /**
-     * Get output if capture mode set
-     * Clear prevoius if needed
-     *
-     * @param bool $clearPrevious
-     * @return mixed
-     */
-    public function getOutput($clearPrevious = true)
-    {
-    }
-
-    /**
-     * Save silent mode
-     *
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function pushSilent()
-    {
-        array_push($this->_silentSaved, $this->_silent);
-        return $this;
-    }
-
-    /**
-     * Restore silent mode
-     *
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function popSilent()
-    {
-        $this->_silent = array_pop($this->_silentSaved);
-        return $this;
-    }
-
-    /**
-     * Set silent mode
-     *
-     * @param bool $value
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function setSilent($value = true)
-    {
-        $this->_silent = (bool)$value;
-        return $this;
-    }
-
-    /**
-     * Is silent mode?
-     *
-     * @return bool
-     */
-    public function isSilent()
-    {
-        return (bool)$this->_silent;
-    }
-
-    /**
-     * Method for ask client about rewrite all files.
-     *
-     * @param string $string
-     * @return void
-     */
-    public function confirm($string)
-    {
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Frontend/CLI.php b/downloader/lib/Magento/Framework/Connect/Frontend/CLI.php
deleted file mode 100644
index b70d7e0bc079db931d4ba560a1397fee8bca3752..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Frontend/CLI.php
+++ /dev/null
@@ -1,468 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Frontend;
-
-/**
- * CLI Frontend implementation
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class CLI extends \Magento\Framework\Connect\Frontend
-{
-    /**
-     * Collected output
-     *
-     * @var array
-     */
-    protected $_output = array();
-
-    /**
-     * Output error
-     *
-     * @param string $command
-     * @param string $message
-     * @return void
-     */
-    public function doError($command, $message)
-    {
-        parent::doError($command, $message);
-        $this->writeln("Error: ");
-        $this->writeln("{$command}: {$message}");
-    }
-
-    /**
-     * Output config help
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputConfigHelp($data)
-    {
-        foreach ($data['data'] as $k => $v) {
-            if (is_scalar($v)) {
-                $this->writeln($v);
-            } elseif (is_array($v)) {
-                $this->writeln(implode(": ", $v));
-            }
-        }
-    }
-
-    /**
-     * Output info
-     * @param array $data
-     * @return void
-     */
-    public function outputRemoteInfo($data)
-    {
-        if (!is_array($data['releases'])) {
-            return;
-        }
-        foreach ($data['releases'] as $r) {
-            $this->writeln(implode(" ", $r));
-        }
-    }
-
-    /**
-     * @param string $type
-     * @return string
-     */
-    public function detectMethodByType($type)
-    {
-        $defaultMethod = "output";
-        $methodMap = array(
-            'list-upgrades' => 'outputUpgrades',
-            'list-available' => 'outputChannelsPackages',
-            'list-installed' => 'writeInstalledList',
-            'package-dependencies' => 'outputPackageDeps',
-            'package-prepare' => 'outputPackagePrepare',
-            'list-files' => 'outputPackageContents',
-            'config-help' => 'outputConfigHelp',
-            'info' => 'outputRemoteInfo',
-            'config-show' => 'outputConfig',
-            'install' => 'outputInstallResult',
-            'install-file' => 'outputInstallResult',
-            'upgrade' => 'outputInstallResult',
-            'upgrade-all' => 'outputInstallResult',
-            'uninstall' => 'outputDeleted',
-            'list-channels' => 'outputListChannels'
-        );
-        if (isset($methodMap[$type])) {
-            return $methodMap[$type];
-        }
-        return $defaultMethod;
-    }
-
-    /**
-     * @param array $data
-     * @return void
-     */
-    public function outputDeleted($data)
-    {
-        if (!count($data['data'])) {
-            return;
-        }
-        $this->writeln($data['title']);
-        foreach ($data['data'] as $row) {
-            $this->writeln("{$row['0']}/{$row['1']}");
-        }
-    }
-
-    /**
-     * @param array $data
-     * @return void
-     */
-    public function outputListChannels($data)
-    {
-        $this->writeln($data['title']);
-
-        $channels =& $data['data'][\Magento\Framework\Connect\Singleconfig::K_CHAN];
-        foreach ($channels as $name => $v) {
-            $this->writeln("{$name}: {$v[\Magento\Framework\Connect\Singleconfig::K_URI]}");
-        }
-        $aliases =& $data['data'][\Magento\Framework\Connect\Singleconfig::K_CHAN_ALIAS];
-        if (count($aliases)) {
-            $this->writeln();
-            $this->writeln($data['title_aliases']);
-            foreach ($aliases as $k => $v) {
-                $this->writeln("{$k} => {$v}");
-            }
-        }
-    }
-
-    /**
-     * Output install result
-     * @param array $data
-     * @return void
-     */
-    public function outputInstallResult($data)
-    {
-        if (isset($data['title'])) {
-            $title = trim($data['title']) . " ";
-        } else {
-            $title = '';
-        }
-        foreach ($data['assoc'] as $row) {
-            $this->printf("%s%s/%s %s\n", $title, $row['channel'], $row['name'], $row['version']);
-        }
-    }
-
-    /**
-     * Ouptut package contents
-     * @param array $data
-     * @return void
-     */
-    public function outputPackageContents($data)
-    {
-        $this->writeln($data['title']);
-        foreach ($data['data'] as $file) {
-            $this->writeln($file);
-        }
-    }
-
-    /**
-     * Output package dependencies
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputPackageDeps($data)
-    {
-        $title = $data['title'];
-        $this->writeln($title);
-        foreach ($data['data'] as $package) {
-            $this->printf(
-                "%-20s %-20s %-20s %-20s\n",
-                $package['channel'],
-                $package['name'],
-                $package['min'],
-                $package['max']
-            );
-        }
-    }
-
-    /**
-     * Output package prepare
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputPackagePrepare($data)
-    {
-        $title = $data['title'];
-        $this->writeln($title);
-        foreach ($data['data'] as $package) {
-            $this->printf(
-                "%-20s %-20s %-20s %-20s\n",
-                $package['channel'],
-                $package['name'],
-                $package['version'],
-                $package['install_state']
-            );
-        }
-    }
-
-    /**
-     * Ouptut channel packages
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputChannelsPackages($data)
-    {
-        foreach ($data['data'] as $channelInfo) {
-            $title =& $channelInfo['title'];
-            $packages =& $channelInfo['packages'];
-            $this->writeln($title);
-            foreach ($packages as $name => $package) {
-                $releases =& $package['releases'];
-                $tmp = array();
-                foreach ($releases as $ver => $state) {
-                    $tmp[] = "{$ver} {$state}";
-                }
-                $tmp = implode(',', $tmp);
-                $this->writeln($name . ": " . $tmp);
-            }
-        }
-    }
-
-    /**
-     * Make output
-     *
-     * @param array $data
-     * @return void
-     */
-    public function output($data)
-    {
-        $capture = $this->isCapture();
-        if ($capture) {
-            $this->_output[] = $data;
-            return;
-        }
-
-        if (is_array($data)) {
-            foreach ($data as $type => $params) {
-                $method = $this->detectMethodByType($type);
-                if ($method) {
-                    $this->{$method}($params);
-                } else {
-                    $this->writeln(__METHOD__ . " handler not found for {$type}");
-                }
-            }
-        } else {
-            $this->writeln($data);
-        }
-    }
-
-    /**
-     * Detailed package info
-     * @param \Magento\Framework\Connect\Package $package
-     * @return void
-     */
-    public function outputPackage($package)
-    {
-        $fields = array(
-            'Name' => 'name',
-            'Version' => 'version',
-            'Stability' => 'stability',
-            'Description' => 'description',
-            'Date' => 'date',
-            'Authors' => 'authors'
-        );
-
-        foreach ($fields as $title => $fld) {
-            $method = "get" . ucfirst($fld);
-            $data = $package->{$method}();
-            if (empty($data)) {
-                continue;
-            }
-            $this->write($title . ": ");
-            if (is_array($data)) {
-                $this->write(print_r($data, true));
-            } else {
-                $this->write($data);
-            }
-            $this->writeln('');
-        }
-    }
-
-    /**
-     * Write channels list
-     * @param array $data
-     * @return void
-     */
-    public function writeChannelsList($data)
-    {
-        $this->writeln("Channels available: ");
-        $this->writeln("===================");
-        $out = $data['byName'];
-        ksort($out);
-        foreach ($out as $k => $v) {
-            $this->printf("%-20s %-20s\n", $k, $v);
-        }
-    }
-
-    /**
-     * Write installed list
-     * @param array $data
-     * @return void
-     */
-    public function writeInstalledList($data)
-    {
-        $totalCount = 0;
-        foreach ($data['data'] as $channel => $packages) {
-            $title = sprintf($data['channel-title'], $channel);
-            $c = count($packages);
-            $totalCount += $c;
-            if (!$c) {
-                continue;
-            }
-            $this->writeln($title);
-            foreach ($packages as $name => $row) {
-                $this->printf("%-20s %-20s\n", $name, $row['version'] . " " . $row['stability']);
-            }
-        }
-        if ($totalCount === 0) {
-            $this->writeln("No installed packages");
-        }
-    }
-
-    /**
-     * Output commands list
-     * @param array $data
-     * @return void
-     */
-    public function outputCommandList($data)
-    {
-        $this->writeln("Connect commands available:");
-        $this->writeln("===========================");
-        foreach ($data as $k => $v) {
-            $this->printf("%-20s %-20s\n", $k, $v['summary']);
-        }
-    }
-
-    /**
-     * Output config
-     * @param array $data
-     * @return void
-     */
-    public function outputConfig($data)
-    {
-        foreach ($data['data'] as $name => $row) {
-            $value = $row['value'] === '' ? "<not set>" : strval($row['value']);
-            $this->printf("%-30s %-20s %-20s\n", $row['prompt'], $name, $value);
-        }
-    }
-
-    /**
-     * Output config variable
-     * @param string $key
-     * @param string $value
-     * @return void
-     */
-    public function outputConfigVariable($key, $value)
-    {
-        if ($value === '') {
-            $value = '<not set>';
-        }
-        $this->writeln("Config variable '{$key}': {$value}");
-    }
-
-    /**
-     * Write data and "\n" afterwards
-     * @param string $data
-     * @return void
-     */
-    public function writeln($data = '')
-    {
-        $this->write($data . "\n");
-    }
-
-    /**
-     * Get output, clear if needed
-     *
-     * @param bool $clearPrevious optional, true by default
-     * @return array
-     */
-    public function getOutput($clearPrevious = true)
-    {
-        $out = $this->_output;
-        if ($clearPrevious) {
-            $this->_output = array();
-        }
-        return $out;
-    }
-
-    /**
-     * Write data to console
-     * @param string $data
-     * @return void
-     */
-    public function write($data)
-    {
-        if ($this->isSilent()) {
-            return;
-        }
-        echo $data;
-    }
-
-    /**
-     * Output printf-stlye formatted string and args
-     * @return void
-     */
-    public function printf()
-    {
-        $args = func_get_args();
-        $this->write(call_user_func_array('sprintf', $args));
-    }
-
-    /**
-     * Readline from console
-     * @return string
-     */
-    public function readln()
-    {
-        $out = "";
-        $key = fgetc(STDIN);
-        while ($key != "\n") {
-            $out .= $key;
-            $key = fread(STDIN, 1);
-        }
-        return $out;
-    }
-
-    /**
-     * Output upgrades
-     * @param array $data
-     * @return void
-     */
-    public function outputUpgrades($data)
-    {
-        foreach ($data['data'] as $chan => $packages) {
-            $this->writeln("Updates for " . $chan . ": ");
-            foreach ($packages as $name => $data) {
-                $this->writeln("  {$name}: {$data['from']} => {$data['to']}");
-            }
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Ftp.php b/downloader/lib/Magento/Framework/Connect/Ftp.php
deleted file mode 100644
index 4de76ebe9219beb9d7f6397d2d3fac3a1ca424d1..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Ftp.php
+++ /dev/null
@@ -1,531 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to work with remote FTP server
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Ftp
-{
-    /**
-     * Connection object
-     *
-     * @var resource
-     */
-    protected $_conn = false;
-
-    /**
-     * Check connected, throw exception if not
-     *
-     * @throws \Exception
-     * @return null
-     */
-    protected function checkConnected()
-    {
-        if (!$this->_conn) {
-            throw new \Exception(__CLASS__ . " - no connection established with server");
-        }
-    }
-
-    /**
-     * ftp_mkdir wrapper
-     *
-     * @param string $name
-     * @return string
-     */
-    public function mdkir($name)
-    {
-        $this->checkConnected();
-        return @ftp_mkdir($this->_conn, $name);
-    }
-
-    /**
-     * Make dir recursive
-     *
-     * @param string $path
-     * @param int $mode
-     * @return bool
-     */
-    public function mkdirRecursive($path, $mode = 0777)
-    {
-        $this->checkConnected();
-        $dir = explode('/', $path);
-        $path = "";
-        $ret = true;
-        for ($i = 0; $i < count($dir); $i++) {
-            $path .= "/" . $dir[$i];
-            if (!@ftp_chdir($this->_conn, $path)) {
-                @ftp_chdir($this->_conn, "/");
-                if (!@ftp_mkdir($this->_conn, $path)) {
-                    $ret = false;
-                    break;
-                } else {
-                    @ftp_chmod($this->_conn, $mode, $path);
-                }
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Try to login to server
-     *
-     * @param string $login
-     * @param string $password
-     * @throws \Exception on invalid login credentials
-     * @return bool
-     */
-    public function login($login = "anonymous", $password = "test@gmail.com")
-    {
-        $this->checkConnected();
-        $res = @ftp_login($this->_conn, $login, $password);
-        if (!$res) {
-            throw new \Exception("Invalid login credentials");
-        }
-        return $res;
-    }
-
-    /**
-     * Validate connection string
-     *
-     * @param string $string
-     * @throws \Exception
-     * @return string
-     */
-    public function validateConnectionString($string)
-    {
-        if (empty($string)) {
-            throw new \Exception("Connection string is empty");
-        }
-        $data = parse_url($string);
-        if (false === $data) {
-            throw new \Exception("Connection string invalid: '{$string}'");
-        }
-        if ($data['scheme'] != 'ftp') {
-            throw new \Exception("Support for scheme '{$data['scheme']}' unsupported");
-        }
-        return $data;
-    }
-
-    /**
-     * Connect to server using connect string
-     * Connection string: ftp://user:pass@server:port/path
-     * user,pass,port,path are optional parts
-     *
-     * @param string $string
-     * @param int $timeout
-     * @return null
-     */
-    public function connect($string, $timeout = 90)
-    {
-        $params = $this->validateConnectionString($string);
-        $port = isset($params['port']) ? intval($params['port']) : 21;
-
-        $this->_conn = @ftp_connect($params['host'], $port, $timeout);
-
-        if (!$this->_conn) {
-            throw new \Exception("Cannot connect to host: {$params['host']}");
-        }
-        ftp_pasv($this->_conn, true);
-        if (isset($params['user']) && isset($params['pass'])) {
-            $this->login($params['user'], $params['pass']);
-        } else {
-            $this->login();
-        }
-        if (isset($params['path'])) {
-            if (!$this->chdir($params['path'])) {
-                throw new \Exception("Cannot chdir after login to: {$params['path']}");
-            }
-        }
-    }
-
-    /**
-     * ftp_fput wrapper
-     *
-     * @param string $remoteFile
-     * @param resource $handle
-     * @param int $mode  FTP_BINARY | FTP_ASCII
-     * @param int $startPos
-     * @return bool
-     */
-    public function fput($remoteFile, $handle, $mode = FTP_BINARY, $startPos = 0)
-    {
-        $this->checkConnected();
-        return @ftp_fput($this->_conn, $remoteFile, $handle, $mode, $startPos);
-    }
-
-    /**
-     * ftp_put wrapper
-     *
-     * @param string $remoteFile
-     * @param string $localFile
-     * @param int $mode FTP_BINARY | FTP_ASCII
-     * @param int $startPos
-     * @return bool
-     */
-    public function put($remoteFile, $localFile, $mode = FTP_BINARY, $startPos = 0)
-    {
-        $this->checkConnected();
-        return @ftp_put($this->_conn, $remoteFile, $localFile, $mode, $startPos);
-    }
-
-    /**
-     * Get current working directory
-     *
-     * @return string
-     */
-    public function getcwd()
-    {
-        $d = $this->raw("pwd");
-        $data = explode(" ", $d[0], 3);
-        if (empty($data[1])) {
-            return false;
-        }
-        if (intval($data[0]) != 257) {
-            return false;
-        }
-        $out = trim($data[1], '"');
-        if ($out !== "/") {
-            $out = rtrim($out, "/");
-        }
-        return $out;
-    }
-
-    /**
-     * ftp_raw wrapper
-     *
-     * @param string $cmd
-     * @return array
-     */
-    public function raw($cmd)
-    {
-        $this->checkConnected();
-        return @ftp_raw($this->_conn, $cmd);
-    }
-
-    /**
-     * Upload local file to remote server.
-     * Can be used for relative and absoulte remote paths
-     * Relative: use chdir before calling this
-     *
-     * @param string $remote
-     * @param string $local
-     * @param int $dirMode
-     * @param int $fileMode
-     * @return bool
-     */
-    public function upload($remote, $local, $dirMode = 0777, $fileMode = 0)
-    {
-        $this->checkConnected();
-
-        if (!file_exists($local)) {
-            throw new \Exception("Local file doesn't exist: {$local}");
-        }
-        if (!is_readable($local)) {
-            throw new \Exception("Local file is not readable: {$local}");
-        }
-        if (is_dir($local)) {
-            throw new \Exception("Directory given instead of file: {$local}");
-        }
-
-        $globalPathMode = substr($remote, 0, 1) == "/";
-        $dirname = dirname($remote);
-        $cwd = $this->getcwd();
-        if (false === $cwd) {
-            throw new \Exception("Server returns something awful on PWD command");
-        }
-
-        if (!$globalPathMode) {
-            $dirname = $cwd . "/" . $dirname;
-            $remote = $cwd . "/" . $remote;
-        }
-        $res = $this->mkdirRecursive($dirname, $dirMode);
-        $this->chdir($cwd);
-
-        if (!$res) {
-            return false;
-        }
-        $res = $this->put($remote, $local);
-
-        if (!$res) {
-            return false;
-        }
-
-        if ($fileMode) {
-            $res = $this->chmod($fileMode, $remote);
-        }
-        return (bool)$res;
-    }
-
-    /**
-     * Download remote file to local machine
-     *
-     * @param string $remote
-     * @param string $local
-     * @param int $ftpMode  FTP_BINARY|FTP_ASCII
-     * @return bool
-     */
-    public function download($remote, $local, $ftpMode = FTP_BINARY)
-    {
-        $this->checkConnected();
-        return $this->get($local, $remote, $ftpMode);
-    }
-
-    /**
-     * ftp_pasv wrapper
-     *
-     * @param bool $pasv
-     * @return bool
-     */
-    public function pasv($pasv)
-    {
-        $this->checkConnected();
-        return @ftp_pasv($this->_conn, (bool)$pasv);
-    }
-
-    /**
-     * Close FTP connection
-     *
-     * @return null
-     */
-    public function close()
-    {
-        if ($this->_conn) {
-            @ftp_close($this->_conn);
-        }
-    }
-
-    /**
-     * ftp_chmod wrapper
-     *
-     * @param int $mode
-     * @param string $remoteFile
-     * @return bool
-     */
-    public function chmod($mode, $remoteFile)
-    {
-        $this->checkConnected();
-        return @ftp_chmod($this->_conn, $mode, $remoteFile);
-    }
-
-    /**
-     * ftp_chdir wrapper
-     *
-     * @param string $dir
-     * @return bool
-     */
-    public function chdir($dir)
-    {
-        $this->checkConnected();
-        return @ftp_chdir($this->_conn, $dir);
-    }
-
-    /**
-     * ftp_cdup wrapper
-     *
-     * @return bool
-     */
-    public function cdup()
-    {
-        $this->checkConnected();
-        return @ftp_cdup($this->_conn);
-    }
-
-    /**
-     * ftp_get wrapper
-     *
-     * @param string $localFile
-     * @param string $remoteFile
-     * @param int $fileMode         FTP_BINARY | FTP_ASCII
-     * @param int $resumeOffset
-     * @return bool
-     */
-    public function get($localFile, $remoteFile, $fileMode = FTP_BINARY, $resumeOffset = 0)
-    {
-        $remoteFile = $this->correctFilePath($remoteFile);
-        $this->checkConnected();
-        return @ftp_get($this->_conn, $localFile, $remoteFile, $fileMode, $resumeOffset);
-    }
-
-    /**
-     * ftp_nlist wrapper
-     *
-     * @param string $dir
-     * @return bool
-     */
-    public function nlist($dir = "/")
-    {
-        $this->checkConnected();
-        $dir = $this->correctFilePath($dir);
-        return @ftp_nlist($this->_conn, $dir);
-    }
-
-    /**
-     * ftp_rawlist wrapper
-     *
-     * @param string $dir
-     * @param bool $recursive
-     * @return array
-     */
-    public function rawlist($dir = "/", $recursive = false)
-    {
-        $this->checkConnected();
-        $dir = $this->correctFilePath($dir);
-        return @ftp_rawlist($this->_conn, $dir, $recursive);
-    }
-
-    /**
-     * Convert byte count to float KB/MB format
-     *
-     * @param int $bytes
-     * @return string
-     */
-    public static function byteconvert($bytes)
-    {
-        $symbol = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
-        $exp = floor(log($bytes) / log(1024));
-        return sprintf('%.2f ' . $symbol[$exp], $bytes / pow(1024, floor($exp)));
-    }
-
-    /**
-     * Chmod string "-rwxrwxrwx" to "777" converter
-     *
-     * @param string $chmod
-     * @return string
-     */
-    public static function chmodnum($chmod)
-    {
-        $trans = array('-' => '0', 'r' => '4', 'w' => '2', 'x' => '1');
-        $chmod = substr(strtr($chmod, $trans), 1);
-        $array = str_split($chmod, 3);
-        return array_sum(str_split($array[0])) . array_sum(str_split($array[1])) . array_sum(str_split($array[2]));
-    }
-
-    /**
-     * Checks file exists
-     *
-     * @param string $path
-     * @param bool $excludeIfIsDir
-     * @return bool
-     */
-    public function fileExists($path, $excludeIfIsDir = true)
-    {
-        $path = $this->correctFilePath($path);
-        $globalPathMode = substr($path, 0, 1) == "/";
-
-        $file = basename($path);
-        $dir = $globalPathMode ? dirname($path) : $this->getcwd() . "/" . ($path == basename($path) ? '' : $path);
-        $data = $this->ls($dir);
-        foreach ($data as $row) {
-            if ($file == basename($row['name'])) {
-                if ($excludeIfIsDir && $row['dir']) {
-                    continue;
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Get directory contents in PHP array
-     *
-     * @param string $dir
-     * @param bool $recursive
-     * @return array
-     */
-    public function ls($dir = "/", $recursive = false)
-    {
-        $dir = $this->correctFilePath($dir);
-        $rawfiles = (array)$this->rawlist($dir, $recursive);
-        $structure = array();
-        $arraypointer =& $structure;
-        foreach ($rawfiles as $rawfile) {
-            if ($rawfile[0] == '/') {
-                $paths = array_slice(explode('/', str_replace(':', '', $rawfile)), 1);
-                $arraypointer =& $structure;
-                foreach ($paths as $path) {
-                    foreach ($arraypointer as $i => $file) {
-                        if ($file['name'] == $path) {
-                            $arraypointer =& $arraypointer[$i]['children'];
-                            break;
-                        }
-                    }
-                }
-            } elseif (!empty($rawfile)) {
-                $info = preg_split("/[\s]+/", $rawfile, 9);
-                $arraypointer[] = array(
-                    'name' => $info[8],
-                    'dir' => $info[0][0] == 'd',
-                    'size' => (int)$info[4],
-                    'chmod' => self::chmodnum($info[0]),
-                    'rawdata' => $info,
-                    'raw' => $rawfile
-                );
-            }
-        }
-        return $structure;
-    }
-
-    /**
-     * Correct file path
-     *
-     * @param string $str
-     * @return string
-     */
-    public function correctFilePath($str)
-    {
-        $str = str_replace("\\", "/", $str);
-        $str = preg_replace("/^.\//", "", $str);
-        return $str;
-    }
-
-    /**
-     * Delete file
-     *
-     * @param string $file
-     * @return bool
-     */
-    public function delete($file)
-    {
-        $this->checkConnected();
-        $file = $this->correctFilePath($file);
-        return @ftp_delete($this->_conn, $file);
-    }
-
-    /**
-     * Remove directory
-     *
-     * @param string $dir
-     * @return bool
-     */
-    public function rmdir($dir)
-    {
-        $this->checkConnected();
-        $dir = $this->correctFilePath($dir);
-        return @ftp_rmdir($this->_conn, $dir);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Loader.php b/downloader/lib/Magento/Framework/Connect/Loader.php
deleted file mode 100644
index f31e7a1dd34bf322d1249cd70e5702d4d069ac01..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Loader.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class for loader which using in the Rest
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect;
-
-class Loader
-{
-    /**
-     * Factory for HTTP client
-     *
-     * @param string|false $protocol  'curl'/'socket' or false for auto-detect
-     * @return \Magento\Framework\HTTP\IClient|\Magento\Framework\Connect\Loader\Ftp
-     */
-    public static function getInstance($protocol = '')
-    {
-        if ($protocol == 'ftp') {
-            return new \Magento\Framework\Connect\Loader\Ftp();
-        } else {
-            return \Magento\Framework\HTTP\Client::getInstance();
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Loader/Ftp.php b/downloader/lib/Magento/Framework/Connect/Loader/Ftp.php
deleted file mode 100644
index 8b4cbf498fba5bf644c36e41c9314602a8c34de4..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Loader/Ftp.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Loader;
-
-/**
- * Class for ftp loader which using in the Rest
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Ftp
-{
-    const TEMPORARY_DIR = '../var/package/tmp';
-
-    const FTP_USER = 'anonymous';
-
-    const FTP_PASS = 'test@gmail.com';
-
-    /**
-     * Object of Ftp
-     *
-     * @var \Magento\Framework\Connect\Ftp
-     */
-    protected $_ftp = null;
-
-    /**
-     * User name
-     * @var string
-     */
-    protected $_ftpUser = '';
-
-    /**
-     * User password
-     * @var string
-     */
-    protected $_ftpPassword = '';
-
-    /**
-     * Response body
-     * @var string
-     */
-    protected $_responseBody = '';
-
-    /**
-     * Response status
-     * @var int
-     */
-    protected $_responseStatus = 0;
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $this->_ftp = new \Magento\Framework\Connect\Ftp();
-        $this->_ftpUser = self::FTP_USER;
-        $this->_ftpPassword = self::FTP_PASS;
-    }
-
-    /**
-     * @return \Magento\Framework\Connect\Ftp|null
-     */
-    public function getFtp()
-    {
-        return $this->_ftp;
-    }
-
-    /**
-     * Retrieve file from URI
-     *
-     * @param mixed $uri
-     * @return bool
-     */
-    public function get($uri)
-    {
-        $remoteFile = basename($uri);
-        $uri = dirname($uri);
-        $uri = str_replace('http://', '', $uri);
-        $uri = str_replace('https://', '', $uri);
-        $uri = str_replace('ftp://', '', $uri);
-        $uri = $this->_ftpUser . ":" . $this->_ftpPassword . "@" . $uri;
-        $this->getFtp()->connect("ftp://" . $uri);
-        $this->getFtp()->pasv(true);
-        $tmpDir = self::TEMPORARY_DIR . '/';
-        if (!is_dir($tmpDir)) {
-            $tmpDir = sys_get_temp_dir();
-        }
-        if (substr($tmpDir, -1) != '/') {
-            $tmpDir .= '/';
-        }
-        $localFile = $tmpDir . time() . ".xml";
-
-        if ($this->getFtp()->get($localFile, $remoteFile)) {
-            $this->_responseBody = file_get_contents($localFile);
-            $this->_responseStatus = 200;
-        }
-        @unlink($localFile);
-        $this->getFtp()->close();
-        return $this;
-    }
-
-    /**
-     * Get response status code
-     *
-     * @return string
-     */
-    public function getStatus()
-    {
-        return $this->_responseStatus;
-    }
-
-    /**
-     * put your comment there...
-     *
-     * @return string
-     */
-    public function getBody()
-    {
-        return $this->_responseBody;
-    }
-
-    /**
-     * Set login credentials for ftp auth.
-     * @param string $ftpLogin Ftp User account name
-     * @param string $ftpPassword User password
-     * @return string
-     */
-    public function setCredentials($ftpLogin, $ftpPassword)
-    {
-        $this->_ftpUser = $ftpLogin;
-        $this->_ftpPassword = $ftpPassword;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Package.php b/downloader/lib/Magento/Framework/Connect/Package.php
deleted file mode 100644
index 7a25caadcf9b10ff19f4e29835977e84f426fdf0..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Package.php
+++ /dev/null
@@ -1,1533 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-use Magento\Framework\Connect\Package\Target;
-
-/**
- * Class to work with Magento Connect packages
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Package
-{
-    const PACKAGE_XML_DIR = 'var/package';
-
-    /**
-     * Contain \SimpleXMLElement for composing document.
-     *
-     * @var \SimpleXMLElement
-     */
-    protected $_packageXml;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_authors;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_contents;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_hashContents;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_compatible;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_dependencyPhpExtensions;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_dependencyPackages;
-
-    /**
-     * A helper object that can read from a package archive
-     *
-     * @var \Magento\Framework\Connect\Package\Reader
-     */
-    protected $_reader;
-
-    /**
-     * A helper object that can create and write to a package archive
-     *
-     * @var \Magento\Framework\Connect\Package\Writer
-     */
-    protected $_writer;
-
-    /**
-     * Validator object
-     *
-     * @var \Magento\Framework\Connect\Validator
-     */
-    protected $_validator = null;
-
-    /**
-     * Validation errors
-     *
-     * @var array
-     */
-    protected $_validationErrors = array();
-
-    /**
-     * Object with target
-     *
-     * @var Target
-     */
-    protected $_target = null;
-
-    /**
-     * Config object
-     *
-     * @var \Magento\Framework\Connect\Config
-     */
-    protected $_config = null;
-
-    /**
-     * General purpose Magento util
-     *
-     * @var \Magento\Framework\Util
-     */
-    protected $_util = null;
-
-    /**
-     * Creates a package object (empty, or from existing archive, or from package definition xml)
-     *
-     * @param null|string|resource $source
-     * @param \Magento\Framework\Util|null $util
-     * @throws \Magento\Framework\Exception
-     */
-    public function __construct($source = null, \Magento\Framework\Util $util = null)
-    {
-        $this->_util = $util ? $util : new \Magento\Framework\Util();
-        libxml_use_internal_errors(true);
-
-        if (is_string($source)) {
-            // check what's in the string (a package definition or a package filename)
-            if (0 === strpos($source, "<?xml")) {
-                // package definition xml
-                $this->_init($source);
-            } elseif (is_file($source) && is_readable($source)) {
-                // package archive filename
-                $this->_loadFile($source);
-            } else {
-                throw new \Magento\Framework\Exception('Invalid package source');
-            }
-        } elseif (is_resource($source)) {
-            $this->_loadResource($source);
-        } elseif (is_null($source)) {
-            $this->_init();
-        } else {
-            throw new \Magento\Framework\Exception('Invalid package source');
-        }
-    }
-
-    /**
-     * Initializes an empty package object
-     *
-     * @param null|string $definition optional package definition xml
-     * @return $this
-     */
-    protected function _init($definition = null)
-    {
-
-        if (!is_null($definition)) {
-            $this->_packageXml = simplexml_load_string($definition);
-        } else {
-            $packageXmlStub = <<<END
-<?xml version="1.0"?>
-<package>
-    <name />
-    <version />
-    <stability />
-    <license />
-    <channel />
-    <extends />
-    <summary />
-    <description />
-    <notes />
-    <authors />
-    <date />
-    <time />
-    <contents />
-    <compatible />
-    <dependencies />
-</package>
-END;
-            $this->_packageXml = simplexml_load_string($packageXmlStub);
-        }
-        return $this;
-    }
-
-    /**
-     * Loads a package from specified file
-     *
-     * @param string $filename
-     * @return $this
-     */
-    protected function _loadFile($filename = '')
-    {
-        if (is_null($this->_reader)) {
-            $this->_reader = new \Magento\Framework\Connect\Package\Reader($filename);
-        }
-        $content = $this->_reader->load();
-        $this->_packageXml = simplexml_load_string($content);
-        return $this;
-    }
-
-    /**
-     * Creates a package and saves it
-     *
-     * @param string $path
-     * @return $this
-     */
-    public function save($path)
-    {
-        $this->validate();
-        $path = rtrim($path, "\\/") . '/';
-        $this->_savePackage($path);
-        return $this;
-    }
-
-    /**
-     * Creates a package archive and saves it to specified path
-     *
-     * @param string $path
-     * @return $this
-     */
-    protected function _savePackage($path)
-    {
-        $fileName = $this->getReleaseFilename();
-        if (is_null($this->_writer)) {
-            $this->_writer = new \Magento\Framework\Connect\Package\Writer($this->getContents(), $path . $fileName);
-        }
-        $this->_writer->composePackage()->addPackageXml($this->getPackageXml())->archivePackage();
-        return $this;
-    }
-
-    /**
-     * Retrieve Target object
-     *
-     * @return Target
-     */
-    protected function getTarget()
-    {
-        if (!$this->_target instanceof Target) {
-            $this->_target = new Target();
-        }
-        return $this->_target;
-    }
-
-    /**
-     * @param Target $arg
-     * @return void
-     */
-    public function setTarget($arg)
-    {
-        if ($arg instanceof Target) {
-            $this->_target = $arg;
-        }
-    }
-
-    /* Mutators */
-
-    /**
-     * Puts value to name
-     *
-     * @param string $name
-     * @return $this
-     */
-    public function setName($name)
-    {
-        $this->_packageXml->name = $name;
-        return $this;
-    }
-
-    /**
-     * Puts value to <channel />
-     *
-     * @param string $channel
-     * @return $this
-     */
-    public function setChannel($channel)
-    {
-        $this->_packageXml->channel = $channel;
-        return $this;
-    }
-
-    /**
-     * Puts value to <summary />
-     *
-     * @param string $summary
-     * @return $this
-     */
-    public function setSummary($summary)
-    {
-        $this->_packageXml->summary = $summary;
-        return $this;
-    }
-
-    /**
-     * Puts value to <description />
-     *
-     * @param string $description
-     * @return $this
-     */
-    public function setDescription($description)
-    {
-        $this->_packageXml->description = $description;
-        return $this;
-    }
-
-    /**
-     * Puts value to <authors />
-     *
-     * array(
-     *     array('name'=>'Name1', 'user'=>'User1', 'email'=>'email1@email.com'),
-     *     array('name'=>'Name2', 'user'=>'User2', 'email'=>'email2@email.com'),
-     * );
-     *
-     * @param array $authors
-     * @return $this
-     */
-    public function setAuthors($authors)
-    {
-        $this->_authors = $authors;
-        foreach ($authors as $_author) {
-            $this->addAuthor($_author['name'], $_author['user'], $_author['email']);
-        }
-        return $this;
-    }
-
-    /**
-     * Add author to <authors/>
-     *
-     * @param string $name
-     * @param string $user
-     * @param string $email
-     * @return $this
-     */
-    public function addAuthor($name = null, $user = null, $email = null)
-    {
-        $this->_authors[] = array('name' => $name, 'user' => $user, 'email' => $email);
-        $author = $this->_packageXml->authors->addChild('author');
-        $author->addChild('name', $name);
-        $author->addChild('user', $user);
-        $author->addChild('email', $email);
-        return $this;
-    }
-
-    /**
-     * Puts value to <date/>. Format should be Y-M-D.
-     *
-     * @param string $date
-     * @return $this
-     */
-    public function setDate($date)
-    {
-        $this->_packageXml->date = $date;
-        return $this;
-    }
-
-    /**
-     * Puts value to <time />. Format should be H:i:s.
-     *
-     * @param string $time
-     * @return $this
-     */
-    public function setTime($time)
-    {
-        $this->_packageXml->time = $time;
-        return $this;
-    }
-
-    /**
-     * Puts value to <version/>. Format should be X.Y.Z.
-     *
-     * @param string $version
-     * @return $this
-     */
-    public function setVersion($version)
-    {
-        $this->_packageXml->version = $version;
-        return $this;
-    }
-
-    /**
-     * Puts value to <stability/>. It can be alpha, beta, devel and stable.
-     *
-     * @param string $stability
-     * @return $this
-     */
-    public function setStability($stability)
-    {
-        $this->_packageXml->stability = $stability;
-        return $this;
-    }
-
-    /**
-     * Puts value to <license/>, also method can used for set attribute URI.
-     *
-     * @param string $license
-     * @param string $uri
-     * @return $this
-     */
-    public function setLicense($license, $uri = null)
-    {
-        $this->_packageXml->license = $license;
-        if ($uri) {
-            $this->_packageXml->license['uri'] = $uri;
-        }
-        return $this;
-    }
-
-    /**
-     * Puts value to <notes/>.
-     *
-     * @param string $notes
-     * @return $this
-     */
-    public function setNotes($notes)
-    {
-        $this->_packageXml->notes = $notes;
-        return $this;
-    }
-
-    /**
-     * Retrieve \SimpleXMLElement node by xpath. If it absent, create new.
-     * For comparing nodes method uses attribute "name" in each nodes.
-     * If attribute "name" is same for both nodes, nodes are same.
-     *
-     * @param string $tag
-     * @param \SimpleXMLElement $parent
-     * @param string $name
-     * @return \SimpleXMLElement
-     */
-    protected function _getNode($tag, $parent, $name = '')
-    {
-        $found = false;
-        foreach ($parent->xpath($tag) as $_node) {
-            if ($_node['name'] == $name) {
-                $node = $_node;
-                $found = true;
-                break;
-            }
-        }
-        if (!$found) {
-            $node = $parent->addChild($tag);
-            if ($name) {
-                $node->addAttribute('name', $name);
-            }
-        }
-        return $node;
-    }
-
-    /**
-     * Add directory or file to <contents />.
-     *
-     * @param string $path Path to directory or file
-     * @param string $targetName Target name.
-     * @param string $hash MD5 hash of the file
-     * @return $this
-     */
-    public function addContent($path, $targetName)
-    {
-        $found = false;
-        $parent = $this->_getNode('target', $this->_packageXml->contents, $targetName);
-        $source = str_replace('\\', '/', $path);
-        $directories = explode('/', dirname($source));
-        foreach ($directories as $directory) {
-            $parent = $this->_getNode('dir', $parent, $directory);
-        }
-        $fileName = basename($source);
-        if ($fileName != '') {
-            $fileNode = $parent->addChild('file');
-            $fileNode->addAttribute('name', $fileName);
-            $targetDir = $this->getTarget()->getTargetUri($targetName);
-            $hash = md5_file($targetDir . '/' . $path);
-            $fileNode->addAttribute('hash', $hash);
-        }
-        return $this;
-    }
-
-    /**
-     * Add directory recursively (with subdirectory and file).
-     * Exclude and Include can be add using Regular Expression.
-     *
-     * @param string $targetName Target name
-     * @param string $targetDir Path for target name
-     * @param string $path Path to directory
-     * @param string $exclude Exclude
-     * @param string $include Include
-     * @return $this
-     */
-    public function addContentDir($targetName, $path, $exclude = null, $include = null)
-    {
-        $targetDir = $this->getTarget()->getTargetUri($targetName);
-        $targetDirLen = strlen($targetDir . '/');
-        //get all subdirectories and files.
-        $entries = @glob($targetDir . '/' . $path . '/' . "{,.}*", GLOB_BRACE);
-        if (!empty($entries)) {
-            foreach ($entries as $entry) {
-                $filePath = substr($entry, $targetDirLen);
-                if (!empty($include) && !preg_match($include, $filePath)) {
-                    continue;
-                }
-                if (!empty($exclude) && preg_match($exclude, $filePath)) {
-                    continue;
-                }
-                if (is_dir($entry)) {
-                    $baseName = basename($entry);
-                    if ('.' === $baseName || '..' === $baseName) {
-                        continue;
-                    }
-                    //for subdirectory call method recursively
-                    $this->addContentDir($targetName, $filePath, $exclude, $include);
-                } elseif (is_file($entry)) {
-                    $this->addContent($filePath, $targetName);
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Add value to <compatible />.
-     *
-     * @param string $packageName
-     * @param string $channel
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @return $this
-     */
-    public function addCompatible($packageName, $channel, $minVersion, $maxVersion)
-    {
-        $package = $this->_packageXml->compatible->addChild('package');
-        $package->addChild('name', $packageName);
-        $package->addChild('channel', $channel);
-        $package->addChild('min', $minVersion);
-        $package->addChild('max', $maxVersion);
-        return $this;
-    }
-
-    /**
-     * Set dependency from php version.
-     *
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @return $this
-     */
-    public function setDependencyPhpVersion($minVersion, $maxVersion)
-    {
-        $parent = $this->_packageXml->dependencies;
-        $parent = $this->_getNode('required', $parent);
-        $parent = $this->_getNode('php', $parent);
-        $parent->addChild('min', $minVersion);
-        $parent->addChild('max', $maxVersion);
-        return $this;
-    }
-
-    /**
-     * Check PHP version restriction
-     * @param $phpVersion PHP_VERSION by default
-     * @return true | string
-     */
-    public function checkPhpVersion()
-    {
-        $min = $this->getDependencyPhpVersionMin();
-        $max = $this->getDependencyPhpVersionMax();
-
-        $minOk = $min ? version_compare(PHP_VERSION, $min, ">=") : true;
-        $maxOk = $max ? version_compare($this->_util->getTrimmedPhpVersion(), $max, "<=") : true;
-
-        if (!$minOk || !$maxOk) {
-            $err = "requires PHP version ";
-            if ($min && $max) {
-                $err .= " >= {$min} and <= {$max} ";
-            } elseif ($min) {
-                $err .= " >= {$min} ";
-            } elseif ($max) {
-                $err .= " <= {$max} ";
-            }
-            $err .= " current is: " . PHP_VERSION;
-            return $err;
-        }
-        return true;
-    }
-
-    /**
-     * Check PHP extensions availability
-     * @throws \Exception On failure
-     * @return true|array
-     */
-    public function checkPhpDependencies()
-    {
-        $errors = array();
-        foreach ($this->getDependencyPhpExtensions() as $dep) {
-            if (!extension_loaded($dep['name'])) {
-                $errors[] = $dep;
-            }
-        }
-        if (count($errors)) {
-            return $errors;
-        }
-        return true;
-    }
-
-    /**
-     * Set dependency from php extensions.
-     *
-     * $extension has next view:
-     * array('curl', 'mysql')
-     *
-     * @param array|string $extensions
-     * @return $this
-     */
-    public function setDependencyPhpExtensions($extensions)
-    {
-        foreach ($extensions as $_extension) {
-            $this->addDependencyExtension($_extension['name'], $_extension['min_version'], $_extension['max_version']);
-        }
-        return $this;
-    }
-
-    /**
-     * Set dependency from another packages.
-     *
-     * $packages should contain:
-     * array(
-     *     array('name'=>'test1', 'channel'=>'test1', 'min_version'=>'0.0.1', 'max_version'=>'0.1.0'),
-     *     array('name'=>'test2', 'channel'=>'test2', 'min_version'=>'0.0.1', 'max_version'=>'0.1.0'),
-     * )
-     *
-     * @param array $packages
-     * @param bool $clear
-     * @return $this
-     */
-    public function setDependencyPackages($packages, $clear = false)
-    {
-        if ($clear) {
-            unset($this->_packageXml->dependencies->required->package);
-        }
-
-        foreach ($packages as $_package) {
-
-            $filesArrayCondition = isset($_package['files']) && is_array($_package['files']);
-            $filesArray = $filesArrayCondition ? $_package['files'] : array();
-
-            $this->addDependencyPackage(
-                $_package['name'],
-                $_package['channel'],
-                $_package['min_version'],
-                $_package['max_version'],
-                $filesArray
-            );
-        }
-        return $this;
-    }
-
-    /**
-     * Add package to dependency packages.
-     *
-     * @param string $name
-     * @param string $channel
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @param array $files
-     * @return $this
-     */
-    public function addDependencyPackage($name, $channel, $minVersion, $maxVersion, $files = array())
-    {
-        $parent = $this->_packageXml->dependencies;
-        $parent = $this->_getNode('required', $parent);
-        $parent = $parent->addChild('package');
-        $parent->addChild('name', $name);
-        $parent->addChild('channel', $channel);
-        $parent->addChild('min', $minVersion);
-        $parent->addChild('max', $maxVersion);
-        if (count($files)) {
-            $parent = $parent->addChild('files');
-            foreach ($files as $row) {
-                if (!empty($row['target']) && !empty($row['path'])) {
-                    $node = $parent->addChild("file");
-                    $node["target"] = $row['target'];
-                    $node["path"] = $row['path'];
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Add package to dependency extension.
-     *
-     * @param string $name
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @return $this
-     */
-    public function addDependencyExtension($name, $minVersion, $maxVersion)
-    {
-        $parent = $this->_packageXml->dependencies;
-        $parent = $this->_getNode('required', $parent);
-        $parent = $parent->addChild('extension');
-        $parent->addChild('name', $name);
-        $parent->addChild('min', $minVersion);
-        $parent->addChild('max', $maxVersion);
-        return $this;
-    }
-
-    /* Accessors */
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getName()
-    {
-        return (string)$this->_packageXml->name;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getChannel()
-    {
-        return (string)$this->_packageXml->channel;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getSummary()
-    {
-        return (string)$this->_packageXml->summary;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDescription()
-    {
-        return (string)$this->_packageXml->description;
-    }
-
-    /**
-     * Get list of authors in associative array.
-     *
-     * @return array
-     */
-    public function getAuthors()
-    {
-        if (is_array($this->_authors)) {
-            return $this->_authors;
-        }
-        $this->_authors = array();
-        if (!isset($this->_packageXml->authors->author)) {
-            return array();
-        }
-        foreach ($this->_packageXml->authors->author as $_author) {
-            $this->_authors[] = array(
-                'name' => (string)$_author->name,
-                'user' => (string)$_author->user,
-                'email' => (string)$_author->email
-            );
-        }
-        return $this->_authors;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDate()
-    {
-        return (string)$this->_packageXml->date;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getTime()
-    {
-        return (string)$this->_packageXml->time;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getVersion()
-    {
-        return (string)$this->_packageXml->version;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getStability()
-    {
-        return (string)$this->_packageXml->stability;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getLicense()
-    {
-        return (string)$this->_packageXml->license;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getLicenseUri()
-    {
-        return (string)$this->_packageXml->license['uri'];
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getNotes()
-    {
-        return (string)$this->_packageXml->notes;
-    }
-
-    /**
-     * Create list of all files from package.xml
-     *
-     * @return array
-     */
-    public function getContents()
-    {
-        if (is_array($this->_contents)) {
-            return $this->_contents;
-        }
-        $this->_contents = array();
-        if (!isset($this->_packageXml->contents->target)) {
-            return $this->_contents;
-        }
-        foreach ($this->_packageXml->contents->target as $target) {
-            $targetUri = $this->getTarget()->getTargetUri($target['name']);
-            $this->_getList($target, $targetUri);
-        }
-        return $this->_contents;
-    }
-
-    /**
-     * Helper for getContents(). Create recursively list.
-     *
-     * @param \SimpleXMLElement $parent
-     * @param string $path
-     * @return void
-     */
-    protected function _getList($parent, $path)
-    {
-        if (count($parent) == 0) {
-            $this->_contents[] = $path;
-        } else {
-            foreach ($parent as $_content) {
-                $this->_getList($_content, ($path ? $path . '/' : '') . $_content['name']);
-            }
-        }
-    }
-
-    /**
-     * Create list of all files from package.xml with hash
-     *
-     * @return array
-     */
-    public function getHashContents()
-    {
-        if (is_array($this->_hashContents)) {
-            return $this->_hashContents;
-        }
-        $this->_hashContents = array();
-        if (!isset($this->_packageXml->contents->target)) {
-            return $this->_hashContents;
-        }
-        foreach ($this->_packageXml->contents->target as $target) {
-            $targetUri = $this->getTarget()->getTargetUri($target['name']);
-            $this->_getHashList($target, $targetUri);
-        }
-        return $this->_hashContents;
-    }
-
-    /**
-     * Helper for getHashContents(). Create recursively list.
-     *
-     * @param \SimpleXMLElement $parent
-     * @param string $path
-     * @param string $hash
-     * @return void
-     */
-    protected function _getHashList($parent, $path, $hash = '')
-    {
-        if (count($parent) == 0) {
-            $this->_hashContents[$path] = $hash;
-        } else {
-            foreach ($parent as $_content) {
-                $contentHash = '';
-                if (isset($_content['hash'])) {
-                    $contentHash = (string)$_content['hash'];
-                }
-                $this->_getHashList($_content, ($path ? $path . '/' : '') . $_content['name'], $contentHash);
-            }
-        }
-    }
-
-    /**
-     * Get compatible packages.
-     *
-     * @return array
-     */
-    public function getCompatible()
-    {
-        if (is_array($this->_compatible)) {
-            return $this->_compatible;
-        }
-        $this->_compatible = array();
-        if (!isset($this->_packageXml->compatible->package)) {
-            return array();
-        }
-        foreach ($this->_packageXml->compatible->package as $_package) {
-            $this->_compatible[] = array(
-                'name' => (string)$_package->name,
-                'channel' => (string)$_package->channel,
-                'min' => (string)$_package->min,
-                'max' => (string)$_package->max
-            );
-        }
-        return $this->_compatible;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDependencyPhpVersionMin()
-    {
-        if (!isset($this->_packageXml->dependencies->required->php->min)) {
-            return false;
-        }
-        return (string)$this->_packageXml->dependencies->required->php->min;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDependencyPhpVersionMax()
-    {
-        if (!isset($this->_packageXml->dependencies->required->php->max)) {
-            return false;
-        }
-        return (string)$this->_packageXml->dependencies->required->php->max;
-    }
-
-    /**
-     * Get list of php extensions.
-     *
-     * @return array
-     */
-    public function getDependencyPhpExtensions()
-    {
-        if (is_array($this->_dependencyPhpExtensions)) {
-            return $this->_dependencyPhpExtensions;
-        }
-        $this->_dependencyPhpExtensions = array();
-        if (!isset($this->_packageXml->dependencies->required->extension)) {
-            return $this->_dependencyPhpExtensions;
-        }
-        foreach ($this->_packageXml->dependencies->required->extension as $_package) {
-            $this->_dependencyPhpExtensions[] = array(
-                'name' => (string)$_package->name,
-                'min' => (string)$_package->min,
-                'max' => (string)$_package->max
-            );
-        }
-        return $this->_dependencyPhpExtensions;
-    }
-
-    /**
-     * Get list of dependency packages.
-     *
-     * @return array
-     */
-    public function getDependencyPackages()
-    {
-        $this->_dependencyPackages = array();
-        if (!isset($this->_packageXml->dependencies->required->package)) {
-            return $this->_dependencyPackages;
-        }
-        foreach ($this->_packageXml->dependencies->required->package as $_package) {
-            $add = array(
-                'name' => (string)$_package->name,
-                'channel' => (string)$_package->channel,
-                'min' => (string)$_package->min,
-                'max' => (string)$_package->max
-            );
-            if (isset($_package->files)) {
-                $add['files'] = array();
-                foreach ($_package->files as $node) {
-                    if (isset($node->file)) {
-
-                        $add['files'][] = array(
-                            'target' => (string)$node->file['target'],
-                            'path' => (string)$node->file['path']
-                        );
-                    }
-                }
-            }
-            $this->_dependencyPackages[] = $add;
-        }
-        return $this->_dependencyPackages;
-    }
-
-    /**
-     * Get string with XML content.
-     *
-     * @return string
-     */
-    public function getPackageXml()
-    {
-        return $this->_packageXml->asXml();
-    }
-
-    /**
-     * Validator instance (single)
-     *
-     *  @return \Magento\Framework\Connect\Validator
-     */
-    protected function validator()
-    {
-        if (is_null($this->_validator)) {
-            $this->_validator = new \Magento\Framework\Connect\Validator();
-        }
-        return $this->_validator;
-    }
-
-    /**
-     * Get validation error strings
-     *
-     * @return array
-     */
-    public function getErrors()
-    {
-        return $this->_validationErrors;
-    }
-
-    /**
-     * Setter for validation errors
-     *
-     * @param array $errors
-     * @return void
-     */
-    protected function setErrors(array $errors)
-    {
-        $this->_validationErrors = $errors;
-    }
-
-    /**
-     * Check validation result.
-     * Returns true if package data is invalid.
-     *
-     * @return bool
-     */
-    public function hasErrors()
-    {
-        return count($this->_validationErrors) != 0;
-    }
-
-    /**
-     * Validate package. Errors can be
-     * retrieved by calling getErrors();
-     *
-     * @return bool
-     * @throws \Magento\Framework\Exception
-     */
-    public function validate()
-    {
-        $v = $this->validator();
-
-        /**
-         * Validation map
-         *
-         * Format:
-         *
-         * 'key' =>  array(
-         *    'method' => this class method name to call, string, required
-         *    'method_args' => optional args for 'method' call, array, optional
-         *    'v_method' => validator method to call, string, required
-         *    'error' => custom error string when validation fails, optional
-         *               if not set, error string fprmatted as "Invalid '$key' specified"
-         *    'v_error_method' => validator method - when called returned error string
-         *                        prepared by validator, optional,
-         *                        if not set => see 'error'
-         *    'optional' => optional value, if it's empty validation result ignored
-         *
-         */
-        $validateMap = array(
-            'name' => array(
-                'method' => 'getName',
-                'v_method' => 'validatePackageName',
-                'error' => "Invalid package name, allowed: [a-zA-Z0-9_-] chars"
-            ),
-            'version' => array(
-                'method' => 'getVersion',
-                'v_method' => 'validateVersion',
-                'error' => "Invalid version, should be like: x.x.x"
-            ),
-            'stability' => array(
-                'method' => 'getStability',
-                'v_method' => 'validateStability',
-                'error' => "Invalid stability"
-            ),
-            'date' => array(
-                'method' => 'getDate',
-                'v_method' => 'validateDate',
-                'error' => "Invalid date, should be YYYY-DD-MM"
-            ),
-            'license_uri' => array(
-                'method' => 'getLicenseUri',
-                'v_method' => 'validateLicenseUrl',
-                'error' => "Invalid license URL"
-            ),
-            'channel' => array(
-                'method' => 'getChannel',
-                'v_method' => 'validateChannelNameOrUri',
-                'error' => "Invalid channel URL"
-            ),
-            'authors' => array(
-                'method' => 'getAuthors',
-                'v_method' => 'validateAuthors',
-                'v_error_method' => 'getErrors'
-            ),
-            'php_min' => array(
-                'method' => 'getDependencyPhpVersionMin',
-                'v_method' => 'validateVersion',
-                'error' => 'PHP minimum version invalid',
-                'optional' => true
-            ),
-            'php_max' => array(
-                'method' => 'getDependencyPhpVersionMax',
-                'v_method' => 'validateVersion',
-                'error' => 'PHP maximum version invalid',
-                'optional' => true
-            ),
-            'compatible' => array(
-                'method' => 'getCompatible',
-                'v_method' => 'validateCompatible',
-                'v_error_method' => 'getErrors'
-            ),
-            'content' => array(
-                'method' => 'getContents',
-                'v_method' => 'validateContents',
-                'v_args' => array('config' => $this->getConfig()),
-                'v_error_method' => 'getErrors'
-            )
-        );
-
-        $errors = array();
-        /**
-         * Iterate validation map
-         */
-        foreach ($validateMap as $name => $data) {
-
-            /**
-             * Check mandatory rules fields
-             */
-            if (!isset($data['method'], $data['v_method'])) {
-                throw new \Magento\Framework\Exception("Invalid rules specified!");
-            }
-
-            $method = $data['method'];
-            $validatorMethod = $data['v_method'];
-
-            /**
-             * If $optional === false, value is mandatory
-             */
-            $optional = isset($data['optional']) ? (bool)$data['optional'] : false;
-
-            /**
-             * Check for method availability, package
-             */
-            if (!method_exists($this, $method)) {
-                throw new \Magento\Framework\Exception("Invalid method specified for Package : {$method}");
-            }
-
-            /**
-             * Check for method availability, validator
-             */
-            if (!method_exists($v, $validatorMethod) || !is_callable([$v, $validatorMethod])) {
-                throw new \Magento\Framework\Exception("Invalid method specified for Validator : {$validatorMethod}");
-            }
-
-            /**
-             * If    $data['error'] => get error string from $data['error']
-             * Else  concatenate "Invalid '{$name}' specified"
-             */
-            $errorString = isset($data['error']) ? $data['error'] : "Invalid '{$name}' specified";
-
-            /**
-             * Additional method args check
-             * array() by default
-             */
-            $methodArgs = isset($data['method_args']) ? $data['method_args'] : array();
-
-            /**
-             * Call package method
-             */
-            $out = @call_user_func_array(array($this, $method), $methodArgs);
-
-            /**
-             * Skip if result is empty and value is optional
-             */
-            if (empty($out) && $optional) {
-                continue;
-            }
-
-            /**
-             * Additional validator arguments, merged with array($out)
-             */
-            $validatorArgs = isset($data['v_args']) ? array_merge(array($out), $data['v_args']) : array($out);
-
-            /**
-             * Get validation result
-             */
-            $result = call_user_func_array(array($v, $validatorMethod), $validatorArgs);
-
-            /**
-             * Skip if validation success
-             */
-            if ($result) {
-                continue;
-            }
-
-            /**
-             * From where to get error string?
-             * If    validator callback method specified, call it to get errors array
-             * Else  get it from $errorString - local error string
-             */
-            $validatorFetchErrorsMethod = isset($data['v_error_method']) ? $data['v_error_method'] : false;
-            if (false !== $validatorFetchErrorsMethod) {
-                $errorString = call_user_func_array(array($v, $validatorFetchErrorsMethod), array());
-            }
-
-            /**
-             * If   errors is array => merge
-             * Else append
-             */
-            if (is_array($errorString)) {
-                $errors = array_merge($errors, $errorString);
-            } else {
-                $errors[] = $errorString;
-            }
-        }
-        /**
-         * Set local errors
-         */
-        $this->setErrors($errors);
-        /**
-         * Return true if there's no errors :)
-         */
-        return !$this->hasErrors();
-    }
-
-    /**
-     * Return package release filename w/o extension
-     * @return string
-     */
-    public function getReleaseFilename()
-    {
-        return $this->getName() . "-" . $this->getVersion();
-    }
-
-    /**
-     * Return release filepath w/o extension
-     * @return string
-     */
-    public function getRelaseDirFilename()
-    {
-        return $this->getName() . '/' . $this->getVersion() . '/' . $this->getReleaseFilename();
-    }
-
-    /**
-     * Clear dependencies
-     *
-     * @return $this
-     */
-    public function clearDependencies()
-    {
-        $this->_packageXml->dependencies = null;
-        return $this;
-    }
-
-    /**
-     * Clear contents
-     *
-     * @return $this
-     */
-    public function clearContents()
-    {
-        $this->_packageXml->contents = null;
-        return $this;
-    }
-
-    /**
-     * Get config
-     *
-     * @return \Magento\Framework\Connect\Config
-     */
-    public function getConfig()
-    {
-        return $this->_config;
-    }
-
-    /**
-     * Set config
-     *
-     * @param \Magento\Framework\Connect\Config $config
-     * @return void
-     */
-    public function setConfig($config)
-    {
-        $this->_config = $config;
-    }
-
-    /**
-     * Import package information from previous version of Magento Connect Manager
-     *
-     * @param array $data
-     * @return $this
-     */
-    public function importDataV1x(array $data)
-    {
-        $this->_packageXml = null;
-        $this->_init();
-        // Import simple data
-        if (isset($data['name'])) {
-            $this->setName($data['name']);
-        }
-        if (isset($data['summary'])) {
-            $this->setSummary($data['summary']);
-        }
-        if (isset($data['description'])) {
-            $this->setDescription($data['description']);
-        }
-        if (isset($data['channel'])) {
-            $this->setChannel($this->convertChannelFromV1x($data['channel']));
-        }
-        if (isset($data['license'])) {
-            if (is_array($data['license'])) {
-                $this->setLicense($data['license']['_content'], $data['license']['attribs']['uri']);
-            } else {
-                $this->setLicense($data['license']);
-            }
-        }
-        if (isset($data['version'])) {
-            $this->setVersion($data['version']['release']);
-        }
-        if (isset($data['stability'])) {
-            $this->setStability($data['stability']['release']);
-        }
-        if (isset($data['notes'])) {
-            $this->setNotes($data['notes']);
-        }
-        if (isset($data['date'])) {
-            $this->setDate($data['date']);
-        }
-        if (isset($data['time'])) {
-            $this->setTime($data['time']);
-        }
-
-        // Import authors
-        $authors = array();
-        $authorRoles = array('lead', 'developer', 'contributor', 'helper');
-        foreach ($authorRoles as $authorRole) {
-            if (isset($data[$authorRole])) {
-                $authorList = $data[$authorRole];
-                if (!is_array($authorList) || isset($authorList['name'])) {
-                    $authorList = array($authorList);
-                }
-                foreach ($authorList as $authorRawData) {
-                    $author = array();
-                    $author['name'] = $authorRawData['name'];
-                    $author['user'] = $authorRawData['user'];
-                    $author['email'] = $authorRawData['email'];
-                    array_push($authors, $author);
-                }
-            }
-        }
-        $this->setAuthors($authors);
-
-        // Import dependencies
-        $packages = array();
-        $extensions = array();
-        if (isset($data['dependencies']) && is_array($data['dependencies'])) {
-            $dependencySections = array('required', 'optional');
-            $elementTypes = array('package', 'extension');
-            foreach ($dependencySections as $dependencySection) {
-                if (isset($data['dependencies'][$dependencySection])) {
-                    // Handle required PHP version
-                    if ($dependencySection == 'required' && isset($data['dependencies']['required']['php'])) {
-                        $this->setDependencyPhpVersion(
-                            $data['dependencies']['required']['php']['min'],
-                            $data['dependencies']['required']['php']['max']
-                        );
-                    }
-                    // Handle extensions
-                    if (isset($data['dependencies'][$dependencySection]['extension'])) {
-                        $extensionList = $data['dependencies'][$dependencySection]['extension'];
-                        if (!is_array($extensionList) || isset($extensionList['name'])) {
-                            $extensionList = array($extensionList);
-                        }
-                        foreach ($extensionList as $extensionRawData) {
-                            $extension = array();
-                            $extension['name'] = $extensionRawData['name'];
-                            $extension['min_version'] = isset(
-                                $extensionRawData['min']
-                            ) ? $extensionRawData['min'] : null;
-                            $extension['max_version'] = isset(
-                                $extensionRawData['max']
-                            ) ? $extensionRawData['max'] : null;
-                            array_push($extensions, $extension);
-                        }
-                    }
-                    // Handle packages
-                    if (isset($data['dependencies'][$dependencySection]['package'])) {
-                        $packageList = $data['dependencies'][$dependencySection]['package'];
-                        if (!is_array($packageList) || isset($packageList['name'])) {
-                            $packageList = array($packageList);
-                        }
-                        foreach ($packageList as $packageRawData) {
-                            $package = array();
-                            $package['name'] = $packageRawData['name'];
-                            $package['channel'] = $this->convertChannelFromV1x($packageRawData['channel']);
-                            $package['min_version'] = isset($packageRawData['min']) ? $packageRawData['min'] : null;
-                            $package['max_version'] = isset($packageRawData['max']) ? $packageRawData['max'] : null;
-                            array_push($packages, $package);
-                        }
-                    }
-                }
-            }
-        }
-        $this->setDependencyPackages($packages);
-        $this->setDependencyPhpExtensions($extensions);
-
-        // Import contents
-        if (isset($data['contents']) && is_array($data['contents']) && is_array($data['contents']['dir'])) {
-            // Handle files
-            $root = $data['contents']['dir'];
-            if (isset($data['contents']['dir']['file'])) {
-                $fileList = $data['contents']['dir']['file'];
-                if (!is_array($fileList) || isset($fileList['attribs'])) {
-                    $fileList = array($fileList);
-                }
-                foreach ($fileList as $fileRawData) {
-                    $targetName = $fileRawData['attribs']['role'];
-                    $parentTargetNode = $this->_getNode('target', $this->_packageXml->contents, $targetName);
-                    $filePath = $fileRawData['attribs']['name'];
-                    $filePathParts = explode('/', $filePath);
-                    $fileName = array_pop($filePathParts);
-                    $parentDirNode = null;
-                    if (!empty($filePathParts)) {
-                        $parentDirNode = $parentTargetNode;
-                        foreach ($filePathParts as $directoryName) {
-                            $parentDirNode = $this->_getNode('dir', $parentDirNode, $directoryName);
-                        }
-                    } else {
-                        $parentDirNode = $this->_getNode('dir', $parentTargetNode, '.');
-                    }
-                    $fileNode = $parentDirNode->addChild('file');
-                    $fileNode->addAttribute('name', $fileName);
-                    $fileNode->addAttribute('hash', $fileRawData['attribs']['md5sum']);
-                }
-            }
-        }
-
-        return $this;
-    }
-
-    /**
-     * Convert package channel in order for it to be compatible with current version of Magento Connect Manager
-     *
-     * @param string $channel
-     * @return string
-     */
-    public function convertChannelFromV1x($channel)
-    {
-        $channelMap = array(
-            'connect.magentocommerce.com/community' => 'community',
-            'connect.magentocommerce.com/core' => 'community'
-        );
-        if (!empty($channel) && isset($channelMap[$channel])) {
-            $channel = $channelMap[$channel];
-        }
-        return $channel;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Package/Hotfix.php b/downloader/lib/Magento/Framework/Connect/Package/Hotfix.php
deleted file mode 100644
index e3ed2b7e3cca916d1aff187102ee894f09517022..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Package/Hotfix.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Package;
-
-/**
- * Class to work with Magento Connect Hotfix
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Hotfix extends \Magento\Framework\Connect\Package
-{
-    /**
-     * Initializes an empty package object
-     *
-     * @param null|string $definition optional package definition xml
-     * @return $this
-     */
-    protected function _init($definition = null)
-    {
-
-        if (!is_null($definition)) {
-            $this->_packageXml = simplexml_load_string($definition);
-        } else {
-            $packageXmlStub = <<<END
-<?xml version="1.0"?>
-<package>
-    <name />
-    <version />
-    <stability />
-    <license />
-    <channel />
-    <extends />
-    <summary />
-    <description />
-    <notes />
-    <authors />
-    <date />
-    <time />
-    <replace />
-    <compatible />
-    <dependencies />
-</package>
-END;
-            $this->_packageXml = simplexml_load_string($packageXmlStub);
-        }
-        return $this;
-    }
-
-    /**
-     * Add content to node <replace/>
-     *
-     * @param string $path
-     * @param string $targetName
-     * @return $this
-     */
-    public function addReplace($path, $targetName)
-    {
-        $found = false;
-        $parent = $this->_getNode('target', $this->_packageXml->replace, $targetName);
-        $path = str_replace('\\', '/', $path);
-        $directories = explode('/', dirname($path));
-        foreach ($directories as $directory) {
-            $parent = $this->_getNode('dir', $parent, $directory);
-        }
-        $fileName = basename($path);
-        if ($fileName != '') {
-            $fileNode = $parent->addChild('file');
-            $fileNode->addAttribute('name', $fileName);
-        }
-        return $this;
-    }
-
-    /**
-     * Add directory recursively (with subdirectory and file).
-     * Exclude and Include can be add using Regular Expression.
-     *
-     * @param string $targetName Target name
-     * @param string $targetDir Path for target name
-     * @param string $path Path to directory
-     * @param string $exclude Exclude
-     * @param string $include Include
-     * @return $this
-     */
-    public function addReplaceDir($targetName, $targetDir, $path, $exclude = null, $include = null)
-    {
-        $targetDirLen = strlen($targetDir);
-        //get all subdirectories and files.
-        $entries = @glob($targetDir . $path . '/' . "*");
-        if (!empty($entries)) {
-            foreach ($entries as $entry) {
-                $filePath = substr($entry, $targetDirLen);
-                if (!empty($include) && !preg_match($include, $filePath)) {
-                    continue;
-                }
-                if (!empty($ignore) && preg_match($exclude, $filePath)) {
-                    continue;
-                }
-                if (is_dir($entry)) {
-                    $baseName = basename($entry);
-                    if ('.' === $baseName || '..' === $baseName) {
-                        continue;
-                    }
-                    //for subdirectory call method recursively
-                    $this->addReplaceDir($targetName, $targetDir, $filePath, $exclude, $include);
-                } elseif (is_file($entry)) {
-                    $this->addReplace($filePath, $targetName);
-                }
-            }
-        }
-        return $this;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Package/Reader.php b/downloader/lib/Magento/Framework/Connect/Package/Reader.php
deleted file mode 100644
index 90d4ae5a132336d49a0c9a10b172e141a00f9b68..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Package/Reader.php
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to get package.xml from different places.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect\Package;
-
-class Reader
-{
-    /**
-     * Name of package file
-     */
-    const DEFAULT_NAME_PACKAGE = 'package.xml';
-
-    /**
-     * Temporary dir for extract DEFAULT_NAME_PACKAGE.
-     */
-    const PATH_TO_TEMPORARY_DIRECTORY = 'var/package/tmp/';
-
-    /**
-     * Current path to file.
-     *
-     * @var string
-     */
-    protected $_file = '';
-
-    /**
-     * Archivator is used for extract DEFAULT_NAME_PACKAGE.
-     *
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archivator = null;
-
-    /**
-     * Constructor initializes $_file.
-     *
-     * @param string $file
-     * @return \Magento\Framework\Connect\Package\Reader
-     */
-    public function __construct($file = '')
-    {
-        if ($file) {
-            $this->_file = $file;
-        } else {
-            $this->_file = self::DEFAULT_NAME_PACKAGE;
-        }
-        return $this;
-    }
-
-    /**
-     * Retrieve archivator.
-     *
-     * @return \Magento\Framework\Archive
-     */
-    protected function _getArchivator()
-    {
-        if (is_null($this->_archivator)) {
-            $this->_archivator = new \Magento\Framework\Archive();
-        }
-        return $this->_archivator;
-    }
-
-    /**
-     * Open file directly or from archive and return his content.
-     *
-     * @return string Content of file $file
-     */
-    public function load()
-    {
-        if (!is_file($this->_file) || !is_readable($this->_file)) {
-            throw new \Exception('Invalid package file specified.');
-        }
-        if ($this->_getArchivator()->isArchive($this->_file)) {
-            @mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true);
-            $this->_file = $this->_getArchivator()->extract(
-                self::DEFAULT_NAME_PACKAGE,
-                $this->_file,
-                self::PATH_TO_TEMPORARY_DIRECTORY
-            );
-        }
-        $xmlContent = $this->_readFile();
-        return $xmlContent;
-    }
-
-    /**
-     * Read content file.
-     *
-     * @return string Content of file $file
-     */
-    protected function _readFile()
-    {
-        $handle = fopen($this->_file, 'r');
-        try {
-            $data = $this->_loadResource($handle);
-        } catch (\Magento\Framework\Exception $e) {
-            fclose($handle);
-            throw $e;
-        }
-        fclose($handle);
-        return $data;
-    }
-
-    /**
-     * Loads a package from specified resource
-     *
-     * @param resource $resource only file resources are supported at the moment
-     * @return \Magento\Framework\Connect\Package
-     */
-    protected function _loadResource(&$resource)
-    {
-        $data = '';
-        //var_dump("====", $res, get_resource_type($resource));
-        if ('stream' === get_resource_type($resource)) {
-            while (!feof($resource)) {
-                $data .= fread($resource, 10240);
-            }
-        } else {
-            throw new \Magento\Framework\Exception('Unsupported resource type');
-        }
-        return $data;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Package/Target.php b/downloader/lib/Magento/Framework/Connect/Package/Target.php
deleted file mode 100644
index 55e07d5fadc3c58fb0bb1707aae0c786f3edfdbf..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Package/Target.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to get targets and their basepath from target.xml.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect\Package;
-
-class Target
-{
-    /**
-     * Object contains all contents from target.xml.
-     *
-     * @var array
-     */
-    protected $_targetMap = null;
-
-    /**
-     * Cache for targets.
-     *
-     * @var array
-     */
-    protected $_targets;
-
-    /**
-     * Retrieve content from target.xml.
-     *
-     * @return \SimpleXMLElement
-     */
-    protected function _getTargetMap()
-    {
-        if (is_null($this->_targetMap)) {
-            $this->_targetMap = array();
-            $this->_targetMap[] = array('name' => "magecore", 'label' => "Magento module file", 'uri' => "./app/code");
-            $this->_targetMap[] = array(
-                'name' => "magedesign",
-                'label' => "Magento User Interface (layouts, templates)",
-                'uri' => "./app/design"
-            );
-            $this->_targetMap[] = array(
-                'name' => "mageetc",
-                'label' => "Magento Global Configuration",
-                'uri' => "./app/etc"
-            );
-            $this->_targetMap[] = array('name' => "magelib", 'label' => "Magento PHP Library file", 'uri' => "./lib");
-            $this->_targetMap[] = array(
-                'name' => "magelocale",
-                'label' => "Magento Locale language file",
-                'uri' => "./app/locale"
-            );
-            $this->_targetMap[] = array('name' => "magemedia", 'label' => "Magento Media library", 'uri' => "./media");
-            $this->_targetMap[] = array(
-                'name' => "mageskin",
-                'label' => "Magento Theme Skin (Images, CSS, JS)",
-                'uri' => "./skin"
-            );
-            $this->_targetMap[] = array(
-                'name' => "mageweb",
-                'label' => "Magento Other web accessible file",
-                'uri' => "."
-            );
-            $this->_targetMap[] = array('name' => "magetest", 'label' => "Magento PHPUnit test", 'uri' => "./tests");
-            $this->_targetMap[] = array('name' => "mage", 'label' => "Magento other", 'uri' => ".");
-        }
-        return $this->_targetMap;
-    }
-
-    /**
-     * Retrieve targets as associative array from target.xml.
-     *
-     * @return array
-     */
-    public function getTargets()
-    {
-        if (!is_array($this->_targets)) {
-            $this->_targets = array();
-            if ($this->_getTargetMap()) {
-                foreach ($this->_getTargetMap() as $_target) {
-                    $this->_targets[$_target['name']] = (string)$_target['uri'];
-                }
-            }
-        }
-        return $this->_targets;
-    }
-
-    /**
-     * Retrieve tragets with label for select options.
-     *
-     * @return array
-     */
-    public function getLabelTargets()
-    {
-        $targets = array();
-        foreach ($this->_getTargetMap() as $_target) {
-            $targets[$_target['name']] = $_target['label'];
-        }
-        return $targets;
-    }
-
-    /**
-     * Get uri by target's name.
-     *
-     * @param string $name
-     * @return string
-     */
-    public function getTargetUri($name)
-    {
-        foreach ($this->getTargets() as $_name => $_uri) {
-            if ($name == $_name) {
-                return $_uri;
-            }
-        }
-        return '';
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Package/Writer.php b/downloader/lib/Magento/Framework/Connect/Package/Writer.php
deleted file mode 100644
index 3c9d6c53b37000287e885322bc88a610b5d0ccdb..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Package/Writer.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Package;
-
-/**
- * Class to create archive.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Writer
-{
-    /**
-     * Name of package configuration file
-     */
-    const DEFAULT_NAME_PACKAGE_CONFIG = 'package.xml';
-
-    /**
-     * Temporary dir for extract DEFAULT_NAME_PACKAGE.
-     */
-    const PATH_TO_TEMPORARY_DIRECTORY = 'var/package/tmp/';
-
-    /**
-     * Files are used in package.
-     *
-     * @var array
-     */
-    protected $_files = array();
-
-    /**
-     * Archivator is used for extract DEFAULT_NAME_PACKAGE.
-     *
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archivator = null;
-
-    /**
-     * Name of package with extension. Extension should be only one.
-     * "package.tar.gz" is not ability, only "package.tgz".
-     *
-     * @var string
-     */
-    protected $_namePackage = 'package';
-
-    /**
-     * Temporary directory where package is situated.
-     *
-     * @var string
-     */
-    protected $_temporaryPackageDir = '';
-
-    /**
-     * Path to archive with package.
-     *
-     * @var mixed
-     */
-    protected $_pathToArchive = '';
-
-    /**
-     * Constructor initializes $_file.
-     *
-     * @param array $files
-     * @param string $namePackage
-     * @return \Magento\Framework\Connect\Package\Reader
-     */
-    public function __construct($files, $namePackage = '')
-    {
-        $this->_files = $files;
-        $this->_namePackage = $namePackage;
-        return $this;
-    }
-
-    /**
-     * Retrieve archivator.
-     *
-     * @return \Magento\Framework\Archive
-     */
-    protected function _getArchivator()
-    {
-        if (is_null($this->_archivator)) {
-            $this->_archivator = new \Magento\Framework\Archive();
-        }
-        return $this->_archivator;
-    }
-
-    /**
-     * Create dir in PATH_TO_TEMPORARY_DIRECTORY and move all files
-     * to this dir.
-     *
-     * @return $this
-     */
-    public function composePackage()
-    {
-        @mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true);
-        $root = self::PATH_TO_TEMPORARY_DIRECTORY . basename($this->_namePackage);
-        @mkdir($root, 0777, true);
-        foreach ($this->_files as $file) {
-
-            if (is_dir($file) || is_file($file)) {
-                $fileName = basename($file);
-                $filePath = dirname($file);
-                @mkdir($root . '/' . $filePath, 0777, true);
-                if (is_file($file)) {
-                    copy($file, $root . '/' . $filePath . '/' . $fileName);
-                } else {
-                    @mkdir($root . '/' . $filePath . $fileName, 0777);
-                }
-            }
-        }
-        $this->_temporaryPackageDir = $root;
-        return $this;
-    }
-
-    /**
-     * Add package.xml to temporary package directory.
-     *
-     * @param mixed $content
-     * @return $this
-     */
-    public function addPackageXml($content)
-    {
-        file_put_contents($this->_temporaryPackageDir . '/' . self::DEFAULT_NAME_PACKAGE_CONFIG, $content);
-        return $this;
-    }
-
-    /**
-     * Archives package.
-     *
-     * @return $this
-     */
-    public function archivePackage()
-    {
-        $this->_pathToArchive = $this->_getArchivator()->pack(
-            $this->_temporaryPackageDir,
-            $this->_namePackage . '.tgz',
-            true
-        );
-
-        //delete temporary dir
-        \Magento\Framework\System\Dirs::rm(array("-r", $this->_temporaryPackageDir));
-        return $this;
-    }
-
-    /**
-     * Getter for pathToArchive
-     *
-     * @return string
-     */
-    public function getPathToArchive()
-    {
-        return $this->_pathToArchive;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Packager.php b/downloader/lib/Magento/Framework/Connect/Packager.php
deleted file mode 100644
index 242fee60d0e5ba9f914f7126b15efd05a8f9060a..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Packager.php
+++ /dev/null
@@ -1,1004 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to manipulate with packages
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Packager
-{
-    /**
-     * Default Config File name
-     */
-    const CONFIG_FILE_NAME = 'downloader/connect.cfg';
-
-    /**
-     * Default Cache Config File name
-     */
-    const CACHE_FILE_NAME = 'downloader/cache.cfg';
-
-    /**
-     * Install states of package
-     */
-    const INSTALL_STATE_INSTALL = 'install';
-
-    const INSTALL_STATE_UPGRADE = 'upgrade';
-
-    const INSTALL_STATE_WRONG_VERSION = 'wrong_version';
-
-    const INSTALL_STATE_ALREADY_INSTALLED = 'already_installed';
-
-    const INSTALL_STATE_INCOMPATIBLE = 'incompatible';
-
-    /**
-     * Install states messages
-     *
-     * @var array
-     */
-    protected $installStates = array(
-        self::INSTALL_STATE_INSTALL => 'Ready to install',
-        self::INSTALL_STATE_UPGRADE => 'Ready to upgrade',
-        self::INSTALL_STATE_ALREADY_INSTALLED => 'Already installed',
-        self::INSTALL_STATE_WRONG_VERSION => 'Wrong version'
-    );
-
-    /**
-     * Archiver object
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archiver = null;
-
-    /**
-     * HTTP Client (Curl/Socket etc)
-     * @var \Magento\Framework\HTTP\IClient
-     */
-    protected $_http = null;
-
-    /**
-     * Get Archiver object
-     *
-     * @return \Magento\Framework\Archive
-     */
-    public function getArchiver()
-    {
-        if (is_null($this->_archiver)) {
-            $this->_archiver = new \Magento\Framework\Archive();
-        }
-        return $this->_archiver;
-    }
-
-    /**
-     * Returns HTTP Client
-     * @return \Magento\Framework\HTTP\IClient|null
-     */
-    public function getDownloader()
-    {
-        if (is_null($this->_http)) {
-            $this->_http = \Magento\Framework\HTTP\Client::getInstance();
-        }
-        return $this->_http;
-    }
-
-    /**
-     * Get config data and cache config data remotely
-     *
-     * @param string $ftpString
-     * @return array
-     */
-    public function getRemoteConf($ftpString)
-    {
-        $ftpObj = new \Magento\Framework\Connect\Ftp();
-        $ftpObj->connect($ftpString);
-        $cfgFile = self::CONFIG_FILE_NAME;
-        $cacheFile = self::CACHE_FILE_NAME;
-
-        $wd = $ftpObj->getcwd();
-
-        $remoteConfigExists = $ftpObj->fileExists($cfgFile);
-        $tempConfigFile = tempnam(sys_get_temp_dir(), 'conf');
-        if (!$remoteConfigExists) {
-            $remoteCfg = new \Magento\Framework\Connect\Config($tempConfigFile);
-            $remoteCfg->store();
-            $ftpObj->upload($cfgFile, $tempConfigFile);
-        } else {
-            $ftpObj->get($tempConfigFile, $cfgFile);
-            $remoteCfg = new \Magento\Framework\Connect\Config($tempConfigFile);
-        }
-
-        $ftpObj->chdir($wd);
-
-        $remoteCacheExists = $ftpObj->fileExists($cacheFile);
-        $tempCacheFile = tempnam(sys_get_temp_dir(), 'cache');
-
-        if (!$remoteCacheExists) {
-            $remoteCache = new \Magento\Framework\Connect\Singleconfig($tempCacheFile);
-            $remoteCache->clear();
-            $ftpObj->upload($cacheFile, $tempCacheFile);
-        } else {
-            $ftpObj->get($tempCacheFile, $cacheFile);
-            $remoteCache = new \Magento\Framework\Connect\Singleconfig($tempCacheFile);
-        }
-        $ftpObj->chdir($wd);
-        return array($remoteCache, $remoteCfg, $ftpObj);
-    }
-
-    /**
-     * Get Cache config data remotely
-     *
-     * @param string $ftpString
-     * @return array
-     */
-    public function getRemoteCache($ftpString)
-    {
-
-        $ftpObj = new \Magento\Framework\Connect\Ftp();
-        $ftpObj->connect($ftpString);
-        $remoteConfigExists = $ftpObj->fileExists(self::CACHE_FILE_NAME);
-        if (!$remoteConfigExists) {
-            $configFile = tempnam(sys_get_temp_dir(), 'conf');
-            $remoteCfg = new \Magento\Framework\Connect\Singleconfig($configFile);
-            $remoteCfg->clear();
-            $ftpObj->upload(self::CACHE_FILE_NAME, $configFile);
-        } else {
-            $configFile = tempnam(sys_get_temp_dir(), 'conf');
-            $ftpObj->get($configFile, self::CACHE_FILE_NAME);
-            $remoteCfg = new \Magento\Framework\Connect\Singleconfig($configFile);
-        }
-        return array($remoteCfg, $ftpObj);
-    }
-
-    /**
-     * Get config data remotely
-     *
-     * @param string $ftpString
-     * @return array
-     */
-    public function getRemoteConfig($ftpString)
-    {
-        $ftpObj = new \Magento\Framework\Connect\Ftp();
-        $ftpObj->connect($ftpString);
-        $cfgFile = self::CONFIG_FILE_NAME;
-
-        $wd = $ftpObj->getcwd();
-        $remoteConfigExists = $ftpObj->fileExists($cfgFile);
-        $tempConfigFile = tempnam(sys_get_temp_dir(), 'conf_');
-        if (!$remoteConfigExists) {
-            $remoteCfg = new \Magento\Framework\Connect\Config($tempConfigFile);
-            $remoteCfg->store();
-            $ftpObj->upload($cfgFile, $tempConfigFile);
-        } else {
-            $ftpObj->get($tempConfigFile, $cfgFile);
-            $remoteCfg = new \Magento\Framework\Connect\Config($tempConfigFile);
-        }
-        $ftpObj->chdir($wd);
-        return array($remoteCfg, $ftpObj);
-    }
-
-    /**
-     * Write Cache config remotely
-     *
-     * @param \Magento\Framework\Connect\Singleconfig $cache
-     * @param \Magento\Framework\Connect\Ftp $ftpObj
-     * @return void
-     */
-    public function writeToRemoteCache($cache, $ftpObj)
-    {
-        $wd = $ftpObj->getcwd();
-        $ftpObj->upload(self::CACHE_FILE_NAME, $cache->getFilename());
-        @unlink($cache->getFilename());
-        $ftpObj->chdir($wd);
-    }
-
-    /**
-     * Write config remotely
-     *
-     * @param \Magento\Framework\Connect\Config $cache
-     * @param \Magento\Framework\Connect\Ftp $ftpObj
-     * @return void
-     */
-    public function writeToRemoteConfig($cache, $ftpObj)
-    {
-        $wd = $ftpObj->getcwd();
-        $ftpObj->upload(self::CONFIG_FILE_NAME, $cache->getFilename());
-        @unlink($cache->getFilename());
-        $ftpObj->chdir($wd);
-    }
-
-    /**
-     * Remove empty directories recursively up
-     *
-     * @param string $dir
-     * @param \Magento\Framework\Connect\Ftp $ftp
-     * @return void
-     */
-    protected function removeEmptyDirectory($dir, $ftp = null)
-    {
-        if ($ftp) {
-            if (count($ftp->nlist($dir)) == 0) {
-                if ($ftp->rmdir($dir)) {
-                    $this->removeEmptyDirectory(dirname($dir), $ftp);
-                }
-            }
-        } else {
-            if (@rmdir($dir)) {
-                $this->removeEmptyDirectory(dirname($dir), $ftp);
-            }
-        }
-    }
-
-    /**
-     * Uninstall Package
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param \Magento\Framework\Connect\Singleconfig $cacheObj
-     * @param \Magento\Framework\Connect\Config $configObj
-     * @return void
-     */
-    public function processUninstallPackage($chanName, $package, $cacheObj, $configObj)
-    {
-        $package = $cacheObj->getPackageObject($chanName, $package);
-        $contents = $package->getContents();
-
-        $targetPath = rtrim($configObj->magento_root, "\\/");
-        foreach ($contents as $file) {
-            $fileName = basename($file);
-            $filePath = dirname($file);
-            $dest = $targetPath . '/' . $filePath . '/' . $fileName;
-            if (@file_exists($dest)) {
-                @unlink($dest);
-                $this->removeEmptyDirectory(dirname($dest));
-            }
-        }
-
-        $destDir = $targetPath . '/' . \Magento\Framework\Connect\Package::PACKAGE_XML_DIR;
-        $destFile = $package->getReleaseFilename() . '.xml';
-        @unlink($destDir . '/' . $destFile);
-    }
-
-    /**
-     * Uninstall Package over FTP
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param \Magento\Framework\Connect\Singleconfig $cacheObj
-     * @param \Magento\Framework\Connect\Ftp $ftp
-     * @return void
-     */
-    public function processUninstallPackageFtp($chanName, $package, $cacheObj, $ftp)
-    {
-        $ftpDir = $ftp->getcwd();
-        $package = $cacheObj->getPackageObject($chanName, $package);
-        $contents = $package->getContents();
-        foreach ($contents as $file) {
-            $ftp->delete($file);
-            $this->removeEmptyDirectory(dirname($file), $ftp);
-        }
-        $remoteXml = \Magento\Framework\Connect\Package::PACKAGE_XML_DIR . '/' . $package->getReleaseFilename() . '.xml';
-        $ftp->delete($remoteXml);
-        $ftp->chdir($ftpDir);
-    }
-
-    /**
-     * Validation of mode permissions
-     *
-     * @param int $mode
-     * @return int
-     */
-    protected function validPermMode($mode)
-    {
-        $mode = intval($mode);
-        if ($mode < 73 || $mode > 511) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Return correct global dir mode in octal representation
-     *
-     * @param \Magento\Framework\Connect\Config $config
-     * @return int
-     */
-    protected function _getDirMode($config)
-    {
-        if ($this->validPermMode($config->global_dir_mode)) {
-            return $config->global_dir_mode;
-        } else {
-            return $config->getDefaultValue('global_dir_mode');
-        }
-    }
-
-    /**
-     * Return global file mode in octal representation
-     *
-     * @param \Magento\Framework\Connect\Config $config
-     * @return int
-     */
-    protected function _getFileMode($config)
-    {
-        if ($this->validPermMode($config->global_file_mode)) {
-            return $config->global_file_mode;
-        } else {
-            return $config->getDefaultValue('global_file_mode');
-        }
-    }
-
-    /**
-     * Convert FTP path
-     *
-     * @param string $str
-     * @return string
-     */
-    protected function convertFtpPath($str)
-    {
-        return str_replace("\\", "/", $str);
-    }
-
-    /**
-     * Install package over FTP
-     *
-     * @param \Magento\Framework\Connect\Package $package
-     * @param string $file
-     * @param \Magento\Framework\Connect\Config $configObj
-     * @param \Magento\Framework\Connect\Ftp $ftp
-     * @return void
-     */
-    public function processInstallPackageFtp($package, $file, $configObj, $ftp)
-    {
-        $ftpDir = $ftp->getcwd();
-        $contents = $package->getContents();
-        $arc = $this->getArchiver();
-        $target = dirname($file) . '/' . $package->getReleaseFilename();
-        @mkdir($target, 0777, true);
-        $tar = $arc->unpack($file, $target);
-        $modeFile = $this->_getFileMode($configObj);
-        $modeDir = $this->_getDirMode($configObj);
-        foreach ($contents as $file) {
-            $source = $tar . '/' . $file;
-            if (file_exists($source) && is_file($source)) {
-                $args = array(ltrim($file, "/"), $source);
-                if ($modeDir || $modeFile) {
-                    $args[] = $modeDir;
-                    $args[] = $modeFile;
-                }
-                call_user_func_array(array($ftp, 'upload'), $args);
-            }
-        }
-
-        $localXml = $tar . \Magento\Framework\Connect\Package\Reader::DEFAULT_NAME_PACKAGE;
-        if (is_file($localXml)) {
-            $remoteXml = \Magento\Framework\Connect\Package::PACKAGE_XML_DIR . '/' . $package->getReleaseFilename() . '.xml';
-            $ftp->upload($remoteXml, $localXml, $modeDir, $modeFile);
-        }
-
-        $ftp->chdir($ftpDir);
-        \Magento\Framework\System\Dirs::rm(array("-r", $target));
-    }
-
-    /**
-     * Package installation to FS
-     *
-     * @param \Magento\Framework\Connect\Package $package
-     * @param string $file
-     * @param \Magento\Framework\Connect\Config $configObj
-     * @return void
-     */
-    public function processInstallPackage($package, $file, $configObj)
-    {
-        $contents = $package->getContents();
-        $arc = $this->getArchiver();
-        $target = dirname($file) . '/' . $package->getReleaseFilename();
-        @mkdir($target, 0777, true);
-        $tar = $arc->unpack($file, $target);
-        $modeFile = $this->_getFileMode($configObj);
-        $modeDir = $this->_getDirMode($configObj);
-        $targetPath = rtrim($configObj->magento_root, "\\/");
-        foreach ($contents as $file) {
-            $fileName = basename($file);
-            $filePath = dirname($file);
-            $source = $tar . '/' . $file;
-            @mkdir($targetPath . '/' . $filePath, $modeDir, true);
-            $dest = $targetPath . '/' . $filePath . '/' . $fileName;
-            if (is_file($source)) {
-                @copy($source, $dest);
-                if ($modeFile) {
-                    @chmod($dest, $modeFile);
-                }
-            } else {
-                @mkdir($dest, $modeDir);
-            }
-        }
-
-        $packageXml = $tar . \Magento\Framework\Connect\Package\Reader::DEFAULT_NAME_PACKAGE;
-        if (is_file($packageXml)) {
-            $destDir = $targetPath . '/' . \Magento\Framework\Connect\Package::PACKAGE_XML_DIR;
-            $destFile = $package->getReleaseFilename() . '.xml';
-            $dest = $destDir . '/' . $destFile;
-
-            @copy($packageXml, $dest);
-            @chmod($dest, $modeFile);
-        }
-
-        \Magento\Framework\System\Dirs::rm(array("-r", $target));
-    }
-
-    /**
-     * Get local modified files
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param \Magento\Framework\Connect\Singleconfig $cacheObj
-     * @param \Magento\Framework\Connect\Config $configObj
-     * @return array
-     */
-    public function getLocalModifiedFiles($chanName, $package, $cacheObj, $configObj)
-    {
-        $p = $cacheObj->getPackageObject($chanName, $package);
-        $hashContents = $p->getHashContents();
-        $listModified = array();
-        foreach ($hashContents as $file => $hash) {
-            if (md5_file($configObj->magento_root . '/' . $file) !== $hash) {
-                $listModified[] = $file;
-            }
-        }
-        return $listModified;
-    }
-
-    /**
-     * Get remote modified files
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param \Magento\Framework\Connect\Singleconfig $cacheObj
-     * @param \Magento\Framework\Connect\Ftp $ftp
-     * @return array
-     */
-    public function getRemoteModifiedFiles($chanName, $package, $cacheObj, $ftp)
-    {
-        $p = $cacheObj->getPackageObject($chanName, $package);
-        $hashContents = $p->getHashContents();
-        $listModified = array();
-        foreach ($hashContents as $file => $hash) {
-            $localFile = uniqid("temp_remote_");
-            if (!$ftp->fileExists($file)) {
-                continue;
-            }
-            $ftp->get($localFile, $file);
-            if (file_exists($localFile) && md5_file($localFile) !== $hash) {
-                $listModified[] = $file;
-            }
-            @unlink($localFile);
-        }
-        return $listModified;
-    }
-
-    /**
-     * Get upgrades list
-     *
-     * @param string|array $channels
-     * @param \Magento\Framework\Connect\Singleconfig $cacheObject
-     * @param \Magento\Framework\Connect\Config $configObj
-     * @param \Magento\Framework\Connect\Rest $restObj optional
-     * @param bool $checkConflicts
-     * @return array
-     */
-    public function getUpgradesList($channels, $cacheObject, $configObj, $restObj = null, $checkConflicts = false)
-    {
-        if (is_scalar($channels)) {
-            $channels = array($channels);
-        }
-
-        if (!$restObj) {
-            $restObj = new \Magento\Framework\Connect\Rest($configObj->protocol);
-        }
-
-        $updates = array();
-        foreach ($channels as $chan) {
-
-            if (!$cacheObject->isChannel($chan)) {
-                continue;
-            }
-            $chanName = $cacheObject->chanName($chan);
-            $localPackages = $cacheObject->getInstalledPackages($chanName);
-            $localPackages = $localPackages[$chanName];
-
-            if (!count($localPackages)) {
-                continue;
-            }
-
-            $channel = $cacheObject->getChannel($chan);
-            $uri = $channel[\Magento\Framework\Connect\Singleconfig::K_URI];
-            $restObj->setChannel($uri);
-            $remotePackages = $restObj->getPackagesHashed();
-
-            /**
-             * Iterate packages of channel $chan
-             */
-            $state = $configObj->preferred_state ? $configObj->preferred_state : "stable";
-
-            foreach ($localPackages as $localName => $localData) {
-                if (!isset($remotePackages[$localName])) {
-                    continue;
-                }
-                $package = $remotePackages[$localName];
-                $neededToUpgrade = false;
-                $remoteVersion = $localVersion = trim($localData[\Magento\Framework\Connect\Singleconfig::K_VER]);
-                foreach ($package as $version => $s) {
-
-                    if ($cacheObject->compareStabilities($s, $state) < 0) {
-                        continue;
-                    }
-
-                    if (version_compare($version, $localVersion, ">")) {
-                        $neededToUpgrade = true;
-                        $remoteVersion = $version;
-                    }
-
-                    if ($checkConflicts) {
-                        $conflicts = $cacheObject->hasConflicts($chanName, $localName, $remoteVersion);
-                        if (false !== $conflicts) {
-                            $neededToUpgrade = false;
-                        }
-                    }
-                }
-                if (!$neededToUpgrade) {
-                    continue;
-                }
-                if (!isset($updates[$chanName])) {
-                    $updates[$chanName] = array();
-                }
-                $updates[$chanName][$localName] = array("from" => $localVersion, "to" => $remoteVersion);
-            }
-        }
-        return $updates;
-    }
-
-    /**
-     * Get uninstall list
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param \Magento\Framework\Connect\Singleconfig $cache
-     * @param \Magento\Framework\Connect\Config $config
-     * @param bool $withDepsRecursive
-     * @return array|null
-     */
-    public function getUninstallList($chanName, $package, $cache, $config, $withDepsRecursive = true)
-    {
-        static $level = 0;
-        static $hash = array();
-
-        $chanName = $cache->chanName($chanName);
-        $level++;
-
-        try {
-            $chanName = $cache->chanName($chanName);
-            if (!$cache->hasPackage($chanName, $package)) {
-                $level--;
-                if ($level == 0) {
-                    $hash = array();
-                    return array('list' => array());
-                }
-                return null;
-            }
-            $dependencies = $cache->getPackageDependencies($chanName, $package);
-            $data = $cache->getPackage($chanName, $package);
-            $version = $data['version'];
-
-            $hash[$chanName . "/" . $package] = array(
-                'name' => $package,
-                'channel' => $chanName,
-                'version' => $version,
-                'packages' => $dependencies
-            );
-
-            if ($withDepsRecursive) {
-                $fields = array('name', 'channel', 'min', 'max');
-                foreach ($dependencies as $row) {
-                    /**
-                     * Converts an array to variables
-                     * @var $pChannel string Channel Name
-                     * @var $pName string Package Name
-                     */
-                    foreach ($fields as $key) {
-                        $varName = "p" . ucfirst($key);
-                        ${$varName} = $row[$key];
-                    }
-                    $method = __FUNCTION__;
-                    $keyInner = $pChannel . "/" . $pName;
-                    if (!isset($hash[$keyInner])) {
-                        $this->{$method}($pChannel, $pName, $cache, $config, $withDepsRecursive, false);
-                    }
-                }
-            }
-        } catch (\Exception $e) {
-        }
-
-        $level--;
-        if (0 === $level) {
-            $out = $this->processDepsHash($hash);
-            $hash = array();
-            return array('list' => $out);
-        }
-
-        return null;
-    }
-
-    /**
-     * Add data to package dependencies hash array
-     *
-     * @param array $hash Package dependencies hash array
-     * @param string $name Package name
-     * @param string $channel Package chaannel
-     * @param string $downloaded_version Package downloaded version
-     * @param string $stability Package stability
-     * @param string $versionMin Required package minimum version
-     * @param string $versionMax Required package maximum version
-     * @param string $installState Package install state
-     * @param string $message Package install message
-     * @param array|string $dependencies Package dependencies
-     * @return bool
-     */
-    private function addHashData(
-        &$hash,
-        $name,
-        $channel,
-        $downloaded_version = '',
-        $stability = '',
-        $versionMin = '',
-        $versionMax = '',
-        $installState = '',
-        $message = '',
-        $dependencies = ''
-    ) {
-        /**
-         * When we are building dependencies tree we should base this calculations not on full key as on a
-         * unique value but check it by parts. First part which should be checked is EXTENSION_NAME also this
-         * part should be unique globally not per channel.
-         */
-        $key = $name;
-        $hash[$key] = array(
-            'name' => $name,
-            'channel' => $channel,
-            'downloaded_version' => $downloaded_version,
-            'stability' => $stability,
-            'min' => $versionMin,
-            'max' => $versionMax,
-            'install_state' => $installState,
-            'message' => (isset(
-                $this->installStates[$installState]
-            ) ? $this->installStates[$installState] : '') . $message,
-            'packages' => $dependencies
-        );
-        return true;
-    }
-
-    /**
-     * Get dependencies list/install order info
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param \Magento\Framework\Connect\Singleconfig $cache
-     * @param \Magento\Framework\Connect\Config $config
-     * @param mixed $versionMax
-     * @param mixed $versionMin
-     * @param boolean $withDepsRecursive
-     * @param boolean $forceRemote
-     * @param \Magento\Framework\Connect\Rest $rest
-     * @return mixed
-     */
-    public function getDependenciesList(
-        $chanName,
-        $package,
-        $cache,
-        $config,
-        $versionMax = false,
-        $versionMin = false,
-        $withDepsRecursive = true,
-        $forceRemote = false,
-        $rest = null
-    ) {
-        static $level = 0;
-        static $_depsHash = array();
-        static $_deps = array();
-        static $_failed = array();
-        $install_state = self::INSTALL_STATE_INSTALL;
-        $version = '';
-        $message = '';
-
-        $level++;
-
-        try {
-            $chanName = $cache->chanName($chanName);
-
-            if (!$rest) {
-                $rest = new \Magento\Framework\Connect\Rest($config->protocol);
-            }
-            $rest->setChannel($cache->chanUrl($chanName));
-            $releases = $rest->getReleases($package);
-            if (!$releases || !count($releases)) {
-                throw new \Exception("No releases for '{$package}', skipping");
-            }
-            $state = $config->preferred_state ? $config->preferred_state : 'stable';
-            /**
-             * Check current package version first
-             */
-            $installedPackage = $cache->getPackage($chanName, $package);
-            if ($installedPackage && is_array($installedPackage)) {
-                $installedRelease = array(
-                    array('v' => $installedPackage['version'], 's' => $installedPackage['stability'])
-                );
-                $version = $cache->detectVersionFromRestArray($installedRelease, $versionMin, $versionMax, $state);
-            }
-            if (!$version) {
-                $version = $cache->detectVersionFromRestArray($releases, $versionMin, $versionMax, $state);
-            }
-            if (!$version) {
-                $versionState = $cache->detectVersionFromRestArray($releases, $versionMin, $versionMax);
-                if ($versionState) {
-                    /** @var $packageInfo \Magento\Framework\Connect\Package */
-                    $packageInfo = $rest->getPackageReleaseInfo($package, $versionState);
-                    if (false !== $packageInfo) {
-                        $stability = $packageInfo->getStability();
-                        throw new \Exception(
-                            "Extension is '{$stability}' please check(or change) stability settings" .
-                            " on Magento Connect Manager"
-                        );
-                    }
-                }
-                throw new \Exception("Version for '{$package}' was not detected");
-            }
-            $packageInfo = $rest->getPackageReleaseInfo($package, $version);
-            if (false === $packageInfo) {
-                throw new \Exception("Package release '{$package}' not found on server");
-            }
-            $stability = $packageInfo->getStability();
-
-            /**
-             * check is package already installed
-             */
-            if ($installedPackage = $cache->isPackageInstalled($package)) {
-                if ($chanName == $installedPackage['channel']) {
-                    /**
-                     * check versions
-                     */
-                    if (version_compare($version, $installedPackage['version'], '>')) {
-                        $install_state = self::INSTALL_STATE_UPGRADE;
-                    } elseif (version_compare($version, $installedPackage['version'], '<')) {
-                        $version = $installedPackage['version'];
-                        $stability = $installedPackage['stability'];
-                        $install_state = self::INSTALL_STATE_WRONG_VERSION;
-                    } else {
-                        $install_state = self::INSTALL_STATE_ALREADY_INSTALLED;
-                    }
-                } else {
-                    $install_state = self::INSTALL_STATE_INCOMPATIBLE;
-                }
-            }
-
-            $deps_tmp = $packageInfo->getDependencyPackages();
-
-            /**
-             * Select distinct packages grouped by name
-             */
-            $dependencies = array();
-            foreach ($deps_tmp as $row) {
-                if (isset($dependencies[$row['name']])) {
-                    if ($installedPackageDep = $cache->isPackageInstalled($row['name'])) {
-                        if ($installedPackageDep['channel'] == $row['channel']) {
-                            $dependencies[$row['name']] = $row;
-                        }
-                    } elseif ($config->root_channel == $row['channel']) {
-                        $dependencies[$row['name']] = $row;
-                    }
-                } else {
-                    $dependencies[$row['name']] = $row;
-                }
-            }
-
-            /**
-             * When we are building dependencies tree we should base this calculations not on full key as on a
-             * unique value but check it by parts. First part which should be checked is EXTENSION_NAME also this part
-             * should be unique globally not per channel.
-             */
-            if (self::INSTALL_STATE_INCOMPATIBLE != $install_state) {
-                $this->addHashData(
-                    $_depsHash,
-                    $package,
-                    $chanName,
-                    $version,
-                    $stability,
-                    $versionMin,
-                    $versionMax,
-                    $install_state,
-                    $message,
-                    $dependencies
-                );
-            }
-
-            if ($withDepsRecursive && self::INSTALL_STATE_INCOMPATIBLE != $install_state) {
-                $flds = array('name', 'channel', 'min', 'max');
-                foreach ($dependencies as $row) {
-                    /**
-                     * Converts an array to variables
-                     * @var $pChannel string Channel Name
-                     * @var $pName string Package Name
-                     * @var $pMax string Maximum version number
-                     * @var $pMin string Minimum version number
-                     */
-                    foreach ($flds as $key) {
-                        $varName = "p" . ucfirst($key);
-                        ${$varName} = $row[$key];
-                    }
-                    $method = __FUNCTION__;
-                    /**
-                     * When we are building dependencies tree we should base this calculations not on full key as
-                     * on a unique value but check it by parts. First part which should be checked is EXTENSION_NAME
-                     * also this part should be unique globally not per channel.
-                     */
-                    $keyInner = $pName;
-                    if (!isset($_depsHash[$keyInner])) {
-                        $_deps[] = $row;
-                        $this->{$method}(
-                            $pChannel,
-                            $pName,
-                            $cache,
-                            $config,
-                            $pMax,
-                            $pMin,
-                            $withDepsRecursive,
-                            $forceRemote,
-                            $rest
-                        );
-                    } else {
-                        $downloaded = $_depsHash[$keyInner]['downloaded_version'];
-                        $hasMin = $_depsHash[$keyInner]['min'];
-                        $hasMax = $_depsHash[$keyInner]['max'];
-                        if ($pMin === $hasMin && $pMax === $hasMax) {
-                            continue;
-                        }
-
-                        if ($cache->versionInRange($downloaded, $pMin, $pMax)) {
-                            continue;
-                        }
-
-                        $names = array("pMin", "pMax", "hasMin", "hasMax");
-                        for ($i = 0,$c = count($names); $i < $c; $i++) {
-                            if (!isset(${$names[$i]})) {
-                                continue;
-                            }
-                            if (false !== ${$names[$i]}) {
-                                continue;
-                            }
-                            ${$names[$i]} = $i % 2 == 0 ? "0" : "999999999";
-                        }
-
-                        if (!$cache->hasVersionRangeIntersect($pMin, $pMax, $hasMin, $hasMax)) {
-                            $reason = "Detected {$pName} conflict of versions: {$hasMin}-{$hasMax} and {$pMin}-{$pMax}";
-                            unset($_depsHash[$keyInner]);
-                            $_failed[] = array(
-                                'name' => $pName,
-                                'channel' => $pChannel,
-                                'max' => $pMax,
-                                'min' => $pMin,
-                                'reason' => $reason
-                            );
-                            continue;
-                        }
-                        $newMaxIsLess = version_compare($pMax, $hasMax, "<");
-                        $newMinIsGreater = version_compare($pMin, $hasMin, ">");
-                        $forceMax = $newMaxIsLess ? $pMax : $hasMax;
-                        $forceMin = $newMinIsGreater ? $pMin : $hasMin;
-                        $this->{$method}(
-                            $pChannel,
-                            $pName,
-                            $cache,
-                            $config,
-                            $forceMax,
-                            $forceMin,
-                            $withDepsRecursive,
-                            $forceRemote,
-                            $rest
-                        );
-                    }
-                }
-            }
-            unset($rest);
-        } catch (\Exception $e) {
-            $_failed[] = array(
-                'name' => $package,
-                'channel' => $chanName,
-                'max' => $versionMax,
-                'min' => $versionMin,
-                'reason' => $e->getMessage()
-            );
-        }
-
-        $level--;
-        if ($level == 0) {
-            $out = $this->processDepsHash($_depsHash, false);
-            $deps = $_deps;
-            $failed = $_failed;
-            $_depsHash = array();
-            $_deps = array();
-            $_failed = array();
-            return array('deps' => $deps, 'result' => $out, 'failed' => $failed);
-        }
-
-        return null;
-    }
-
-    /**
-     * Process dependencies hash. Makes topological sorting and gives operation order list
-     *
-     * @param array $depsHash
-     * @param bool $sortReverse
-     * @return array
-     */
-    protected function processDepsHash(&$depsHash, $sortReverse = true)
-    {
-        $nodes = array();
-        $graph = new \Magento\Framework\Connect\Structures\Graph();
-
-        foreach ($depsHash as $key => $data) {
-            $node = new \Magento\Framework\Connect\Structures\Node();
-            $nodes[$key] =& $node;
-            unset($data['packages']);
-            $node->setData($data);
-            $graph->addNode($node);
-            unset($node);
-        }
-
-        if (count($nodes) > 1) {
-            foreach ($depsHash as $key => $data) {
-                $packages = $data['packages'];
-                foreach ($packages as $pdata) {
-                    $pName = $pdata['name'];
-                    if (isset($nodes[$key], $nodes[$pName])) {
-                        $nodes[$key]->connectTo($nodes[$pName]);
-                    }
-                }
-            }
-        }
-
-        if (!$graph->isAcyclic()) {
-            throw new \Exception("Dependency references are cyclic");
-        }
-
-        $result = $graph->topologicalSort();
-        $sortReverse ? krsort($result) : ksort($result);
-        $out = array();
-        foreach ($result as $nodes) {
-            foreach ($nodes as $n) {
-                /** @var $n \Magento\Framework\Connect\Structures\Node */
-                $out[] = $n->getData();
-            }
-        }
-        unset($graph, $nodes);
-        return $out;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Rest.php b/downloader/lib/Magento/Framework/Connect/Rest.php
deleted file mode 100644
index 67eacbf5f93074c406efbeda82d7e0a4d29e8b68..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Rest.php
+++ /dev/null
@@ -1,391 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to work with remote REST interface
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Rest
-{
-    /**
-     * Paths for xml config files
-     */
-    const CHANNELS_XML = "channels.xml";
-
-    const CHANNEL_XML = "channel.xml";
-
-    const PACKAGES_XML = "packages.xml";
-
-    const RELEASES_XML = "releases.xml";
-
-    const PACKAGE_XML = "package.xml";
-
-    const EXT = "tgz";
-
-    /**
-     * HTTP Loader
-     * @var \Magento\Framework\HTTP\IClient
-     */
-    protected $_loader = null;
-
-    /**
-     * XML parser
-     *
-     * @var \Magento\Framework\Xml\Parser
-     */
-    protected $_parser = null;
-
-    /**
-     * Channel URI
-     *
-     * @var string
-     */
-    protected $_chanUri = '';
-
-    /**
-     * Protocol HTTP or FTP
-     *
-     * @var string http or ftp
-     */
-    protected $_protocol = '';
-
-    /**
-     * States interpretation
-     *
-     * @var array
-     */
-    protected $states = array('b' => 'beta', 'd' => 'dev', 's' => 'stable', 'a' => 'alpha');
-
-    /**
-     * Constructor sets default protocol
-     *
-     * @param string $protocol
-     */
-    public function __construct($protocol = "http")
-    {
-        switch ($protocol) {
-            case 'ftp':
-                $this->_protocol = 'ftp';
-                break;
-            case 'http':
-                $this->_protocol = 'http';
-                break;
-            default:
-                $this->_protocol = 'http';
-                break;
-        }
-    }
-
-    /**
-     * Set channel URI
-     *
-     * @param string $uri
-     * @return void
-     */
-    public function setChannel($uri)
-    {
-        $this->_chanUri = $uri;
-    }
-
-    /**
-     * Get HTTP loader
-     *
-     * @return \Magento\Framework\HTTP\IClient|\Magento\Framework\Connect\Loader\Ftp
-     */
-    public function getLoader()
-    {
-        if (is_null($this->_loader)) {
-            $this->_loader = \Magento\Framework\Connect\Loader::getInstance($this->_protocol);
-        }
-        return $this->_loader;
-    }
-
-    /**
-     * Get parser
-     *
-     * @return \Magento\Framework\Xml\Parser
-     */
-    protected function getParser()
-    {
-        if (is_null($this->_parser)) {
-            $this->_parser = new \Magento\Framework\Xml\Parser();
-        }
-        return $this->_parser;
-    }
-
-    /**
-     * Load URI response
-     *
-     * @param string $uriSuffix
-     * @return bool|string
-     */
-    protected function loadChannelUri($uriSuffix)
-    {
-        $url = $this->_chanUri . "/" . $uriSuffix;
-        $this->getLoader()->get($url);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        return $this->getLoader()->getBody();
-    }
-
-    /**
-     * Get channels list of URI
-     *
-     * @return array
-     */
-    public function getChannelInfo()
-    {
-        $out = $this->loadChannelUri(self::CHANNEL_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            throw new \Exception("Invalid server response for {$this->_chanUri}");
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-
-        $vo = new \Magento\Framework\Connect\Channel\VO();
-        $vo->fromArray($out['channel']);
-        if (!$vo->validate()) {
-            throw new \Exception("Invalid channel.xml file");
-        }
-        return $vo;
-    }
-
-    /**
-     * Get packages list of channel
-     *
-     * @return array
-     */
-    public function getPackages()
-    {
-        $out = $this->loadChannelUri(self::PACKAGES_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-
-        if (!isset($out['data']['p'])) {
-            return array();
-        }
-        if (isset($out['data']['p'][0])) {
-            return $out['data']['p'];
-        }
-        if (is_array($out['data']['p'])) {
-            return array($out['data']['p']);
-        }
-        return array();
-    }
-
-    /**
-     * Return Channel Packages loaded from Channel Server
-     *
-     * @return array|bool|string
-     */
-    public function getPackagesHashed()
-    {
-        $out = $this->loadChannelUri(self::PACKAGES_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-
-        $return = array();
-        if (!isset($out['data']['p'])) {
-            return $return;
-        }
-        if (isset($out['data']['p'][0])) {
-            $return = $out['data']['p'];
-        } elseif (is_array($out['data']['p'])) {
-            $return = array($out['data']['p']);
-        }
-        $c = count($return);
-        if ($c) {
-            $output = array();
-            for ($i = 0; $i < $c; $i++) {
-                $element = $return[$i];
-                $output[$element['n']] = $element['r'];
-            }
-            $return = $output;
-        }
-
-        $out = array();
-        foreach ($return as $name => $package) {
-            $stabilities = array_map(array($this, 'shortStateToLong'), array_keys($package));
-            $versions = array_map('trim', array_values($package));
-            $package = array_combine($versions, $stabilities);
-            ksort($package);
-            $out[$name] = $package;
-        }
-        return $out;
-    }
-
-    /**
-     * Stub
-     * @param string $n
-     * @return string
-     */
-    public function escapePackageName($n)
-    {
-        return $n;
-    }
-
-    /**
-     * Get releases list of package on current channel
-     *
-     * @param string $package package name
-     * @return array|bool
-     */
-    public function getReleases($package)
-    {
-        $out = $this->loadChannelUri($this->escapePackageName($package) . "/" . self::RELEASES_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-        if (!isset($out['releases']['r'])) {
-            return array();
-        }
-        $src = $out['releases']['r'];
-        if (!array_key_exists(0, $src)) {
-            return array($src);
-        }
-        $this->sortReleases($src);
-        return $src;
-    }
-
-    /**
-     * Sort releases
-     *
-     * @param array &$releases
-     * @return void
-     */
-    public function sortReleases(array &$releases)
-    {
-        usort($releases, array($this, 'sortReleasesCallback'));
-        $releases = array_reverse($releases);
-    }
-
-    /**
-     * Sort releases callback
-     *
-     * @param string $a
-     * @param srting $b
-     * @return int
-     */
-    protected function sortReleasesCallback($a, $b)
-    {
-        return version_compare($a['v'], $b['v']);
-    }
-
-    /**
-     * Get package info (package.xml)
-     *
-     * @param string $package
-     * @return \Magento\Framework\Connect\Package
-     */
-    public function getPackageInfo($package)
-    {
-        $out = $this->loadChannelUri($this->escapePackageName($package) . "/" . self::PACKAGE_XML);
-        if (false === $out) {
-            return false;
-        }
-        return new \Magento\Framework\Connect\Package($out);
-    }
-
-    /**
-     * Retrieve information on Package Release from the Channel Server
-     *
-     * @param string $package
-     * @param string $version
-     * @return \Magento\Framework\Connect\Package|bool
-     */
-    public function getPackageReleaseInfo($package, $version)
-    {
-        $out = $this->loadChannelUri($this->escapePackageName($package) . "/" . $version . "/" . self::PACKAGE_XML);
-        if (false === $out) {
-            return false;
-        }
-        return new \Magento\Framework\Connect\Package($out);
-    }
-
-    /**
-     * Get package archive file of release
-     *
-     * @param string $package package name
-     * @param string $version version
-     * @param string $targetFile
-     * @return true|void
-     * @throws \Exception
-     */
-    public function downloadPackageFileOfRelease($package, $version, $targetFile)
-    {
-        $package = $this->escapePackageName($package);
-        $version = $this->escapePackageName($version);
-
-        if (file_exists($targetFile)) {
-            $chksum = $this->loadChannelUri($package . "/" . $version . "/checksum");
-            $statusCode = $this->getLoader()->getStatus();
-            if ($statusCode == 200) {
-                if (md5_file($targetFile) == $chksum) {
-                    return true;
-                }
-            }
-        }
-
-        $out = $this->loadChannelUri($package . "/" . $version . "/" . $package . "-" . $version . "." . self::EXT);
-
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            throw new \Exception("Package not found: {$package} {$version}");
-        }
-        $dir = dirname($targetFile);
-        @mkdir($dir, 0777, true);
-        $result = @file_put_contents($targetFile, $out);
-        if (false === $result) {
-            throw new \Exception("Cannot write to file {$targetFile}");
-        }
-        return true;
-    }
-
-    /**
-     * Decode state
-     *
-     * @param string $s
-     * @return string
-     */
-    public function shortStateToLong($s)
-    {
-        return isset($this->states[$s]) ? $this->states[$s] : 'dev';
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Singleconfig.php b/downloader/lib/Magento/Framework/Connect/Singleconfig.php
deleted file mode 100644
index 0ebf1e6295839c6fd1fe7c764b53a73696ef282d..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Singleconfig.php
+++ /dev/null
@@ -1,1079 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to manipulate with channel/package cache file
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Singleconfig
-{
-    /**
-     * Default single config filename
-     *
-     * 'cache.cfg'
-     */
-    const DEFAULT_SCONFIG_FILENAME = 'cache.cfg';
-
-    /**
-     * Cache data
-     *
-     * @var array
-     */
-    protected $_data = array();
-
-    /**
-     * Filename
-     *
-     * @var string
-     */
-    protected $_readFilename = false;
-
-    /**
-     * Debug flag
-     *
-     * @var bool
-     */
-    protected $_debug = false;
-
-    /**
-     * Validator instance
-     *
-     * @var \Magento\Framework\Connect\Validator
-     */
-    protected $_validator;
-
-    /**
-     * Internal keys constants
-     */
-    const K_CHAN = 'channels_by_name';
-
-    const K_CHAN_URI = 'channels_by_uri';
-
-    const K_CHAN_ALIAS = 'channel_aliases';
-
-    const K_PACK = 'packages';
-
-    const K_URI = 'uri';
-
-    const K_CHAN_DATA = 'channel_data';
-
-    const K_NAME = 'name';
-
-    const K_VER = 'version';
-
-    const K_STATE = 'stability';
-
-    const K_XML = 'xml';
-
-    const K_DEPS = 'deps';
-
-    const K_PACK_DEPS = 'pack_deps';
-
-    const K_CONFIG = 'config';
-
-    /**
-     * Constructor
-     *
-     * @param string $file
-     * @return null
-     */
-    public function __construct($file = self::DEFAULT_SCONFIG_FILENAME)
-    {
-        $this->setEmptyConfig();
-        if ($file) {
-            $this->_readFilename = $file;
-            $this->load();
-        }
-    }
-
-    /**
-     * Parse and return valid URL
-     *
-     * @param string $str
-     * @return string|bool
-     */
-    public function getValidUri($str)
-    {
-        $data = parse_url($str);
-        if (isset($data['path'])) {
-            return $data['path'];
-        }
-        return false;
-    }
-
-    /**
-     * Return config file name
-     *
-     * @return string
-     */
-    public function getFilename()
-    {
-        return $this->_readFilename;
-    }
-
-    /**
-     * Return formatted part of URI
-     *
-     * @param string $uri
-     * @return string
-     */
-    public function formatUri($uri)
-    {
-        $uri = rtrim($uri, "/");
-        $uri = str_replace("http://", '', $uri);
-        $uri = str_replace("https://", '', $uri);
-        $uri = str_replace("ftp://", '', $uri);
-        return $uri;
-    }
-
-    /**
-     * Get data
-     *
-     * @return array
-     */
-    public function getData()
-    {
-        return $this->_data;
-    }
-
-    /**
-     * Load cache from file
-     *
-     * @param string|false $file
-     * @return void
-     */
-    public function load($file = false)
-    {
-        if (false === $file) {
-            $file = $this->_readFilename;
-        }
-        if (false === $file) {
-            return;
-        }
-
-        if (!file_exists($file) || filesize($file) == 0) {
-            $this->save($file);
-            return;
-        }
-
-        if (!is_readable($file)) {
-            return $this->doError("File is not readable: '{$file}'");
-        }
-
-        $this->_readFilename = $file;
-
-        $data = @file_get_contents($file);
-        if (false === $data) {
-            return $this->doError("Cannot get file contents: '{$file}'");
-        }
-
-        if (!$this->_debug) {
-            $data = @gzuncompress($data);
-            if (false === $data) {
-                return $this->doError("Cannot unpack gzipped data in file contents: '{$file}'");
-            }
-        }
-        $data = @unserialize($data);
-        if (unserialize(false) === $data) {
-            return $this->doError("Cannot unserialize data in file contents: '{$file}'");
-        }
-
-        $validData = true;
-        foreach (array_keys($this->_data) as $k) {
-            if (!isset($data[$k])) {
-                $validData = false;
-            } else {
-                $this->_data[$k] = $data[$k];
-            }
-        }
-        if ($validData) {
-            $this->_data = $data;
-        } else {
-            $this->save();
-        }
-    }
-
-    /**
-     * Save contents
-     *
-     * @param string $file
-     * @return void
-     */
-    public function save($file = false)
-    {
-        if (false === $file) {
-            $file = $this->_readFilename;
-        }
-        if (false === $file) {
-            return;
-        }
-        $data = @serialize($this->_data);
-        if (!$this->_debug) {
-            $data = @gzcompress($data);
-        }
-        $res = true;
-        if (!file_exists($file) && is_writable(dirname($file)) || file_exists($file) && is_writable($file)) {
-            $res = @file_put_contents($file, $data);
-        }
-        if (!$res) {
-            $this->doError("Cannot save: '{$file}'");
-        }
-    }
-
-    /**
-     * Set empty config skeleton
-     *
-     * @return void
-     */
-    public function setEmptyConfig()
-    {
-        $this->_data = array(self::K_CHAN => array(), self::K_CHAN_URI => array(), self::K_CHAN_ALIAS => array());
-    }
-
-    /**
-     * Check channel, add if valid name and not exist
-     *
-     * @param string $chanName
-     * @param \Magento\Framework\Connect\Config $config
-     * @param \Magento\Framework\Connect\Rest $rest
-     * @return bool
-     * @throws \Exception
-     */
-    public function checkChannel($chanName, $config, $rest = null)
-    {
-        if ($this->isChannel($chanName)) {
-            return true;
-        }
-
-        $_validator = new \Magento\Framework\Connect\Validator();
-        if ($this->isChannelName($chanName)) {
-            $uri = $this->chanUrl($chanName);
-        } elseif ($_validator->validateUrl($chanName)) {
-            $uri = $chanName;
-        } elseif ($chanName) {
-            $uri = $config->protocol . '://' . $chanName;
-        } else {
-            throw new \Exception("'{$chanName}' is not existant channel name / valid uri");
-        }
-
-        if ($uri && !$this->isChannel($uri)) {
-            if (!isset($rest)) {
-                $rest = new \Magento\Framework\Connect\Rest($config->protocol);
-            }
-            $rest->setChannel($uri);
-            $data = $rest->getChannelInfo();
-            $data->uri = $uri;
-            $this->addChannel($data->name, $uri);
-        }
-
-        return $this->isChannel($uri);
-    }
-
-    /**
-     * Check Channel name
-     *
-     * @param string $chanName
-     * @return bool
-     */
-    public function isChannel($chanName)
-    {
-        if ($this->isChannelName($chanName)) {
-            return true;
-        }
-        if ($this->isChannelUri($chanName)) {
-            return true;
-        }
-        if ($this->isChannelAlias($chanName)) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Get channel
-     *
-     * @param string $chanName
-     * @return array
-     */
-    public function getChannel($chanName)
-    {
-        if ($this->isChannelAlias($chanName)) {
-            $chanName = $this->getChannelNameByAlias($chanName);
-        } elseif ($this->isChannelUri($chanName)) {
-            $chanName = $this->getChannelUriRecord($chanName);
-        }
-        if ($this->isChannelName($chanName)) {
-            return $this->_data[self::K_CHAN][$chanName];
-        }
-    }
-
-    /**
-     * Is channel name?
-     *
-     * @param string $chanName
-     * @return bool
-     */
-    public function isChannelName($chanName)
-    {
-        return isset($this->_data[self::K_CHAN][$chanName]);
-    }
-
-    /**
-     * Is channel alias?
-     *
-     * @param string $chanName
-     * @return bool
-     */
-    public function isChannelAlias($chanName)
-    {
-        return isset($this->_data[self::K_CHAN_ALIAS][$chanName]);
-    }
-
-    /**
-     * Is channel uri?
-     *
-     * @param string $uri
-     * @return bool
-     */
-    public function isChannelUri($uri)
-    {
-        $uri = $this->formatUri($uri);
-        return isset($this->_data[self::K_CHAN_URI][$uri]);
-    }
-
-    /**
-     * Unset channel uri record
-     *
-     * @param string $uri
-     * @return void
-     */
-    protected function unsetChannelUriRecord($uri)
-    {
-        $uri = $this->formatUri($uri);
-        unset($this->_data[self::K_CHAN_URI][$uri]);
-    }
-
-    /**
-     * Set channel uri record: uri maps to channel record
-     *
-     * @param string $chanName
-     * @param string $uri
-     * @return void
-     */
-    protected function setChannelUriRecord($chanName, $uri)
-    {
-        $uri = $this->formatUri($uri);
-        $this->_data[self::K_CHAN_URI][$uri] = $chanName;
-    }
-
-    /**
-     * Get channel name by uri record
-     *
-     * @param string $uri
-     * @return string
-     */
-    protected function getChannelUriRecord($uri)
-    {
-        $uri = $this->formatUri($uri);
-        return $this->_data[self::K_CHAN_URI][$uri];
-    }
-
-    /**
-     * Unset channel record
-     *
-     * @param string $chanName
-     * @return void
-     */
-    protected function unsetChannelRecord($chanName)
-    {
-        unset($this->_data[self::K_CHAN][$chanName]);
-    }
-
-    /**
-     * Get channel record
-     *
-     * @param string $chanName
-     * @return array
-     */
-    protected function getChannelRecord($chanName)
-    {
-        return $this->_data[self::K_CHAN][$chanName];
-    }
-
-    /**
-     * Set channel record
-     *
-     * @param string $chanName
-     * @param string $uri
-     * @param mixed $data
-     * @param array $packages
-     * @return void
-     */
-    protected function setChannelRecord($chanName, $uri, $data, $packages = array())
-    {
-        $this->_data[self::K_CHAN][$chanName] = array(
-            self::K_NAME => $chanName,
-            self::K_URI => $uri,
-            self::K_CHAN_DATA => $data,
-            self::K_PACK => $packages
-        );
-    }
-
-    /**
-     * Set package record
-     * @param string $chanName
-     * @param string $packageName
-     * @param array $data
-     * @param string $oneField
-     * @return void
-     */
-    protected function setPackageRecord($chanName, $packageName, $data, $oneField = null)
-    {
-        if (null === $oneField) {
-            $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName] = $data;
-        } else {
-            $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName][$oneField] = $data;
-        }
-    }
-
-    /**
-     * Unset package record
-     *
-     * @param string $chanName
-     * @param string $packageName
-     * @return void
-     */
-    protected function unsetPackageRecord($chanName, $packageName)
-    {
-        unset($this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName]);
-    }
-
-    /**
-     * Get package record
-     *
-     * @param string $chanName
-     * @param string $packageName
-     * @param string $field
-     * @return array
-     */
-    protected function fetchPackage($chanName, $packageName, $field = null)
-    {
-        if (null === $field) {
-            return $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName];
-        } else {
-            return $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName][$field];
-        }
-    }
-
-    /**
-     * Has package record
-     *
-     * @param string $chanName
-     * @param string $packageName
-     * @return bool
-     */
-    protected function hasPackageRecord($chanName, $packageName)
-    {
-        return isset($this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName]);
-    }
-
-    /**
-     * Get channel name by alias
-     * @param string $alias
-     * @return array
-     */
-    protected function getChannelNameByAlias($alias)
-    {
-        return $this->_data[self::K_CHAN_ALIAS][$alias];
-    }
-
-    /**
-     * Set channel alias
-     *
-     * @param string $alias
-     * @param string $chanName
-     * @return void
-     */
-    protected function setChannelAlias($alias, $chanName)
-    {
-        $this->_data[self::K_CHAN_ALIAS][$alias] = $chanName;
-    }
-
-    /**
-     * Unset channel alias
-     *
-     * @param string $alias
-     * @return void
-     */
-    protected function unsetChannelAlias($alias)
-    {
-        unset($this->_data[self::K_CHAN_ALIAS][$alias]);
-    }
-
-    /**
-     * Clear all aliases of channel
-     *
-     * @param string $chanName channel name
-     * @return void
-     */
-    protected function clearAliases($chanName)
-    {
-        $keys = array_keys($this->_data[self::K_CHAN_ALIAS]);
-        foreach ($keys as $key) {
-            if ($this->_data[self::K_CHAN_ALIAS][$key] == $chanName) {
-                unset($this->_data[self::K_CHAN_ALIAS][$key]);
-            }
-        }
-    }
-
-    /**
-     * Add channel alias
-     *
-     * @param string $chanName
-     * @param string $alias
-     * @return void
-     */
-    public function addChannelAlias($chanName, $alias)
-    {
-        if ($this->isChannelName($alias)) {
-            return $this->doError("Alias '{$alias}' is existant channel name!");
-        }
-
-        if (!$this->isChannelName($chanName)) {
-            return $this->doError("Channel '{$chanName}' doesn't exist");
-        }
-        $this->setChannelAlias($alias, $chanName);
-        $this->save();
-    }
-
-    /**
-     * Add channel
-     *
-     * @param string $chanName
-     * @param string $uri
-     * @param array $data
-     * @return void
-     */
-    public function addChannel($chanName, $uri, $data = array())
-    {
-        if ($this->isChannelName($chanName)) {
-            return $this->doError("Channel '{$chanName}' already exist!");
-        }
-        if ($this->isChannelUri($uri)) {
-            return $this->doError("Channel with uri= '{$uri}' already exist!");
-        }
-        if ($this->isChannelAlias($chanName)) {
-            $this->unsetChannelAlias($chanName);
-        }
-        $uri = $this->formatUri($uri);
-        $this->setChannelRecord($chanName, $uri, $data);
-        $this->setChannelUriRecord($chanName, $uri);
-        $this->save();
-    }
-
-    /**
-     * Delete channel
-     *
-     * @param string $chanName
-     * @return void
-     */
-    public function deleteChannel($chanName)
-    {
-        if ($this->isChannelName($chanName)) {
-            $record = $this->getChannelRecord($chanName);
-            $this->unsetChannelUriRecord($record[self::K_URI]);
-            $this->unsetChannelRecord($chanName);
-            $this->clearAliases($chanName);
-        } elseif ($this->isChannelUri($chanName)) {
-            $uri = $chanName;
-            $chanName = $this->getChannelUriRecord($uri);
-            $this->unsetChannelUriRecord($uri);
-            $this->unsetChannelRecord($chanName);
-            $this->clearAliases($chanName);
-        } elseif ($this->isChannelAlias($chanName)) {
-            $this->unsetChannelAlias($chanName);
-        } else {
-            return $this->doError("'{$chanName}' was not found in aliases, channel names, channel uris");
-        }
-        $this->save();
-    }
-
-    /**
-     * Converts channel name, url or alias to channel name
-     * throws exception if not found
-     *
-     * @param string $chanName
-     * @return string
-     */
-    public function chanName($chanName)
-    {
-        $channelData = $this->getChannel($chanName);
-        if (!$channelData) {
-            return $this->doError("Channel '{$chanName}' doesn't exist");
-        }
-        return $channelData[self::K_NAME];
-    }
-
-    /**
-     * Return Channel URI
-     *
-     * @param string $chan
-     * @return void
-     */
-    public function chanUrl($chan)
-    {
-        $channelData = $this->getChannel($chan);
-        if (!$channelData) {
-            return $this->doError("Channel '{$chan}' doesn't exist");
-        }
-        return $channelData[self::K_URI];
-    }
-
-    /**
-     * Add package
-     *
-     * @param \Magento\Framework\Connect\Package $package
-     * @return void
-     */
-    public function addPackage($package)
-    {
-        $channel = $this->chanName($package->getChannel());
-        $name = $package->getName();
-        $record = array(
-            self::K_VER => $package->getVersion(),
-            self::K_STATE => $package->getStability(),
-            self::K_XML => $package->getPackageXml(),
-            self::K_NAME => $name,
-            self::K_DEPS => array(),
-            self::K_PACK_DEPS => array()
-        );
-        $this->setPackageRecord($channel, $name, $record);
-        $this->setPackageDependencies($channel, $name, $package->getDependencyPackages());
-        $this->save();
-    }
-
-    /**
-     * Delete package
-     *
-     * @param string $chanName
-     * @param string $package
-     * @return void
-     */
-    public function deletePackage($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        $this->unsetPackageRecord($chanName, $package);
-        $this->save();
-    }
-
-    /**
-     * Get package
-     *
-     * @param string $chanName
-     * @param string $package
-     * @return null
-     */
-    public function getPackage($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            return $this->fetchPackage($chanName, $package);
-        }
-        return null;
-    }
-
-    /**
-     * Retrieve Package object
-     *
-     * @param string $chanName
-     * @param string $package
-     * @return \Magento\Framework\Connect\Package
-     * @throws \Exception
-     */
-    public function getPackageObject($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            $data = $this->fetchPackage($chanName, $package);
-            return new \Magento\Framework\Connect\Package($data[self::K_XML]);
-        }
-        throw new \Exception("Cannot get package: '{$package}'");
-    }
-
-    /**
-     * Checks the presence of the package in the channel
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param string|false $versionMin
-     * @param string|false $versionMax
-     * @return bool
-     */
-    public function hasPackage($chanName, $package, $versionMin = false, $versionMax = false)
-    {
-        $chanName = $this->chanName($chanName);
-        $data = $this->getPackage($chanName, $package);
-        if (null === $data) {
-            return false;
-        }
-        $installedVersion = $data[self::K_VER];
-        return $this->versionInRange($installedVersion, $versionMin, $versionMax);
-    }
-
-    /**
-     * Check whether package installed or not. Return package if it installed
-     *
-     * @param string $package package name
-     * @return array|bool
-     */
-    public function isPackageInstalled($package)
-    {
-        $channels = $this->getChannelNames();
-        foreach ($channels as $channel) {
-            if ($installedPackage = $this->getPackage($channel, $package)) {
-                return array_merge(array('channel' => $channel), $installedPackage);
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Checks whether the version in in the specified range of versionMin to versionMax
-     *
-     * @param string $version
-     * @param string $versionMin
-     * @param string $versionMax
-     * @return bool
-     */
-    public function versionInRange($version, $versionMin = false, $versionMax = false)
-    {
-        if (false === $versionMin || empty($versionMin)) {
-            $minOk = true;
-        } else {
-            $minOk = version_compare($version, $versionMin, ">=");
-        }
-        if (false === $versionMax || empty($versionMax)) {
-            $maxOk = true;
-        } else {
-            $maxOk = version_compare($version, $versionMax, "<=");
-        }
-        return $minOk && $maxOk;
-    }
-
-    /**
-     * @param string $min1
-     * @param string $max1
-     * @param string $min2
-     * @param string $max2
-     * @return bool
-     */
-    public function hasVersionRangeIntersect($min1, $max1, $min2, $max2)
-    {
-        if (version_compare($min1, $min2, ">") && version_compare($max1, $max2, ">")) {
-            return false;
-        } elseif (version_compare($min1, $min2, "<") && version_compare($max1, $max2, "<")) {
-            return false;
-        } elseif (version_compare($min1, $min2, ">=") && version_compare($max1, $max2, "<=")) {
-            return true;
-        } elseif (version_compare($min1, $min2, "<=") && version_compare($max1, $max2, ">=")) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Clear contents to defaults and save
-     *
-     * @return void
-     */
-    public function clear()
-    {
-        $this->setEmptyConfig();
-        $this->save();
-    }
-
-    /**
-     * Output error - throw exception
-     *
-     * @param string $message
-     * @throws \Exception
-     * @return void
-     */
-    protected function doError($message)
-    {
-        throw new \Exception($message);
-    }
-
-    /**
-     * Compare Stability
-     *
-     * @param string $s1
-     * @param string $s2
-     * @return int
-     */
-    public function compareStabilities($s1, $s2)
-    {
-        if (!$this->_validator) {
-            $this->_validator = new \Magento\Framework\Connect\Validator();
-        }
-        return $this->_validator->compareStabilities($s1, $s2);
-    }
-
-    /**
-     * Retrieve Release Version from Rest Data
-     *
-     * @param array $restData
-     * @param string|false $argVersionMin
-     * @param string|false $argVersionMax
-     * @param string $preferredStability
-     * @return bool|string
-     */
-    public function detectVersionFromRestArray(
-        $restData,
-        $argVersionMin = false,
-        $argVersionMax = false,
-        $preferredStability = 'devel'
-    ) {
-        if (!is_array($restData)) {
-            return false;
-        }
-
-        foreach ($restData as $vData) {
-            $stability = trim($vData['s']);
-            $version = trim($vData['v']);
-            $goodStability = $this->compareStabilities($stability, $preferredStability) >= 0;
-            if ($goodStability && $this->versionInRange($version, $argVersionMin, $argVersionMax)) {
-                return $version;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Set Package dependencies
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param mixed $data
-     * @return bool
-     */
-    public function setPackageDependencies($chanName, $package, $data)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            $this->setPackageRecord($chanName, $package, $data, self::K_PACK_DEPS);
-            $this->save();
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Retrieve Package Dependencies
-     *
-     * @param string $chanName
-     * @param string $package
-     * @return array|bool
-     */
-    public function getPackageDependencies($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            return $this->fetchPackage($chanName, $package, self::K_PACK_DEPS);
-        }
-        return false;
-    }
-
-    /**
-     * Set Dependency information into package
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param mixed $data
-     * @return bool
-     */
-    public function setDependencyInfo($chanName, $package, $data)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            $this->setPackageRecord($chanName, $package, $data, self::K_DEPS);
-            $this->save();
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Get Dependency information from package
-     *
-     * @param string $chanName
-     * @param string $package
-     * @return array|false
-     */
-    public function getDependencyInfo($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            return $this->fetchPackage($chanName, $package, self::K_DEPS);
-        }
-        return false;
-    }
-
-    /**
-     * Retrieve chanel names
-     *
-     * @return array
-     */
-    public function getChannelNames()
-    {
-        return array_keys($this->_data[self::K_CHAN]);
-    }
-
-    /**
-     * Retrieve Packages array
-     *
-     * @param string|bool $channel
-     * @return array
-     */
-    public function getPackagesData($channel = false)
-    {
-        if (false == $channel) {
-            return $this->_data[self::K_CHAN];
-        }
-
-        if (!$this->isChannel($channel)) {
-            return array();
-        }
-        return $this->getChannel($channel);
-    }
-
-    /**
-     * Check whether Package exists in dependency list
-     *
-     * @param array $deps
-     * @param string $chanName
-     * @param string $packageName
-     * @return bool
-     */
-    public function specifiedInDependencyList($deps, $chanName, $packageName)
-    {
-        foreach ($deps as $dep) {
-            if ($chanName == $dep['channel'] && $packageName == $dep['name']) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Checks is package required by other
-     *
-     * @param string $chanName
-     * @param string $packageName
-     * @param array $excludeList
-     * @return array
-     */
-    public function requiredByOtherPackages($chanName, $packageName, $excludeList = array())
-    {
-        $out = array();
-        foreach ($this->_data[self::K_CHAN] as $channel => $data) {
-            foreach ($data[self::K_PACK] as $package) {
-                if ($this->specifiedInDependencyList($excludeList, $channel, $package['name'])) {
-                    continue;
-                }
-                $deps = $package[self::K_PACK_DEPS];
-                if ($this->specifiedInDependencyList($deps, $chanName, $packageName)) {
-                    $out[] = array(
-                        'channel' => $channel,
-                        'name' => $package['name'],
-                        'version' => $package['version']
-                    );
-                }
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * Get Installed packages array
-     *
-     * @param string|false $chanName
-     * @return array
-     */
-    public function getInstalledPackages($chanName = false)
-    {
-        $data = null;
-        if (false == $chanName) {
-            $data = $this->getChannelNames();
-        } elseif ($this->isChannel($chanName)) {
-            $tmp = $this->getChannel($chanName);
-            $data = array($tmp[self::K_NAME]);
-        }
-        $out = array();
-        foreach ($data as $chanName) {
-            $channel = $this->getChannel($chanName);
-            $out[$chanName] = array();
-            foreach ($channel[self::K_PACK] as $package => $data) {
-                $out[$chanName][$package] = array();
-                foreach (array(self::K_VER, self::K_STATE) as $k) {
-                    $out[$chanName][$package][$k] = $data[$k];
-                }
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * Check if package conflicts with installed packages
-     * Returns:
-     *    array with conflicts
-     *    false if no conflicts
-     *
-     * @param string $chanName
-     * @param string $packageName
-     * @param string $version
-     * @return array|bool
-     */
-    public function hasConflicts($chanName, $packageName, $version)
-    {
-        $conflicts = array();
-        foreach ($this->_data[self::K_CHAN] as $channel => $data) {
-            foreach ($data[self::K_PACK] as $package) {
-                $deps = $package[self::K_PACK_DEPS];
-                foreach ($deps as $dep) {
-                    if ($dep['name'] != $packageName) {
-                        continue;
-                    }
-
-                    if (!$this->versionInRange($version, $dep['min'], $dep['max'])) {
-                        $conflicts[] = $channel . "/" . $package['name'] . " " . $package['version'];
-                    }
-                }
-            }
-        }
-        return count($conflicts) ? $conflicts : false;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Structures/Graph.php b/downloader/lib/Magento/Framework/Connect/Structures/Graph.php
deleted file mode 100644
index e9222a9e0c4e052cc5cf33d2ba2b3c3f7a1eeebd..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Structures/Graph.php
+++ /dev/null
@@ -1,281 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Structures;
-
-use Magento\Framework\Connect\Structures\Node;
-
-class Graph
-{
-    /**
-     * @var Node[]
-     */
-    protected $_nodes = array();
-
-    /**
-     * @var bool
-     */
-    protected $_directed = false;
-
-    /**
-     * @var string
-     */
-    protected $_nodeClassName = 'Magento\Framework\Connect\Structures\Node';
-
-    const ACYCLIC_VISITED_KEY = 'acyclic-test-visited';
-
-    const SORT_VISITED_KEY = 'topological-sort-visited';
-
-    const SORT_LEVEL_KEY = 'topological-sort-level';
-
-    /**
-     * Constructor
-     * @param bool $directed directed graph?
-     * @return void
-     */
-    public function __construct($directed = true)
-    {
-        $this->_directed = $directed;
-    }
-
-    /**
-     * Is graph directed?
-     *
-     * @return bool
-     */
-    public function isDirected()
-    {
-        return (bool)$this->_directed;
-    }
-
-    /**
-     * Add node to list
-     *
-     * @param Node &$newNode
-     * @return void
-     * @throws \Exception
-     */
-    public function addNode(&$newNode)
-    {
-        if (!$newNode instanceof $this->_nodeClassName) {
-            throw new \Exception(
-                __METHOD__ . " : invalid node class, should be instance of: " . $this->_nodeClassName
-            );
-        }
-        foreach ($this->_nodes as $key => $node) {
-            if ($newNode === $node) {
-                throw new \Exception(__METHOD__ . " : received duplicate object");
-            }
-        }
-        $this->_nodes[] =& $newNode;
-        $newNode->setGraph($this);
-    }
-
-    /**
-     * Remove a Node from the Graph
-     * @param  Node &$node
-     * @return void
-     */
-    public function removeNode(&$node)
-    {
-    }
-
-    /**
-     * Return set of nodes
-     *
-     * @return Node[]
-     */
-    public function &getNodes()
-    {
-        return $this->_nodes;
-    }
-
-    /**
-     * Is asyclic
-     *
-     * @return bool
-     */
-    public function isAcyclic()
-    {
-        if (!$this->isDirected()) {
-            return false;
-        }
-        return self::_isAcyclic($this);
-    }
-
-    /**
-     * This is a variant of Graph::inDegree which does
-     * not count nodes marked as visited.
-     *
-     * @param Node &$node
-     * @param string $metadataKey
-     * @return int
-     */
-    protected static function _nonVisitedInDegree(&$node, $metadataKey)
-    {
-        $result = 0;
-        $graphNodes =& $node->getGraph()->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if (!$graphNodes[$key]->getMetadata($metadataKey) && $graphNodes[$key]->connectsTo($node)) {
-                $result++;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Is graph acyclic?
-     *
-     * @param Graph &$graph
-     * @return bool
-     */
-    protected static function _isAcyclic(&$graph)
-    {
-        // Mark every node as not visited
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        $refGenerator = array();
-        foreach ($nodeKeys as $key) {
-            $refGenerator[] = false;
-            $nodes[$key]->setMetadata(self::ACYCLIC_VISITED_KEY, $refGenerator[sizeof($refGenerator) - 1]);
-        }
-
-        // Iteratively peel off leaf nodes
-        do {
-            // Find out which nodes are leafs (excluding visited nodes)
-            $leafNodes = array();
-            foreach ($nodeKeys as $key) {
-                if (!$nodes[$key]->getMetadata(
-                    self::ACYCLIC_VISITED_KEY
-                ) && self::_nonVisitedInDegree(
-                    $nodes[$key],
-                    self::ACYCLIC_VISITED_KEY
-                ) == 0
-                ) {
-                    $leafNodes[] =& $nodes[$key];
-                }
-            }
-            // Mark leafs as visited
-            for ($i = sizeof($leafNodes) - 1; $i >= 0; $i--) {
-                $visited =& $leafNodes[$i]->getMetadata(self::ACYCLIC_VISITED_KEY);
-                $visited = true;
-                $leafNodes[$i]->setMetadata(self::ACYCLIC_VISITED_KEY, $visited);
-            }
-        } while (sizeof($leafNodes) > 0);
-
-
-        // If graph is a DAG, there should be no non-visited nodes.
-        // Let's try to prove otherwise
-        $result = true;
-        foreach ($nodeKeys as $key) {
-            if (!$nodes[$key]->getMetadata(self::ACYCLIC_VISITED_KEY)) {
-                $result = false;
-                break;
-            }
-        }
-
-        // Cleanup visited marks
-        foreach ($nodeKeys as $key) {
-            $nodes[$key]->unsetMetadata(self::ACYCLIC_VISITED_KEY);
-        }
-
-        return $result;
-    }
-
-    /**
-     * Sort returns the graph's nodes, sorted by topological order.
-     *
-     * The result is an array with
-     * as many entries as topological levels.
-     *
-     * Each entry in this array is an array of nodes within
-     * the given topological level.
-     *
-     * @return   array
-     */
-    public function topologicalSort()
-    {
-        // We only sort graphs
-        self::_topologicalSort($this);
-        $result = array();
-        // Fill out result array
-        $nodes =& $this->getNodes();
-        $nodeKeys = array_keys($nodes);
-        foreach ($nodeKeys as $key) {
-            $k = $nodes[$key]->getMetadata(self::SORT_LEVEL_KEY);
-            if (!array_key_exists($k, $result)) {
-                $result[$k] = array();
-            }
-            $result[$k][] =& $nodes[$key];
-            $nodes[$key]->unsetMetadata(self::SORT_LEVEL_KEY);
-        }
-        return $result;
-    }
-
-    /**
-     * @param Graph &$graph
-     * @return void
-     */
-    protected static function _topologicalSort(&$graph)
-    {
-        // Mark every node as not visited
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        $refGenerator = array();
-        foreach ($nodeKeys as $key) {
-            $refGenerator[] = false;
-            $nodes[$key]->setMetadata(self::SORT_VISITED_KEY, $refGenerator[sizeof($refGenerator) - 1]);
-        }
-
-        // Iteratively peel off leaf nodes
-        $topologicalLevel = 0;
-        do {
-            // Find out which nodes are leafs (excluding visited nodes)
-            $leafNodes = array();
-            foreach ($nodeKeys as $key) {
-                if (!$nodes[$key]->getMetadata(
-                    self::SORT_VISITED_KEY
-                ) && self::_nonVisitedInDegree(
-                    $nodes[$key],
-                    self::SORT_VISITED_KEY
-                ) == 0
-                ) {
-                    $leafNodes[] =& $nodes[$key];
-                }
-            }
-            // Mark leafs as visited
-            $refGenerator[] = $topologicalLevel;
-            for ($i = sizeof($leafNodes) - 1; $i >= 0; $i--) {
-                $visited =& $leafNodes[$i]->getMetadata(self::SORT_VISITED_KEY);
-                $visited = true;
-                $leafNodes[$i]->setMetadata(self::SORT_VISITED_KEY, $visited);
-                $leafNodes[$i]->setMetadata(self::SORT_LEVEL_KEY, $refGenerator[sizeof($refGenerator) - 1]);
-            }
-            $topologicalLevel++;
-        } while (sizeof($leafNodes) > 0);
-
-        foreach ($nodeKeys as $key) {
-            $nodes[$key]->unsetMetadata(self::SORT_VISITED_KEY);
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Structures/Node.php b/downloader/lib/Magento/Framework/Connect/Structures/Node.php
deleted file mode 100644
index 7707c3f164671d0df505d8ed2334346b3e0dbb73..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Structures/Node.php
+++ /dev/null
@@ -1,276 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Structures;
-
-use Magento\Framework\Connect\Structures\Graph;
-
-class Node
-{
-    /**
-     * @var mixed
-     */
-    protected $_data = null;
-
-    /**
-     * @var array
-     */
-    protected $_metadata = array();
-
-    /**
-     * @var array
-     */
-    protected $_arcs = array();
-
-    /**
-     * @var Graph
-     */
-    protected $_graph = null;
-
-    /**
-     * Node graph getter
-     *
-     * @return Graph
-     */
-    public function &getGraph()
-    {
-        return $this->_graph;
-    }
-
-    /**
-     * Node graph setter.
-     * This method should not be called directly.
-     * Use Graph::addNode instead.
-     *
-     * @param Graph &$graph
-     * @return void
-     */
-    public function setGraph(&$graph)
-    {
-        $this->_graph =& $graph;
-    }
-
-    /**
-     * Node data getter.
-     *
-     * Each graph node can contain a reference to one variable. This is the getter for that reference.
-     *
-     * @return mixed Data stored in node
-     * @access public
-     */
-    public function &getData()
-    {
-        return $this->_data;
-    }
-
-    /**
-     * Node data setter
-     *
-     * Each graph node can contain a reference to one variable. This is the setter for that reference.
-     *
-     * @param mixed $data Data to store in node
-     * @return void
-     */
-    public function setData($data)
-    {
-        $this->_data =& $data;
-    }
-
-    /**
-     * Test for existence of metadata under a given key.
-     *
-     * @param string  $key Key to test
-     * @return bool
-     * @access public
-     */
-    public function metadataKeyExists($key)
-    {
-        return array_key_exists($key, $this->_metadata);
-    }
-
-    /**
-     * Get node metadata
-     *
-     * @param string  $key
-     * @param bool $nullIfNonexistent (defaults to false).
-     * @return mixed
-     * @throws \Exception
-     */
-    public function &getMetadata($key, $nullIfNonexistent = false)
-    {
-        if (array_key_exists($key, $this->_metadata)) {
-            return $this->_metadata[$key];
-        } elseif ($nullIfNonexistent) {
-            $a = null;
-            return $a;
-        } else {
-            throw new \Exception(__METHOD__ . " : requested key doesn't exist: {$key}");
-        }
-    }
-
-    /**
-     * Delete metadata by key
-     *
-     * @param string $key Key
-     * @return void
-     */
-    public function unsetMetadata($key)
-    {
-        if (array_key_exists($key, $this->_metadata)) {
-            unset($this->_metadata[$key]);
-        }
-    }
-
-    /**
-     * Node metadata setter
-     *
-     * Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an
-     * associative array or in a dictionary. This method stores data under the given key. If the key already exists,
-     * previously stored data is discarded.
-     *
-     * @param string  $key
-     * @param mixed   $data
-     * @return void
-     */
-    public function setMetadata($key, $data)
-    {
-        $this->_metadata[$key] =& $data;
-    }
-
-    /**
-     * @param mixed &$destinationNode
-     * @return void
-     */
-    protected function _connectTo(&$destinationNode)
-    {
-        $this->_arcs[] =& $destinationNode;
-    }
-
-    /**
-     * Connect this node to another one.
-     * If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.
-     *
-     * @param \Magento\Framework\Object &$destinationNode  Structures_Graph Node to connect to
-     * @return void
-     * @throws \Exception
-     */
-    public function connectTo(&$destinationNode)
-    {
-        $class = get_class($this);
-        if (!$destinationNode instanceof $class) {
-            throw new \Exception(__METHOD__ . " : argument should be instance of {$class}");
-        }
-
-        // Nodes must already be in graphs to be connected
-        if ($this->_graph == null) {
-            throw new \Exception(__METHOD__ . " : tried to connect to null graph");
-        }
-
-        if ($destinationNode->getGraph() == null) {
-            throw new \Exception(__METHOD__ . " : tried to connect to node that is not connected to any graph");
-        }
-
-        // Connect here
-        $this->_connectTo($destinationNode);
-        // If graph is undirected, connect back
-        if (!$this->_graph->isDirected()) {
-            $destinationNode->_connectTo($this);
-        }
-    }
-
-    /**
-     * Return nodes connected to this one.
-     * @return array
-     */
-    public function getNeighbours()
-    {
-        return $this->_arcs;
-    }
-
-    /**
-     * Test whether this node has an arc to the target node
-     * Returns true if the two nodes are connected
-     *
-     * @param Node &$target
-     * @return bool
-     */
-    public function connectsTo(&$target)
-    {
-        $arcKeys = array_keys($this->_arcs);
-        foreach ($arcKeys as $key) {
-            $arc =& $this->_arcs[$key];
-            if ($target === $arc) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Calculate the in degree of the node.
-     *
-     * The indegree for a node is the number of arcs 
-     * entering the node. 
-     * 
-     * For non directed graphs:
-     *  always outdegree = indegree.
-     *  
-     * @return int
-     */
-    public function inDegree()
-    {
-        $result = 0;
-
-        if ($this->_graph == null) {
-            return $result;
-        }
-        if (!$this->_graph->isDirected()) {
-            return $this->outDegree();
-        }
-
-        $graphNodes =& $this->_graph->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if ($graphNodes[$key]->connectsTo($this)) {
-                $result++;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Calculate the out degree of the node.
-     *
-     * The outdegree for a node is the number of arcs exiting the node. 
-     * For non directed graphs:
-     *  always outdegree = indegree.
-     *
-     * @return int
-     */
-    public function outDegree()
-    {
-        if ($this->_graph == null) {
-            return 0;
-        }
-        return count($this->_arcs);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Connect/Validator.php b/downloader/lib/Magento/Framework/Connect/Validator.php
deleted file mode 100644
index 3a8c9d6c31b506e25cf50b2cb2c7174c498cd42e..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Connect/Validator.php
+++ /dev/null
@@ -1,458 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to validate string resources
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Validator
-{
-    /**
-     * Array of stability variants
-     *
-     * @var array
-     */
-    protected static $_stability = array(0 => 'devel', 1 => 'alpha', 2 => 'beta', 3 => 'stable');
-
-    /**
-     * Get array of Stability variants
-     *
-     * @static
-     * @return array
-     */
-    public static function getStabilities()
-    {
-        return self::$_stability;
-    }
-
-    /**
-     * Compare stabilities. Returns:
-     *
-     * -1 if the first stability is lower than the second
-     *  0 if they are equal
-     *  1 if the second is lower.
-     *
-     * @param int|string $s1
-     * @param int|string $s2
-     * @return int|null
-     */
-    public function compareStabilities($s1, $s2)
-    {
-        $list = $this->getStabilities();
-        $tmp = array_combine(array_values($list), array_keys($list));
-
-        if (!isset($tmp[$s1], $tmp[$s2])) {
-            throw new \Exception("Invalid stability in compareStabilities argument");
-        }
-
-        $s1 = $tmp[$s1];
-        $s2 = $tmp[$s2];
-        if ($s1 === $s2) {
-            return 0;
-        } elseif ($s1 > $s2) {
-            return 1;
-        } elseif ($s1 < $s2) {
-            return -1;
-        }
-        return null;
-    }
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * Validate max len of string
-     *
-     * @param string $str
-     * @param int $maxLen
-     * @return bool
-     */
-    public function validateMaxLen($str, $maxLen)
-    {
-        return strlen((string)$str) <= (int)$maxLen;
-    }
-
-    /**
-     * Validate channel name and url
-     *
-     * @param mixed $str
-     * @return bool
-     */
-    public function validateChannelNameOrUri($str)
-    {
-        return $this->validateUrl($str) || $this->validatePackageName($str);
-    }
-
-    /**
-     * Validate License url
-     *
-     * @param mixed $str
-     * @return bool
-     */
-    public function validateLicenseUrl($str)
-    {
-        if ($str) {
-            return $this->validateUrl($str) || $this->validatePackageName($str);
-        }
-        return true;
-    }
-
-    /**
-     * Validate compatible data
-     *
-     * @param array $data
-     * @return bool
-     */
-    public function validateCompatible(array $data)
-    {
-        if (!count($data)) {
-            /**
-             * Allow empty
-             */
-            return true;
-        }
-        $count = 0;
-        foreach ($data as $v) {
-            /**
-             * Converts an array to variables
-             * @var $channel string Channel Name
-             * @var $name string Package Name
-             * @var $max string Maximum version number
-             * @var $min string Minimum version number
-             */
-            foreach (array('name', 'channel', 'min', 'max') as $fld) {
-                ${$fld} = trim($v[$fld]);
-            }
-            $count++;
-
-            $res = $this->validateUrl($channel) && strlen($channel);
-            if (!$res) {
-                $this->addError("Invalid or empty channel in compatibility #{$count}");
-            }
-
-            $res = $this->validatePackageName($name) && strlen($name);
-            if (!$res) {
-                $this->addError("Invalid or empty name in compatibility #{$count}");
-            }
-            $res1 = $this->validateVersion($min);
-            if (!$res1) {
-                $this->addError("Invalid or empty minVersion in compatibility #{$count}");
-            }
-            $res2 = $this->validateVersion($max);
-            if (!$res2) {
-                $this->addError("Invalid or empty maxVersion in compatibility #{$count}");
-            }
-            if ($res1 && $res2 && $this->versionLower($max, $min)) {
-                $this->addError("Max version is lower than min in compatibility #{$count}");
-            }
-        }
-        return !$this->hasErrors();
-    }
-
-    /**
-     * Validate authors of package
-     *
-     * @param array $authors
-     * @return bool
-     */
-    public function validateAuthors(array $authors)
-    {
-        if (!count($authors)) {
-            $this->addError('Empty authors section');
-            return false;
-        }
-        $count = 0;
-        foreach ($authors as $v) {
-            $count++;
-            array_map('trim', $v);
-            $name = $v['name'];
-            $login = $v['user'];
-            $email = $v['email'];
-            $res = $this->validateMaxLen($name, 256) && strlen($name);
-            if (!$res) {
-                $this->addError("Invalid or empty name for author #{$count}");
-            }
-            $res = $this->validateAuthorName($login) && strlen($login);
-            if (!$res) {
-                $this->addError("Invalid or empty login for author #{$count}");
-            }
-            $res = $this->validateEmail($email);
-            if (!$res) {
-                $this->addError("Invalid or empty email for author #{$count}");
-            }
-        }
-        return !$this->hasErrors();
-    }
-
-    /**
-     * Validator errors
-     *
-     * @var array
-     */
-    private $_errors = array();
-
-    /**
-     * Add error
-     *
-     * @param string $err
-     * @return void
-     */
-    private function addError($err)
-    {
-        $this->_errors[] = $err;
-    }
-
-    /**
-     * Set validator errors
-     *
-     * @param array $err
-     * @return void
-     */
-    private function setErrors(array $err)
-    {
-        $this->_errors = $err;
-    }
-
-    /**
-     * Clear validator errors
-     *
-     * @return void
-     */
-    private function clearErrors()
-    {
-        $this->_errors = array();
-    }
-
-    /**
-     * Check if there are validator errors set
-     *
-     * @return int
-     */
-    public function hasErrors()
-    {
-        return count($this->_errors) != 0;
-    }
-
-    /**
-     * Get errors
-     *
-     * @param bool $clear if true after this call erros will be cleared
-     * @return array
-     */
-    public function getErrors($clear = true)
-    {
-        $out = $this->_errors;
-        if ($clear) {
-            $this->clearErrors();
-        }
-        return $out;
-    }
-
-    /**
-     * Validate URL
-     *
-     * @param string $str
-     * @return bool
-     */
-    public function validateUrl($str)
-    {
-        $regex = "@([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|" .
-            "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp)" .
-            "[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+)(:[0-9]*)?@i";
-        return preg_match($regex, $str);
-    }
-
-    /**
-     * Validates package stability
-     *
-     * @param string $str
-     * @return bool
-     */
-    public function validateStability($str)
-    {
-        return in_array(strval($str), self::$_stability);
-    }
-
-    /**
-     * Validate date format
-     *
-     * @param string $date
-     * @return bool
-     */
-    public function validateDate($date)
-    {
-        $subs = null;
-        $check1 = preg_match("/^([\d]{4})-([\d]{2})-([\d]{2})$/i", $date, $subs);
-        if (!$check1) {
-            return false;
-        }
-        return checkdate($subs[2], $subs[3], $subs[1]);
-    }
-
-    /**
-     * Validate email
-     *
-     * @param string $email
-     * @return bool
-     */
-    public function validateEmail($email)
-    {
-        return preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email);
-    }
-
-    /**
-     * Validate package name
-     *
-     * @param string $name
-     * @return bool
-     */
-    public function validatePackageName($name)
-    {
-        return preg_match("/^[a-zA-Z0-9_]+$/i", $name);
-    }
-
-    /**
-     * Validate author name
-     *
-     * @param string $name
-     * @return bool
-     */
-    public function validateAuthorName($name)
-    {
-        return preg_match("/^[a-zA-Z0-9_-]+$/i", $name);
-    }
-
-    /**
-     * Validate version number
-     *
-     * @param string $version
-     * @return bool
-     */
-    public function validateVersion($version)
-    {
-        return preg_match("/^[\d]+\.[\d]+\.[\d]+([[:alnum:]\.\-\_]+)?$/i", $version);
-    }
-
-    /**
-     * Check versions are equal
-     *
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionEqual($v1, $v2)
-    {
-        return version_compare($v1, $v2, "==");
-    }
-
-    /**
-     * Check version $v1 <= $v2
-     *
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionLowerEqual($v1, $v2)
-    {
-        return version_compare($v1, $v2, "le");
-    }
-
-    /**
-     * Check if version $v1 lower than $v2
-     *
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionLower($v1, $v2)
-    {
-        return version_compare($v1, $v2, "<");
-    }
-
-    /**
-     * Check version $v1 >= $v2
-     *
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionGreaterEqual($v1, $v2)
-    {
-        return version_compare($v1, $v2, "ge");
-    }
-
-    /**
-     * Generic regex validation
-     *
-     * @param string $str
-     * @param string $regex
-     * @return bool
-     */
-    public function validateRegex($str, $regex)
-    {
-        return preg_match($regex, $str);
-    }
-
-    /**
-     * Check if PHP extension loaded
-     *
-     * @param string $name Extension name
-     * @return bool
-     */
-    public function validatePhpExtension($name)
-    {
-        return extension_loaded($name);
-    }
-
-    /**
-     * Validate contents of package
-     *
-     * @param array $contents
-     * @param \Magento\Framework\Connect\Config $config
-     * @return bool
-     */
-    public function validateContents(array $contents, $config)
-    {
-        if (!count($contents)) {
-            $this->addError('Empty package contents section');
-            return false;
-        }
-
-        $targetPath = rtrim($config->magento_root, "\\/");
-        foreach ($contents as $file) {
-            $dest = $targetPath . '/' . $file;
-            if (file_exists($dest)) {
-                $this->addError("'{$file}' already exists");
-                return false;
-            }
-        }
-        return true;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/HTTP/Client.php b/downloader/lib/Magento/Framework/HTTP/Client.php
deleted file mode 100644
index 87e9f74081ef7979efbf0217fd11e4b8c83733d3..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/HTTP/Client.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Factory for HTTP client classes
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\HTTP;
-
-class Client
-{
-    /**
-     * Disallow to instantiate - pvt constructor
-     */
-    private function __construct()
-    {
-    }
-
-    /**
-     * Factory for HTTP client
-     *
-     * @static
-     * @throws \Exception
-     * @param string|bool $frontend  'curl'/'socket' or false for auto-detect
-     * @return \Magento\Framework\HTTP\IClient
-     */
-    public static function getInstance($frontend = false)
-    {
-        if (false === $frontend) {
-            $frontend = self::detectFrontend();
-        }
-        if (false === $frontend) {
-            throw new \Exception("Cannot find frontend automatically, set it manually");
-        }
-
-        $class = __CLASS__ . "_" . str_replace(' ', '/', ucwords(str_replace('_', ' ', $frontend)));
-        $obj = new $class();
-        return $obj;
-    }
-
-    /**
-     * Detects frontend type.
-     * Priority is given to CURL
-     *
-     * @return string/bool
-     */
-    protected static function detectFrontend()
-    {
-        if (function_exists("curl_init")) {
-            return "curl";
-        }
-        if (function_exists("fsockopen")) {
-            return "socket";
-        }
-        return false;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/HTTP/Client/Curl.php b/downloader/lib/Magento/Framework/HTTP/Client/Curl.php
deleted file mode 100644
index 70e7b4e81f57d4c7c1dbf2067e9db9be74ea3c8c..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/HTTP/Client/Curl.php
+++ /dev/null
@@ -1,576 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\HTTP\Client;
-
-/**
- * Class to work with HTTP protocol using curl library
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Curl implements \Magento\Framework\HTTP\IClient
-{
-    /**
-     * Session Cookie storage, magento_root/var directory used
-     * @var string
-     */
-    const COOKIE_FILE = 'var/cookie';
-
-    /**
-     * Hostname
-     * @var string
-     */
-    protected $_host = 'localhost';
-
-    /**
-     * Port
-     * @var int
-     */
-    protected $_port = 80;
-
-    /**
-     * Stream resource
-     * @var object
-     */
-    protected $_sock = null;
-
-    /**
-     * Request headers
-     * @var array
-     */
-    protected $_headers = array();
-
-    /**
-     * Fields for POST method - hash
-     * @var array
-     */
-    protected $_postFields = array();
-
-    /**
-     * Request cookies
-     * @var array
-     */
-    protected $_cookies = array();
-
-    /**
-     * Response headers
-     * @var array
-     */
-    protected $_responseHeaders = array();
-
-    /**
-     * Response body
-     * @var string
-     */
-    protected $_responseBody = '';
-
-    /**
-     * Response status
-     * @var int
-     */
-    protected $_responseStatus = 0;
-
-    /**
-     * Request timeout
-     * @var int
-     */
-    protected $_timeout = 300;
-
-    /**
-     * TODO
-     * @var int
-     */
-    protected $_redirectCount = 0;
-
-    /**
-     * Curl
-     * @var object
-     */
-    protected $_ch;
-
-    /**
-     * User ovverides options hash
-     * Are applied before curl_exec
-     *
-     * @var array
-     */
-    protected $_curlUserOptions = array();
-
-    /**
-     * User credentials
-     *
-     * @var array
-     */
-    protected $_auth = array();
-
-    /**
-     * Set request timeout, msec
-     *
-     * @param int $value
-     * @return void
-     */
-    public function setTimeout($value)
-    {
-        $this->_timeout = (int)$value;
-    }
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * Destructor
-     * Removes temporary environment
-     */
-    public function __destruct()
-    {
-        if (is_file(self::COOKIE_FILE)) {
-            @unlink(self::COOKIE_FILE);
-        }
-    }
-
-    /**
-     * Set headers from hash
-     *
-     * @param array $headers
-     * @return void
-     */
-    public function setHeaders($headers)
-    {
-        $this->_headers = $headers;
-    }
-
-    /**
-     * Add header
-     *
-     * @param string $name name, ex. "Location"
-     * @param string $value value ex. "http://google.com"
-     * @return void
-     */
-    public function addHeader($name, $value)
-    {
-        $this->_headers[$name] = $value;
-    }
-
-    /**
-     * Remove specified header
-     *
-     * @param string $name
-     * @return void
-     */
-    public function removeHeader($name)
-    {
-        unset($this->_headers[$name]);
-    }
-
-    /**
-     * Authorization: Basic header
-     * Login credentials support
-     *
-     * @param string $login username
-     * @param string $pass password
-     * @return void
-     */
-    public function setCredentials($login, $pass)
-    {
-        $this->_auth['login'] = $login;
-        $this->_auth['password'] = $pass;
-        //$val= base64_encode( "$login:$pass" );
-        //$this->addHeader( "Authorization", "Basic $val" );
-    }
-
-    /**
-     * Add cookie
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    public function addCookie($name, $value)
-    {
-        $this->_cookies[$name] = $value;
-    }
-
-    /**
-     * Remove cookie
-     *
-     * @param string $name
-     * @return void
-     */
-    public function removeCookie($name)
-    {
-        unset($this->_cookies[$name]);
-    }
-
-    /**
-     * Set cookies array
-     *
-     * @param array $cookies
-     * @return void
-     */
-    public function setCookies($cookies)
-    {
-        $this->_cookies = $cookies;
-    }
-
-    /**
-     * Clear cookies
-     *
-     * @return void
-     */
-    public function removeCookies()
-    {
-        $this->setCookies(array());
-    }
-
-    /**
-     * Make GET request
-     *
-     * @param string $uri uri relative to host, ex. "/index.php"
-     * @return void
-     */
-    public function get($uri)
-    {
-        $this->makeRequest("GET", $uri);
-    }
-
-    /**
-     * Make POST request
-     *
-     * @param string $uri
-     * @param array $params
-     * @return void
-     * @see \Magento\Framework\HTTP\Client#post($uri, $params)
-     */
-    public function post($uri, $params)
-    {
-        $this->makeRequest("POST", $uri, $params);
-    }
-
-    /**
-     * Get response headers
-     *
-     * @return array
-     */
-    public function getHeaders()
-    {
-        return $this->_responseHeaders;
-    }
-
-    /**
-     * Get response body
-     *
-     * @return string
-     */
-    public function getBody()
-    {
-        return $this->_responseBody;
-    }
-
-    /**
-     * Get cookies response hash
-     *
-     * @return array
-     */
-    public function getCookies()
-    {
-        if (empty($this->_responseHeaders['Set-Cookie'])) {
-            return array();
-        }
-        $out = array();
-        foreach ($this->_responseHeaders['Set-Cookie'] as $row) {
-            $values = explode("; ", $row);
-            $c = count($values);
-            if (!$c) {
-                continue;
-            }
-            list($key, $val) = explode("=", $values[0]);
-            if (is_null($val)) {
-                continue;
-            }
-            $out[trim($key)] = trim($val);
-        }
-        return $out;
-    }
-
-    /**
-     * Get cookies array with details
-     * (domain, expire time etc)
-     * @return array
-     */
-    public function getCookiesFull()
-    {
-        if (empty($this->_responseHeaders['Set-Cookie'])) {
-            return array();
-        }
-        $out = array();
-        foreach ($this->_responseHeaders['Set-Cookie'] as $row) {
-            $values = explode("; ", $row);
-            $c = count($values);
-            if (!$c) {
-                continue;
-            }
-            list($key, $val) = explode("=", $values[0]);
-            if (is_null($val)) {
-                continue;
-            }
-            $out[trim($key)] = array('value' => trim($val));
-            array_shift($values);
-            $c--;
-            if (!$c) {
-                continue;
-            }
-            for ($i = 0; $i < $c; $i++) {
-                list($subkey, $val) = explode("=", $values[$i]);
-                $out[trim($key)][trim($subkey)] = trim($val);
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * Get response status code
-     * @see \Magento\Framework\HTTP\Client#getStatus()
-     *
-     * @return int
-     */
-    public function getStatus()
-    {
-        return $this->_responseStatus;
-    }
-
-    /**
-     * Make request
-     * @param string $method
-     * @param string $uri
-     * @param array $params
-     * @return null
-     */
-    protected function makeRequest($method, $uri, $params = array())
-    {
-        static $isAuthorizationRequired = 0;
-        $this->_ch = curl_init();
-
-        // make request via secured layer
-        if ($isAuthorizationRequired && strpos($uri, 'https://') !== 0) {
-            $uri = str_replace('http://', '', $uri);
-            $uri = 'https://' . $uri;
-        }
-
-        $this->curlOption(CURLOPT_URL, $uri);
-        $this->curlOption(CURLOPT_SSL_VERIFYPEER, true);
-        $this->curlOption(CURLOPT_SSL_VERIFYHOST, 2);
-
-        // force method to POST if secured
-        if ($isAuthorizationRequired) {
-            $method = 'POST';
-        }
-
-        if ($method == 'POST') {
-            $this->curlOption(CURLOPT_POST, 1);
-            $postFields = is_array($params) ? $params : array();
-            if ($isAuthorizationRequired) {
-                $this->curlOption(CURLOPT_COOKIEJAR, self::COOKIE_FILE);
-                $this->curlOption(CURLOPT_COOKIEFILE, self::COOKIE_FILE);
-                $postFields = array_merge($postFields, $this->_auth);
-            }
-            if (!empty($postFields)) {
-                $this->curlOption(CURLOPT_POSTFIELDS, $postFields);
-            }
-        } elseif ($method == "GET") {
-            $this->curlOption(CURLOPT_HTTPGET, 1);
-        } else {
-            $this->curlOption(CURLOPT_CUSTOMREQUEST, $method);
-        }
-
-        if (count($this->_headers)) {
-            $heads = array();
-            foreach ($this->_headers as $k => $v) {
-                $heads[] = $k . ': ' . $v;
-            }
-            $this->curlOption(CURLOPT_HTTPHEADER, $heads);
-        }
-
-        if (count($this->_cookies)) {
-            $cookies = array();
-            foreach ($this->_cookies as $k => $v) {
-                $cookies[] = "{$k}={$v}";
-            }
-            $this->curlOption(CURLOPT_COOKIE, implode(";", $cookies));
-        }
-
-        if ($this->_timeout) {
-            $this->curlOption(CURLOPT_TIMEOUT, $this->_timeout);
-        }
-
-        if ($this->_port != 80) {
-            $this->curlOption(CURLOPT_PORT, $this->_port);
-        }
-
-        $this->curlOption(CURLOPT_RETURNTRANSFER, 1);
-        $this->curlOption(CURLOPT_FOLLOWLOCATION, 1);
-        $this->curlOption(CURLOPT_HEADERFUNCTION, array($this, 'parseHeaders'));
-
-        if (count($this->_curlUserOptions)) {
-            foreach ($this->_curlUserOptions as $k => $v) {
-                $this->curlOption($k, $v);
-            }
-        }
-
-        $this->_responseHeaders = array();
-        $this->_responseBody = curl_exec($this->_ch);
-        $err = curl_errno($this->_ch);
-        if ($err) {
-            $this->doError(curl_error($this->_ch));
-        }
-        if (!$this->getStatus()) {
-            return $this->doError("Invalid response headers returned from server.");
-        }
-        curl_close($this->_ch);
-        if (403 == $this->getStatus()) {
-            if (!$isAuthorizationRequired) {
-                $isAuthorizationRequired++;
-                $this->makeRequest($method, $uri, $params);
-                $isAuthorizationRequired = 0;
-            } else {
-                return $this->doError(sprintf('Access denied for %s@%s', $_SESSION['auth']['login'], $uri));
-            }
-        }
-    }
-
-    /**
-     * Throw error excpetion
-     *
-     * @return bool
-     * @throws \Exception
-     */
-    public function isAuthorizationRequired()
-    {
-        if (isset(
-            $_SESSION['auth']['username']
-        ) && isset(
-            $_SESSION['auth']['password']
-        ) && !empty($_SESSION['auth']['username'])
-        ) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Throw error excpetion
-     *
-     * @param string $string
-     * @return void
-     * @throws \Exception
-     */
-    public function doError($string)
-    {
-        throw new \Exception($string);
-    }
-
-    /**
-     * Parse headers - CURL callback function
-     *
-     * @param resource $ch curl handle, not needed
-     * @param string $data
-     * @return int
-     */
-    protected function parseHeaders($ch, $data)
-    {
-        if (preg_match('/^HTTP\/[\d\.x]+ (\d+)/', $data, $m)) {
-            if (isset($m[1])) {
-                $this->_responseStatus = (int)$m[1];
-            }
-        } else {
-            $name = $value = '';
-            $out = explode(": ", trim($data), 2);
-            if (count($out) == 2) {
-                $name = $out[0];
-                $value = $out[1];
-            }
-
-            if (strlen($name)) {
-                if ("Set-Cookie" == $name) {
-                    if (!isset($this->_responseHeaders[$name])) {
-                        $this->_responseHeaders[$name] = array();
-                    }
-                    $this->_responseHeaders[$name][] = $value;
-                } else {
-                    $this->_responseHeaders[$name] = $value;
-                }
-            }
-        }
-
-        return strlen($data);
-    }
-
-    /**
-     * Set curl option directly
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    protected function curlOption($name, $value)
-    {
-        curl_setopt($this->_ch, $name, $value);
-    }
-
-    /**
-     * Set curl options array directly
-     *
-     * @param array $array
-     * @return void
-     */
-    protected function curlOptions($array)
-    {
-        curl_setopt_array($this->_ch, $array);
-    }
-
-    /**
-     * Set CURL options overrides array
-     *
-     * @param array $arr
-     * @return void
-     */
-    public function setOptions($arr)
-    {
-        $this->_curlUserOptions = $arr;
-    }
-
-    /**
-     * Set curl option
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    public function setOption($name, $value)
-    {
-        $this->_curlUserOptions[$name] = $value;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/HTTP/Client/Socket.php b/downloader/lib/Magento/Framework/HTTP/Client/Socket.php
deleted file mode 100644
index 58111d1c6d42c96d86ff2e88f185757c63072582..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/HTTP/Client/Socket.php
+++ /dev/null
@@ -1,557 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\HTTP\Client;
-
-/**
- * Class to work with HTTP protocol using sockets
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Socket implements \Magento\Framework\HTTP\IClient
-{
-    /**
-     * Hostname
-     * @var string
-     */
-    private $_host = 'localhost';
-
-    /**
-     * Port
-     * @var int
-     */
-    private $_port = 80;
-
-    /**
-     * Stream resource
-     * @var object
-     */
-    private $_sock = null;
-
-    /**
-     * Request headers
-     * @var array
-     */
-    private $_headers = array();
-
-    /**
-     * Fields for POST method - hash
-     * @var array
-     */
-    private $_postFields = array();
-
-    /**
-     * Request cookies
-     * @var array
-     */
-    private $_cookies = array();
-
-    /**
-     * Response headers
-     * @var array
-     */
-    private $_responseHeaders = array();
-
-    /**
-     * Response body
-     * @var string
-     */
-    private $_responseBody = '';
-
-    /**
-     * Response status
-     * @var int
-     */
-    private $_responseStatus = 0;
-
-    /**
-     * Request timeout
-     * @var int
-     */
-    private $_timeout = 300;
-
-    /**
-     * TODO
-     * @var int
-     */
-    private $_redirectCount = 0;
-
-    /**
-     * Set request timeout, msec
-     *
-     * @param int $value
-     * @return void
-     */
-    public function setTimeout($value)
-    {
-        $this->_timeout = (int)$value;
-    }
-
-    /**
-     * Constructor
-     * @param string $host
-     * @param int $port
-     */
-    public function __construct($host = null, $port = 80)
-    {
-        if ($host) {
-            $this->connect($host, (int)$port);
-        }
-    }
-
-    /**
-     * Set connection params
-     *
-     * @param string $host
-     * @param int $port
-     * @return void
-     */
-    public function connect($host, $port = 80)
-    {
-        $this->_host = $host;
-        $this->_port = (int)$port;
-    }
-
-    /**
-     * Disconnect
-     *
-     * @return void
-     */
-    public function disconnect()
-    {
-        @fclose($this->_sock);
-    }
-
-    /**
-     * Set headers from hash
-     *
-     * @param array $headers
-     * @return void
-     */
-    public function setHeaders($headers)
-    {
-        $this->_headers = $headers;
-    }
-
-    /**
-     * Add header
-     *
-     * @param $name name, ex. "Location"
-     * @param $value value ex. "http://google.com"
-     * @return void
-     */
-    public function addHeader($name, $value)
-    {
-        $this->_headers[$name] = $value;
-    }
-
-    /**
-     * Remove specified header
-     *
-     * @param string $name
-     * @return void
-     */
-    public function removeHeader($name)
-    {
-        unset($this->_headers[$name]);
-    }
-
-    /**
-     * Authorization: Basic header
-     * Login credentials support
-     *
-     * @param string $login username
-     * @param string $pass password
-     * @return void
-     */
-    public function setCredentials($login, $pass)
-    {
-        $val = base64_encode("{$login}:{$pass}");
-        $this->addHeader("Authorization", "Basic {$val}");
-    }
-
-    /**
-     * Add cookie
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    public function addCookie($name, $value)
-    {
-        $this->_cookies[$name] = $value;
-    }
-
-    /**
-     * Remove cookie
-     *
-     * @param string $name
-     * @return void
-     */
-    public function removeCookie($name)
-    {
-        unset($this->_cookies[$name]);
-    }
-
-    /**
-     * Set cookies array
-     *
-     * @param array $cookies
-     * @return void
-     */
-    public function setCookies($cookies)
-    {
-        $this->_cookies = $cookies;
-    }
-
-    /**
-     * Clear cookies
-     *
-     * @return void
-     */
-    public function removeCookies()
-    {
-        $this->setCookies(array());
-    }
-
-    /**
-     * Make GET request
-     *
-     * @param string $uri full uri path
-     * @return void
-     */
-    public function get($uri)
-    {
-        $this->makeRequest("GET", $this->parseUrl($uri));
-    }
-
-    /**
-     * Set host, port from full url
-     * and return relative url
-     *
-     * @param string $uri ex. http://google.com/index.php?a=b
-     * @return string ex. /index.php?a=b
-     * @throws \InvalidArgumentException
-     */
-    protected function parseUrl($uri)
-    {
-        $parts = parse_url($uri);
-        if (!empty($parts['user']) && !empty($parts['pass'])) {
-            $this->setCredentials($parts['user'], $parts['pass']);
-        }
-        if (!empty($parts['port'])) {
-            $this->_port = (int)$parts['port'];
-        }
-
-        if (!empty($parts['host'])) {
-            $this->_host = $parts['host'];
-        } else {
-            throw new \InvalidArgumentException("Uri doesn't contain host part");
-        }
-
-
-        if (!empty($parts['path'])) {
-            $requestUri = $parts['path'];
-        } else {
-            throw new \InvalidArgumentException("Uri doesn't contain path part");
-        }
-        if (!empty($parts['query'])) {
-            $requestUri .= "?" . $parts['query'];
-        }
-        return $requestUri;
-    }
-
-    /**
-     * Make POST request
-     *
-     * @param string $uri
-     * @param array $params
-     * @return void
-     */
-    public function post($uri, $params)
-    {
-        $this->makeRequest("POST", $this->parseUrl($uri), $params);
-    }
-
-    /**
-     * Get response headers
-     *
-     * @return array
-     */
-    public function getHeaders()
-    {
-        return $this->_responseHeaders;
-    }
-
-    /**
-     * Get response body
-     *
-     * @return string
-     */
-    public function getBody()
-    {
-        return $this->_responseBody;
-    }
-
-    /**
-     * Get cookies response hash
-     *
-     * @return array
-     */
-    public function getCookies()
-    {
-        if (empty($this->_responseHeaders['Set-Cookie'])) {
-            return array();
-        }
-        $out = array();
-        foreach ($this->_responseHeaders['Set-Cookie'] as $row) {
-            $values = explode("; ", $row);
-            $c = count($values);
-            if (!$c) {
-                continue;
-            }
-            list($key, $val) = explode("=", $values[0]);
-            if (is_null($val)) {
-                continue;
-            }
-            $out[trim($key)] = trim($val);
-        }
-        return $out;
-    }
-
-    /**
-     * Get cookies array with details
-     * (domain, expire time etc)
-     * @return array
-     */
-    public function getCookiesFull()
-    {
-        if (empty($this->_responseHeaders['Set-Cookie'])) {
-            return array();
-        }
-        $out = array();
-        foreach ($this->_responseHeaders['Set-Cookie'] as $row) {
-            $values = explode("; ", $row);
-            $c = count($values);
-            if (!$c) {
-                continue;
-            }
-            list($key, $val) = explode("=", $values[0]);
-            if (is_null($val)) {
-                continue;
-            }
-            $out[trim($key)] = array('value' => trim($val));
-            array_shift($values);
-            $c--;
-            if (!$c) {
-                continue;
-            }
-            for ($i = 0; $i < $c; $i++) {
-                list($subkey, $val) = explode("=", $values[$i]);
-                $out[trim($key)][trim($subkey)] = trim($val);
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * Process response headers
-     *
-     * @return void
-     */
-    protected function processResponseHeaders()
-    {
-        $crlf = "\r\n";
-        $this->_responseHeaders = array();
-        while (!feof($this->_sock)) {
-            $line = fgets($this->_sock, 1024);
-            if ($line === $crlf) {
-                return;
-            }
-            $name = $value = '';
-            $out = explode(": ", trim($line), 2);
-            if (count($out) == 2) {
-                $name = $out[0];
-                $value = $out[1];
-            }
-            if (!empty($value)) {
-                if ($name == "Set-Cookie") {
-                    if (!isset($this->_responseHeaders[$name])) {
-                        $this->_responseHeaders[$name] = array();
-                    }
-                    $this->_responseHeaders[$name][] = $value;
-                } else {
-                    $this->_responseHeaders[$name] = $value;
-                }
-            }
-        }
-    }
-
-    /**
-     * Process response body
-     *
-     * @return void
-     */
-    protected function processResponseBody()
-    {
-        $this->_responseBody = '';
-
-        while (!feof($this->_sock)) {
-            $this->_responseBody .= @fread($this->_sock, 1024);
-        }
-    }
-
-    /**
-     * Process response
-     *
-     * @return void
-     */
-    protected function processResponse()
-    {
-        $response = '';
-        $responseLine = trim(fgets($this->_sock, 1024));
-
-        $line = explode(" ", $responseLine, 3);
-        if (count($line) != 3) {
-            return $this->doError("Invalid response line returned from server: " . $responseLine);
-        }
-        $this->_responseStatus = intval($line[1]);
-        $this->processResponseHeaders();
-
-        $this->processRedirect();
-
-        $this->processResponseBody();
-    }
-
-    /**
-     * Process redirect
-     *
-     * @return void
-     */
-    protected function processRedirect()
-    {
-        // TODO: implement redirects support
-    }
-
-    /**
-     * Get response status code
-     *
-     * @return int
-     * @see \Magento\Framework\HTTP\Client#getStatus()
-     */
-    public function getStatus()
-    {
-        return $this->_responseStatus;
-    }
-
-    /**
-     * Make request
-     * @param string $method
-     * @param string $uri
-     * @param array $params
-     * @return null
-     */
-    protected function makeRequest($method, $uri, $params = array())
-    {
-        $errno = $errstr = '';
-        $this->_sock = @fsockopen($this->_host, $this->_port, $errno, $errstr, $this->_timeout);
-        if (!$this->_sock) {
-            return $this->doError(sprintf("[errno: %d] %s", $errno, $errstr));
-        }
-
-        $crlf = "\r\n";
-        $isPost = $method == "POST";
-
-        $appendHeaders = array();
-        $paramsStr = false;
-        if ($isPost && count($params)) {
-            $paramsStr = http_build_query($params);
-            $appendHeaders['Content-type'] = 'application/x-www-form-urlencoded';
-            $appendHeaders['Content-length'] = strlen($paramsStr);
-        }
-
-        $out = "{$method} {$uri} HTTP/1.1{$crlf}";
-        $out .= $this->headersToString($appendHeaders);
-        $out .= $crlf;
-        if ($paramsStr) {
-            $out .= $paramsStr . $crlf;
-        }
-
-        fwrite($this->_sock, $out);
-        $this->processResponse();
-    }
-
-    /**
-     * Throw error excpetion
-     *
-     * @param string $string
-     * @return void
-     * @throws \Exception
-     */
-    public function doError($string)
-    {
-        throw new \Exception($string);
-    }
-
-    /**
-     * Convert headers hash to string
-     *
-     * @param array $append
-     * @return string
-     */
-    protected function headersToString($append = array())
-    {
-        $headers = array();
-        $headers["Host"] = $this->_host;
-        $headers['Connection'] = "close";
-        $headers = array_merge($headers, $this->_headers, $append);
-        $str = array();
-        foreach ($headers as $k => $v) {
-            $str[] = "{$k}: {$v}\r\n";
-        }
-        return implode($str);
-    }
-
-    /**
-     * TODO
-     *
-     * @param array $arr
-     * @return void
-     */
-    public function setOptions($arr)
-    {
-        // Stub
-    }
-
-    /**
-     * TODO
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    public function setOption($name, $value)
-    {
-        // Stub
-    }
-}
diff --git a/downloader/lib/Magento/Framework/HTTP/IClient.php b/downloader/lib/Magento/Framework/HTTP/IClient.php
deleted file mode 100644
index 331f5b6396303fa14dc33ffc2215b08f5124b989..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/HTTP/IClient.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\HTTP;
-
-/**
- * Interface for different HTTP clients
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-interface IClient
-{
-    /**
-     * Set request timeout
-     *
-     * @param int $value
-     * @return void
-     */
-    public function setTimeout($value);
-
-    /**
-     * Set request headers from hash
-     *
-     * @param array $headers
-     * @return void
-     */
-    public function setHeaders($headers);
-
-    /**
-     * Add header to request
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    public function addHeader($name, $value);
-
-    /**
-     * Remove header from request
-     *
-     * @param string $name
-     * @return void
-     */
-    public function removeHeader($name);
-
-    /**
-     * Set login credentials
-     * for basic auth.
-     *
-     * @param string $login
-     * @param string $pass
-     * @return void
-     */
-    public function setCredentials($login, $pass);
-
-    /**
-     * Add cookie to request
-     *
-     * @param string $name
-     * @param string $value
-     * @return void
-     */
-    public function addCookie($name, $value);
-
-    /**
-     * Remove cookie from request
-     *
-     * @param string $name
-     * @return void
-     */
-    public function removeCookie($name);
-
-    /**
-     * Set request cookies from hash
-     *
-     * @param array $cookies
-     * @return void
-     */
-    public function setCookies($cookies);
-
-    /**
-     * Remove cookies from request
-     *
-     * @return void
-     */
-    public function removeCookies();
-
-    /**
-     * Make GET request
-     *
-     * @param string full uri
-     * @return void
-     */
-    public function get($uri);
-
-    /**
-     * Make POST request
-     *
-     * @param string $uri full uri
-     * @param array $params POST fields array
-     * @return void
-     */
-    public function post($uri, $params);
-
-    /**
-     * Get response headers
-     *
-     * @return array
-     */
-    public function getHeaders();
-
-    /**
-     * Get response body
-     *
-     * @return string
-     */
-    public function getBody();
-
-    /**
-     * Get response status code
-     *
-     * @return int
-     */
-    public function getStatus();
-
-    /**
-     * Get response cookies (k=>v)
-     *
-     * @return array
-     */
-    public function getCookies();
-
-    /**
-     * Set additional option
-     *
-     * @param string $key
-     * @param string $value
-     * @return void
-     */
-    public function setOption($key, $value);
-
-    /**
-     * Set additional options
-     *
-     * @param array $arr
-     * @return void
-     */
-    public function setOptions($arr);
-}
diff --git a/downloader/lib/Magento/Framework/System/Args.php b/downloader/lib/Magento/Framework/System/Args.php
deleted file mode 100644
index e3c59cf4106e02973f576b94a95aacd84a1b44e1..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/System/Args.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\System;
-
-/**
- * Command-line options parsing class.
- */
-class Args
-{
-    /**
-     * @var array
-     */
-    public $flags;
-
-    /**
-     * @var array
-     */
-    public $filtered;
-
-    /**
-     * Get flags/named options
-     * @return array
-     */
-    public function getFlags()
-    {
-        return $this->flags;
-    }
-
-    /**
-     * Get filtered args
-     * @return array
-     */
-    public function getFiltered()
-    {
-        return $this->filtered;
-    }
-
-    /**
-     * Constructor
-     * @param array $argv, if false $GLOBALS['argv'] is taken
-     * @return void
-     */
-    public function __construct($source = false)
-    {
-        $this->flags = array();
-        $this->filtered = array();
-
-        if (false === $source) {
-            $argv = $GLOBALS['argv'];
-            array_shift($argv);
-        }
-
-        for ($i = 0,$iCount = count($argv); $i < $iCount; $i++) {
-            $str = $argv[$i];
-
-            // --foo
-            if (strlen($str) > 2 && substr($str, 0, 2) == '--') {
-                $str = substr($str, 2);
-                $parts = explode('=', $str);
-                $this->flags[$parts[0]] = true;
-
-                // Does not have an =, so choose the next arg as its value
-                if (count($parts) == 1 && isset($argv[$i + 1]) && preg_match('/^--?.+/', $argv[$i + 1]) == 0) {
-                    $this->flags[$parts[0]] = $argv[$i + 1];
-                    $argv[$i + 1] = null;
-                } elseif (count($parts) == 2) {
-                    // Has a =, so pick the second piece
-                    $this->flags[$parts[0]] = $parts[1];
-                }
-            } elseif (strlen($str) == 2 && $str[0] == '-') {
-                // -a
-                $this->flags[$str[1]] = true;
-                if (isset($argv[$i + 1]) && preg_match('/^--?.+/', $argv[$i + 1]) == 0) {
-                    $this->flags[$str[1]] = $argv[$i + 1];
-                    $argv[$i + 1] = null;
-                }
-            } elseif (!is_null($str)) {
-                $this->filtered[] = $str;
-            }
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/System/Dirs.php b/downloader/lib/Magento/Framework/System/Dirs.php
deleted file mode 100644
index eaf4cff8f952d931e7a0ac95dc57e120b5bc283e..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/System/Dirs.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\System;
-
-class Dirs
-{
-    /**
-     * @param string[]|string $dirname
-     * @return bool
-     */
-    public static function rm($dirname)
-    {
-        if (is_array($dirname)) {
-            $dirname = $dirname[1];
-        }
-        // Sanity check
-        if (!@file_exists($dirname)) {
-            return false;
-        }
-
-        // Simple delete for a file
-        if (@is_file($dirname) || @is_link($dirname)) {
-            return unlink($dirname);
-        }
-
-        // Create and iterate stack
-        $stack = array($dirname);
-        while ($entry = array_pop($stack)) {
-            // Watch for symlinks
-            if (@is_link($entry)) {
-                @unlink($entry);
-                continue;
-            }
-
-            // Attempt to remove the directory
-            if (@rmdir($entry)) {
-                continue;
-            }
-
-            // Otherwise add it to the stack
-            $stack[] = $entry;
-            $dh = opendir($entry);
-            while (false !== ($child = readdir($dh))) {
-                // Ignore pointers
-                if ($child === '.' || $child === '..') {
-                    continue;
-                }
-                // Unlink files and add directories to stack
-                $child = $entry . '/' . $child;
-                if (is_dir($child) && !is_link($child)) {
-                    $stack[] = $child;
-                } else {
-                    @unlink($child);
-                }
-            }
-            @closedir($dh);
-        }
-        return true;
-    }
-
-    /**
-     * Attempts to create the directory
-     *
-     * @param string $path
-     * @param bool $recursive
-     * @param int $mode
-     * @return true
-     * @throws \Exception
-     */
-    public static function mkdirStrict($path, $recursive = true, $mode = 0777)
-    {
-        $exists = file_exists($path);
-        if ($exists && is_dir($path)) {
-            return true;
-        }
-        if ($exists && !is_dir($path)) {
-            throw new \Exception("'{$path}' already exists, should be a dir, not a file!");
-        }
-        $out = @mkdir($path, $mode, $recursive);
-        if (false === $out) {
-            throw new \Exception("Can't create dir: '{$path}'");
-        }
-        return true;
-    }
-
-    /**
-     * @param string $source
-     * @param string $dest
-     * @return void
-     * @throws \Exception
-     */
-    public static function copyFileStrict($source, $dest)
-    {
-        $exists = file_exists($source);
-        if (!$exists) {
-            throw new \Exception('No file exists: ' . $exists);
-        }
-    }
-}
diff --git a/downloader/lib/Magento/Framework/System/Ftp.php b/downloader/lib/Magento/Framework/System/Ftp.php
deleted file mode 100644
index 692e316c7606ca490ed62872aaf14821c650528a..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/System/Ftp.php
+++ /dev/null
@@ -1,506 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\System;
-
-/**
- * Class to work with remote FTP server
- */
-class Ftp
-{
-    /**
-     * Connection object
-     *
-     * @var resource
-     */
-    protected $_conn = false;
-
-    /**
-     * Check connected, throw exception if not
-     *
-     * @throws \Exception
-     * @return void
-     */
-    protected function checkConnected()
-    {
-        if (!$this->_conn) {
-            throw new \Exception(__CLASS__ . " - no connection established with server");
-        }
-    }
-
-    /**
-     * ftp_mkdir wrapper
-     *
-     * @param string $name
-     * @return string the newly created directory name on success or <b>FALSE</b> on error.
-     */
-    public function mdkir($name)
-    {
-        $this->checkConnected();
-        return @ftp_mkdir($this->_conn, $name);
-    }
-
-    /**
-     * Make dir recursive
-     *
-     * @param string $path
-     * @param int $mode
-     * @return bool
-     */
-    public function mkdirRecursive($path, $mode = 0777)
-    {
-        $this->checkConnected();
-        $dir = explode("/", $path);
-        $path = "";
-        $ret = true;
-        for ($i = 0; $i < count($dir); $i++) {
-            $path .= "/" . $dir[$i];
-            if (!@ftp_chdir($this->_conn, $path)) {
-                @ftp_chdir($this->_conn, "/");
-                if (!@ftp_mkdir($this->_conn, $path)) {
-                    $ret = false;
-                    break;
-                } else {
-                    @ftp_chmod($this->_conn, $mode, $path);
-                }
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Try to login to server
-     *
-     * @param string $login
-     * @param string $password
-     * @return bool
-     * @throws \Exception On invalid login credentials
-     */
-    public function login($login = "anonymous", $password = "")
-    {
-        $this->checkConnected();
-        $res = @ftp_login($this->_conn, $login, $password);
-        if (!$res) {
-            throw new \Exception("Invalid login credentials");
-        }
-        return $res;
-    }
-
-    /**
-     * Validate connection string
-     *
-     * @param string $string
-     * @throws \Exception
-     * @return string
-     */
-    public function validateConnectionString($string)
-    {
-        $data = parse_url($string);
-        if (false === $data) {
-            throw new \Exception("Connection string invalid: '{$string}'");
-        }
-        if ($data['scheme'] != 'ftp') {
-            throw new \Exception("Support for scheme unsupported: '{$data['scheme']}'");
-        }
-        return $data;
-    }
-
-    /**
-     * Connect to server using connect string
-     * Connection string: ftp://user:pass@server:port/path
-     * user,pass,port,path are optional parts
-     *
-     * @param string $string
-     * @param int $timeout
-     * @return void
-     * @throws \Exception
-     */
-    public function connect($string, $timeout = 900)
-    {
-        $params = $this->validateConnectionString($string);
-        $port = isset($params['port']) ? intval($params['port']) : 21;
-
-        $this->_conn = ftp_connect($params['host'], $port, $timeout);
-
-        if (!$this->_conn) {
-            throw new \Exception("Cannot connect to host: {$params['host']}");
-        }
-        if (isset($params['user']) && isset($params['pass'])) {
-            $this->login($params['user'], $params['pass']);
-        } else {
-            $this->login();
-        }
-        if (isset($params['path'])) {
-            if (!$this->chdir($params['path'])) {
-                throw new \Exception("Cannot chdir after login to: {$params['path']}");
-            }
-        }
-    }
-
-    /**
-     * ftp_fput wrapper
-     *
-     * @param string $remoteFile
-     * @param resource $handle
-     * @param int $mode  FTP_BINARY | FTP_ASCII
-     * @param int $startPos
-     * @return bool
-     */
-    public function fput($remoteFile, $handle, $mode = FTP_BINARY, $startPos = 0)
-    {
-        $this->checkConnected();
-        return @ftp_fput($this->_conn, $remoteFile, $handle, $mode, $startPos);
-    }
-
-    /**
-     * ftp_put wrapper
-     *
-     * @param string $remoteFile
-     * @param string $localFile
-     * @param int $mode FTP_BINARY | FTP_ASCII
-     * @param int $startPos
-     * @return bool
-     */
-    public function put($remoteFile, $localFile, $mode = FTP_BINARY, $startPos = 0)
-    {
-        $this->checkConnected();
-        return ftp_put($this->_conn, $remoteFile, $localFile, $mode, $startPos);
-    }
-
-    /**
-     * Get current working directory
-     *
-     * @return mixed
-     */
-    public function getcwd()
-    {
-        $d = $this->raw("pwd");
-        $data = explode(" ", $d[0], 3);
-        if (empty($data[1])) {
-            return false;
-        }
-        if (intval($data[0]) != 257) {
-            return false;
-        }
-        $out = trim($data[1], '"');
-        if ($out !== "/") {
-            $out = rtrim($out, "/");
-        }
-        return $out;
-    }
-
-    /**
-     * ftp_raw wrapper
-     *
-     * @param string $cmd
-     * @return mixed
-     */
-    public function raw($cmd)
-    {
-        $this->checkConnected();
-        return @ftp_raw($this->_conn, $cmd);
-    }
-
-    /**
-     * Upload local file to remote
-     *
-     * Can be used for relative and absoulte remote paths
-     * Relative: use chdir before calling this
-     *
-     * @param srting $remote
-     * @param string $local
-     * @param int $dirMode
-     * @param int $ftpMode
-     * @throws \Exception
-     * @return unknown_type
-     */
-    public function upload($remote, $local, $dirMode = 0777, $ftpMode = FTP_BINARY)
-    {
-        $this->checkConnected();
-
-        if (!file_exists($local)) {
-            throw new \Exception("Local file doesn't exist: {$local}");
-        }
-        if (!is_readable($local)) {
-            throw new \Exception("Local file is not readable: {$local}");
-        }
-        if (is_dir($local)) {
-            throw new \Exception("Directory given instead of file: {$local}");
-        }
-
-        $globalPathMode = substr($remote, 0, 1) == "/";
-        $dirname = dirname($remote);
-        $cwd = $this->getcwd();
-        if (false === $cwd) {
-            throw new \Exception("Server returns something awful on PWD command");
-        }
-
-        if (!$globalPathMode) {
-            $dirname = $cwd . "/" . $dirname;
-            $remote = $cwd . "/" . $remote;
-        }
-        $res = $this->mkdirRecursive($dirname, $dirMode);
-        $this->chdir($cwd);
-
-        if (!$res) {
-            return false;
-        }
-        return $this->put($remote, $local, $ftpMode);
-    }
-
-    /**
-     * Download remote file to local machine
-     *
-     * @param string $remote
-     * @param string $local
-     * @param int $ftpMode  FTP_BINARY|FTP_ASCII
-     * @return bool
-     */
-    public function download($remote, $local, $ftpMode = FTP_BINARY)
-    {
-        $this->checkConnected();
-        return $this->get($local, $remote, $ftpMode);
-    }
-
-    /**
-     * ftp_pasv wrapper
-     *
-     * @param bool $pasv
-     * @return bool
-     */
-    public function pasv($pasv)
-    {
-        $this->checkConnected();
-        return @ftp_pasv($this->_conn, (bool)$pasv);
-    }
-
-    /**
-     * Close FTP connection
-     *
-     * @return void
-     */
-    public function close()
-    {
-        if ($this->_conn) {
-            @ftp_close($this->_conn);
-        }
-    }
-
-    /**
-     * ftp_chmod wrapper
-     *
-     * @param int $mode
-     * @param string $remoteFile
-     * @return int The new file permissions on success or <b>FALSE</b> on error.
-     */
-    public function chmod($mode, $remoteFile)
-    {
-        $this->checkConnected();
-        return @ftp_chmod($this->_conn, $mode, $remoteFile);
-    }
-
-    /**
-     * ftp_chdir wrapper
-     *
-     * @param string $dir
-     * @return bool
-     */
-    public function chdir($dir)
-    {
-        $this->checkConnected();
-        return @ftp_chdir($this->_conn, $dir);
-    }
-
-    /**
-     * ftp_cdup wrapper
-     *
-     * @return bool
-     */
-    public function cdup()
-    {
-        $this->checkConnected();
-        return @ftp_cdup($this->_conn);
-    }
-
-    /**
-     * ftp_get wrapper
-     *
-     * @param string $localFile
-     * @param string $remoteFile
-     * @param int $fileMode         FTP_BINARY | FTP_ASCII
-     * @param int $resumeOffset
-     * @return bool
-     */
-    public function get($localFile, $remoteFile, $fileMode = FTP_BINARY, $resumeOffset = 0)
-    {
-        $remoteFile = $this->correctFilePath($remoteFile);
-        $this->checkConnected();
-        return @ftp_get($this->_conn, $localFile, $remoteFile, $fileMode, $resumeOffset);
-    }
-
-    /**
-     * ftp_nlist wrapper
-     *
-     * @param string $dir
-     * @return bool
-     */
-    public function nlist($dir = "/")
-    {
-        $this->checkConnected();
-        $dir = $this->correctFilePath($dir);
-        return @ftp_nlist($this->_conn, $dir);
-    }
-
-    /**
-     * ftp_rawlist wrapper
-     *
-     * @param string $dir
-     * @param bool $recursive
-     * @return mixed
-     */
-    public function rawlist($dir = "/", $recursive = false)
-    {
-        $this->checkConnected();
-        $dir = $this->correctFilePath($dir);
-        return @ftp_rawlist($this->_conn, $dir, $recursive);
-    }
-
-    /**
-     * Convert byte count to float KB/MB format
-     *
-     * @param int $bytes
-     * @return string
-     */
-    public static function byteconvert($bytes)
-    {
-        $symbol = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
-        $exp = floor(log($bytes) / log(1024));
-        return sprintf('%.2f ' . $symbol[$exp], $bytes / pow(1024, floor($exp)));
-    }
-
-    /**
-     * Chmod string "-rwxrwxrwx" to "777" converter
-     *
-     * @param string $chmod
-     * @return string
-     */
-    public static function chmodnum($chmod)
-    {
-        $trans = array('-' => '0', 'r' => '4', 'w' => '2', 'x' => '1');
-        $chmod = substr(strtr($chmod, $trans), 1);
-        $array = str_split($chmod, 3);
-        return array_sum(str_split($array[0])) . array_sum(str_split($array[1])) . array_sum(str_split($array[2]));
-    }
-
-    /**
-     * Check whether file exists
-     *
-     * @param string $path
-     * @param bool $excludeIfIsDir
-     * @return bool
-     */
-    public function fileExists($path, $excludeIfIsDir = true)
-    {
-        $path = $this->correctFilePath($path);
-        $globalPathMode = substr($path, 0, 1) == "/";
-
-        $file = basename($path);
-        $dir = $globalPathMode ? dirname($path) : $this->getcwd() . "/" . $path;
-        $data = $this->ls($dir);
-        foreach ($data as $row) {
-            if ($file == $row['name']) {
-                if ($excludeIfIsDir && $row['dir']) {
-                    continue;
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Get directory contents in PHP array
-     *
-     * @param string $dir
-     * @param bool $recursive
-     * @return array
-     */
-    public function ls($dir = "/", $recursive = false)
-    {
-        $dir = $this->correctFilePath($dir);
-        $rawfiles = (array)$this->rawlist($dir, $recursive);
-        $structure = array();
-        $arraypointer =& $structure;
-        foreach ($rawfiles as $rawfile) {
-            if ($rawfile[0] == '/') {
-                $paths = array_slice(explode('/', str_replace(':', '', $rawfile)), 1);
-                $arraypointer =& $structure;
-                foreach ($paths as $path) {
-                    foreach ($arraypointer as $i => $file) {
-                        if ($file['name'] == $path) {
-                            $arraypointer =& $arraypointer[$i]['children'];
-                            break;
-                        }
-                    }
-                }
-            } elseif (!empty($rawfile)) {
-                $info = preg_split("/[\s]+/", $rawfile, 9);
-                $arraypointer[] = array(
-                    'name' => $info[8],
-                    'dir' => $info[0][0] == 'd',
-                    'size' => (int)$info[4],
-                    'chmod' => self::chmodnum($info[0]),
-                    'rawdata' => $info,
-                    'raw' => $rawfile
-                );
-            }
-        }
-        return $structure;
-    }
-
-    /**
-     * Correct file path
-     *
-     * @param string $str
-     * @return string
-     */
-    public function correctFilePath($str)
-    {
-        $str = str_replace("\\", "/", $str);
-        $str = preg_replace("/^.\//", "", $str);
-        return $str;
-    }
-
-    /**
-     * Delete file
-     *
-     * @param string $file
-     * @return bool
-     */
-    public function delete($file)
-    {
-        $this->checkConnected();
-        $file = $this->correctFilePath($file);
-        return @ftp_delete($this->_conn, $file);
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Xml/Generator.php b/downloader/lib/Magento/Framework/Xml/Generator.php
deleted file mode 100644
index f44022f4d8c94255795a65e7039f361d8f662e2f..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Xml/Generator.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Xml;
-
-class Generator
-{
-    /**
-     * This value is used to replace numeric keys while formatting data for xml output.
-     */
-    const DEFAULT_ENTITY_ITEM_NAME = 'item';
-
-    /**
-     * @var \DOMDocument|null
-     */
-    protected $_dom = null;
-
-    /**
-     * @var \DOMDocument
-     */
-    protected $_currentDom;
-
-    /**
-     * @var string
-     */
-    protected $_defaultIndexedArrayItemName;
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $this->_dom = new \DOMDocument('1.0');
-        $this->_dom->formatOutput = true;
-        $this->_currentDom = $this->_dom;
-        return $this;
-    }
-
-    /**
-     * @return \DOMDocument|null
-     */
-    public function getDom()
-    {
-        return $this->_dom;
-    }
-
-    /**
-     * @return \DOMDocument
-     */
-    protected function _getCurrentDom()
-    {
-        return $this->_currentDom;
-    }
-
-    /**
-     * @param \DOMDocument $node
-     * @return $this
-     */
-    protected function _setCurrentDom($node)
-    {
-        $this->_currentDom = $node;
-        return $this;
-    }
-
-    /**
-     * @param array $content
-     * @return $this
-     */
-    public function arrayToXml($content)
-    {
-        $parentNode = $this->_getCurrentDom();
-        if (!$content || !count($content)) {
-            return $this;
-        }
-        foreach ($content as $_key => $_item) {
-            try {
-                $node = $this->getDom()->createElement($_key);
-            } catch (\DOMException $e) {
-                //  echo $e->getMessage();
-                var_dump($_item);
-                exit;
-            }
-            $parentNode->appendChild($node);
-            if (is_array($_item) && isset($_item['_attribute'])) {
-                if (is_array($_item['_value'])) {
-                    if (isset($_item['_value'][0])) {
-                        foreach ($_item['_value'] as $_k => $_v) {
-                            $this->_setCurrentDom($node)->arrayToXml($_v);
-                        }
-                    } else {
-                        $this->_setCurrentDom($node)->arrayToXml($_item['_value']);
-                    }
-                } else {
-                    $child = $this->getDom()->createTextNode($_item['_value']);
-                    $node->appendChild($child);
-                }
-                foreach ($_item['_attribute'] as $_attributeKey => $_attributeValue) {
-                    $node->setAttribute($_attributeKey, $_attributeValue);
-                }
-            } elseif (is_string($_item)) {
-                $text = $this->getDom()->createTextNode($_item);
-                $node->appendChild($text);
-            } elseif (is_array($_item) && !isset($_item[0])) {
-                $this->_setCurrentDom($node)->arrayToXml($_item);
-            } elseif (is_array($_item) && isset($_item[0])) {
-                foreach ($_item as $k => $v) {
-                    $this->_setCurrentDom($node)->arrayToXml(array($this->_getIndexedArrayItemName() => $v));
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * @return string
-     */
-    public function __toString()
-    {
-        return $this->getDom()->saveXML();
-    }
-
-    /**
-     * @param string $file
-     * @return $this
-     */
-    public function save($file)
-    {
-        $this->getDom()->save($file);
-        return $this;
-    }
-
-    /**
-     * Set xml node name to use instead of numeric index during numeric arrays conversion.
-     *
-     * @param string $name
-     * @return $this
-     */
-    public function setIndexedArrayItemName($name)
-    {
-        $this->_defaultIndexedArrayItemName = $name;
-        return $this;
-    }
-
-    /**
-     * Get xml node name to use instead of numeric index during numeric arrays conversion.
-     *
-     * @return string
-     */
-    protected function _getIndexedArrayItemName()
-    {
-        return isset(
-            $this->_defaultIndexedArrayItemName
-        ) ? $this->_defaultIndexedArrayItemName : self::DEFAULT_ENTITY_ITEM_NAME;
-    }
-}
diff --git a/downloader/lib/Magento/Framework/Xml/Parser.php b/downloader/lib/Magento/Framework/Xml/Parser.php
deleted file mode 100644
index edfd16f28d6d45269f844db6a4522d7d72437bcb..0000000000000000000000000000000000000000
--- a/downloader/lib/Magento/Framework/Xml/Parser.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Xml;
-
-class Parser
-{
-    /**
-     * @var \DOMDocument|null
-     */
-    protected $_dom = null;
-
-    /**
-     * @var \DOMDocument
-     */
-    protected $_currentDom;
-
-    /**
-     * @var array
-     */
-    protected $_content = array();
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $this->_dom = new \DOMDocument();
-        $this->_currentDom = $this->_dom;
-        return $this;
-    }
-
-    /**
-     * @return \DOMDocument|null
-     */
-    public function getDom()
-    {
-        return $this->_dom;
-    }
-
-    /**
-     * @return \DOMDocument
-     */
-    protected function _getCurrentDom()
-    {
-        return $this->_currentDom;
-    }
-
-    /**
-     * @param \DOMDocument $node
-     * @return $this
-     */
-    protected function _setCurrentDom($node)
-    {
-        $this->_currentDom = $node;
-        return $this;
-    }
-
-    /**
-     * @return array
-     */
-    public function xmlToArray()
-    {
-        $this->_content = $this->_xmlToArray();
-        return $this->_content;
-    }
-
-    /**
-     * @param bool $currentNode
-     * @return array
-     */
-    protected function _xmlToArray($currentNode = false)
-    {
-        if (!$currentNode) {
-            $currentNode = $this->getDom();
-        }
-        $content = array();
-        foreach ($currentNode->childNodes as $node) {
-            switch ($node->nodeType) {
-                case XML_ELEMENT_NODE:
-
-                    $value = null;
-                    if ($node->hasChildNodes()) {
-                        $value = $this->_xmlToArray($node);
-                    }
-                    $attributes = array();
-                    if ($node->hasAttributes()) {
-                        foreach ($node->attributes as $attribute) {
-                            $attributes += array($attribute->name => $attribute->value);
-                        }
-                        $value = array('_value' => $value, '_attribute' => $attributes);
-                    }
-                    if (isset($content[$node->nodeName])) {
-                        if (!isset($content[$node->nodeName][0]) || !is_array($content[$node->nodeName][0])) {
-                            $oldValue = $content[$node->nodeName];
-                            $content[$node->nodeName] = array();
-                            $content[$node->nodeName][] = $oldValue;
-                        }
-                        $content[$node->nodeName][] = $value;
-                    } else {
-                        $content[$node->nodeName] = $value;
-                    }
-                    break;
-                case XML_TEXT_NODE:
-                    if (trim($node->nodeValue)) {
-                        $content = $node->nodeValue;
-                    }
-                    break;
-            }
-        }
-        return $content;
-    }
-
-    /**
-     * @param string $file
-     * @return $this
-     */
-    public function load($file)
-    {
-        $this->getDom()->load($file);
-        return $this;
-    }
-
-    /**
-     * @param string $string
-     * @return $this
-     */
-    public function loadXML($string)
-    {
-        $this->getDom()->loadXML($string);
-        return $this;
-    }
-}
diff --git a/downloader/mage b/downloader/mage
deleted file mode 100644
index c9507f1e95b5d193bf4634ab40a89db69f551e66..0000000000000000000000000000000000000000
--- a/downloader/mage
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-
-# REPLACE with your PHP5 binary path (example: /usr/local/php5/bin/php )
-#MAGE_PHP_BIN="php"
-
-MAGE_PHP_SCRIPT="mage.php"
-DOWNLOADER_PATH='downloader'
-
-# initial setup
-if test "x$1" = "xmage-setup"; then
-    echo 'Running initial setup...'
-
-    if test "x$2" != "x"; then
-        MAGE_ROOT_DIR="$2"
-    else
-        MAGE_ROOT_DIR="`pwd`/../"
-    fi
-
-    $0 config-set magento_root "$MAGE_ROOT_DIR"
-    $0 config-set preferred_state beta
-    $0 channel-add http://connect20.magentocommerce.com/community
-    exit
-fi
-
-# check that mage pear was initialized
-
-if test "x$1" != "xconfig-set" &&
-  test "x$1" != "xconfig-get" &&
-  test "x$1" != "xconfig-show" &&
-  test "x$1" != "xchannel-add" &&
-  test "x`$0 config-get magento_root`" = "x"; then
-    echo 'Please initialize Magento Connect installer by running:'
-    echo "$0 mage-setup"
-    exit;
-fi
-
-# find which PHP binary to use
-if test "x$MAGE_PHP_BIN" != "x"; then
-  PHP="$MAGE_PHP_BIN"
-else
-  PHP=php
-fi
-
-
-# get default pear dir of not set
-if test "x$MAGE_ROOT_DIR" = "x"; then
-    MAGE_ROOT_DIR="`pwd`/$DOWNLOADER_PATH"
-fi
-
-exec $PHP -C -q $INCARG -d output_buffering=1 -d variables_order=EGPCS \
-    -d open_basedir="" -d register_argc_argv="On" \
-    -d auto_prepend_file="" -d auto_append_file="" \
-    $MAGE_ROOT_DIR/$MAGE_PHP_SCRIPT "$@"
-
diff --git a/downloader/mage.php b/downloader/mage.php
deleted file mode 100644
index e4b230449419b05c467f58a56a0c5a86d839445d..0000000000000000000000000000000000000000
--- a/downloader/mage.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-define('PS', PATH_SEPARATOR);
-define('BP', dirname(__DIR__));
-define('MAGENTO_ROOT', dirname(__DIR__));
-
-class __cli_Magento_Connect
-{
-    private static $_instance;
-    protected $argv;
-    public static function instance()
-    {
-        if (!self::$_instance) {
-            self::$_instance = new self();
-        }
-        return self::$_instance;
-    }
-
-    public function init($argv)
-    {
-                $this->argv = $argv;
-        $this->setIncludes();
-        require_once("Mage/Autoload/Simple.php");
-        \Magento\Framework\Autoload\Simple::register();
-        chdir(BP . '/downloader/');
-        return $this;
-    }
-
-    public function setIncludes()
-    {
-        if (defined('DEVELOPMENT_MODE')) {
-            $libPath = PS . dirname(BP) . '/lib/internal';
-        } else {
-            $libPath = PS . BP . '/downloader/lib';
-        }
-        $includePath = BP . '/app'
-        . $libPath
-        . PS . get_include_path();
-        set_include_path($includePath);
-    }
-
-    public function getCommands()
-    {
-        return \Magento\Framework\Connect\Command::getCommands();
-    }
-
-    public function getFrontend()
-    {
-        $frontend = \Magento\Framework\Connect\Frontend::getInstance('CLI');
-        \Magento\Framework\Connect\Command::setFrontendObject($frontend);
-        return $frontend;
-    }
-
-    public function getConfig($fileName = 'connect.cfg')
-    {
-        if (isset($this->config)) {
-            return $this->config;
-        }
-        $config = new \Magento\Framework\Connect\Config($fileName);
-        if (empty($config->magento_root)) {
-            $config->magento_root = dirname(__DIR__);
-        }
-        \Magento\Framework\Connect\Command::setConfigObject($config);
-        $this->config = $config;
-        return $config;
-    }
-
-    public function detectCommand()
-    {
-        $argv = $this->argv;
-        if (empty($argv[1])) {
-            return false;
-        }
-        if (in_array($argv[1], $this->validCommands)) {
-            list($options,$params) = $this->parseCommandArgs($argv);
-            return array('name' => strtolower($argv[1]), 'options'=>$options, 'params'=>$params);
-        }
-        return false;
-    }
-
-    public function parseCommandArgs($argv)
-    {
-        $a = new \Magento\Framework\System\Args();
-        $args = $a->getFiltered();
-        array_shift($args);
-        return array($a->getFlags(), $args);
-    }
-
-    public function runCommand($cmd, $options, $params)
-    {
-        $c = \Magento\Framework\Connect\Command::getInstance($cmd);
-        $c->run($cmd, $options, $params);
-    }
-
-    private $_sconfig;
-    public function getSingleConfig()
-    {
-        if (!$this->_sconfig) {
-            $this->_sconfig = new \Magento\Framework\Connect\Singleconfig(
-                    $this->getConfig()->magento_root . '/' .
-                    $this->getConfig()->downloader_path . '/' .
-                    \Magento\Framework\Connect\Singleconfig::DEFAULT_SCONFIG_FILENAME
-            );
-        }
-        \Magento\Framework\Connect\Command::setSconfig($this->_sconfig);
-        return $this->_sconfig;
-    }
-
-    public function run()
-    {
-        $this->commands = $this->getCommands();
-        $this->frontend = $this->getFrontend();
-        $this->config = $this->getConfig();
-        $this->validCommands = array_keys($this->commands);
-        $this->getSingleConfig();
-        $cmd = $this->detectCommand();
-        if (!$cmd) {
-            $this->frontend->outputCommandList($this->commands);
-        } else {
-            $this->runCommand($cmd['name'], $cmd['options'], $cmd['params']);
-        }
-    }
-}
-
-if (defined('STDIN') && defined('STDOUT') && (defined('STDERR'))) {
-    __cli_Magento_Connect::instance()->init($argv)->run();
-}
diff --git a/downloader/skin/boxes.css b/downloader/skin/boxes.css
deleted file mode 100644
index 514991a88a07122d8836c2eb4e48e2d4ab054cdf..0000000000000000000000000000000000000000
--- a/downloader/skin/boxes.css
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-/*
-RESET
-******************************************************/
-*                       { margin:0; padding:0; }
-body                    { background:#f6f6f6; color:#2f2f2f; font:12px/1.55em arial, helvetica; }
-a                       { color:#ea7601; }
-a:hover                 { color:#d56b00; }
-p                       { margin-bottom:1em; }
-th                      { font-weight:bold; }
-fieldset                { border:none; }
-form                    { display:inline; }
-input, select, button   { vertical-align:middle; }
-li                      { list-style:none; }
-
-/* COMMON ELEMENTS
-******************************************************/
-
-/* Messages */
-.msgs ul            { margin-bottom:14px; padding:4px 10px 3px 10px; }
-.msgs li {
-    list-style:none;
-    margin:0 0 3px 0;
-    border:0;
-    padding:0;
-    font-size:.95em;
-    font-weight:bold;
-    }
-.error-msg          { color:#df280a !important; background:#faebe7; }
-.success-msg        { color:#3d6611; background:#eff5ea; }
-.notice-msg         { background:#fffbf0; color:#3d6611 !important; }
-.warning-msg        { background:#e6e6e6; color:#000000 !important; }
-
-
-
-/* Forms */
-.form-list          { margin-bottom:10px; }
-.form-list td.label { padding:2px 8px 2px 0; }
-.form-list td.value { padding:2px 0 2px 8px; }
-.form-btn-set       { margin-top:10px; text-align:right; }
-button, .form-btn {
-    border-width:1px;
-    border-style:solid;
-    border-color:#ed6502 #a04300 #a04300 #ed6502;
-    background:url(images/btn_bg.gif) #ffac47 repeat-x 0 100%;
-    padding:0 7px 1px 7px;
-    color:#fff;
-    font:bold 12px arial, helvetica, sans-serif;
-    cursor:pointer;
-    white-space:nowrap;
-    }
-a.form-btn,
-a.form-btn:hover    { color:#fff; padding-top:1px; padding-bottom:2px; text-decoration:none; }
-
-
-/* Heading */
-.bar-head           { margin-bottom:12px; background:#6f8992; padding:2px 8px; }
-.bar-head h4        { float:left; margin:0; color:#fff; font-size:1em; }
-.bar-head
-.bar-head-btn       { margin-right:-6px; position:relative; }
-
-
-/* Lists */
-.bare-list li       { margin-bottom:8px; }
-.disc               { margin-bottom:12px; }
-.disc li            { margin-left:22px; list-style-type:disc; }
-.divider            { height:1px; margin:15px 0; background:#bbb; overflow:hidden;  font-size:1px; line-height:0em; }
-
-
-/*
-BOXES
-******************************************************/
-
-/* Base structure */
-.container          { width:750px; margin:35px auto 0 auto; }
-.header-top         { background:url(images/header_bg.gif) repeat-x #415d65; padding:25px 25px 10px 25px; }
-.main {
-    min-height:400px;
-    border-width:0 1px 2px 1px;
-    border-color:#aeaeae #aeaeae #6a6a6a #aeaeae;
-    border-style:solid;
-    background:#fff;
-    }
-.content            { padding:10px 25px 35px 25px; }
-.footer             { width:710px; margin:0 auto 35px auto; padding:10px 20px; text-align:center; }
-
-
-/* Header */
-#logo {
-    width:329px;
-    height:31px;
-    background:url(images/logo.gif) no-repeat;
-    text-indent:-6000px;
-    }
-.nav {
-    margin-bottom:20px;
-    padding:8px 15px 0 20px;
-    background:url(images/nav_bg.gif) repeat-x 0 100% #f6f6f6;
-    }
-.nav li             { list-style:none; float:left; }
-.nav li a, .nav .nav li a:hover {
-    float:left;
-    margin-right:4px;
-    border:1px solid #ccc;
-    border-right-color:#999;
-    border-bottom:none;
-    background:#ccc;
-    padding:2px 11px;
-    color:#222;
-    text-decoration:none;
-    }
-.nav li a.active, .nav li a.active:hover {
-    background:#fff;
-    color:#2f2f2f;
-    font-weight:bold;
-    text-decoration:none;
-    cursor:default;
-    }
-.page-head          { margin-bottom:14px; font-size:1.7em; font-weight:normal; }
-
-
-/* Footer */
-.footer .copyright  { font-size:.95em; color:#444; }
-
-
-
-
-/* SECTION-SPECIFIC
-******************************************************/
-
-/* Connect Package */
-.connect-packages table    { table-layout:fixed; margin:6px 0; }
-.eq-ie8 .connect-packages table    { table-layout:auto; }
-.connect-packages td,.connect-packages th {
-    padding:3px 5px;
-    border-right:solid 1px #ccc;
-    border-bottom:solid 1px #ccc;
-    background:#f6f6f6;
-    vertical-align:top;
-    word-wrap:break-word;
-    }
-.connect-packages th       { border-top:solid 1px #bbb; background:#ccc; text-align:left; }
-.connect-packages td.first { border-left:solid 1px #bbb; }
-.connect-packages td.last  { border-right:solid 1px #bbb; }
-.connect-packages tr.installed-latest td   { background:#dbf1d7; }
-.connect-packages tr.upgrade-available td  { background:#fcfbbb; }
-.connect-packages tr.stand-alone td        { background:#cbe8fb; }
-.connect-packages td .select               { word-wrap:normal; width:100%; }
-.step-count             { background:#f77312; color:#fff; font-weight:bold; padding:0 4px; }
-
-
-
-
-/* MISC
-******************************************************/
-
-/* Clearing */
-.bar-head:after,
-.form-btn-set:after,
-.nav:after,
-.clear:after {
-    clear:both;
-    content:".";
-    display:block;
-    height:0;
-    font-size:0;
-    line-height:0;
-    visibility:hidden;
-    }
-
-
-/* Directional and spacial */
-.f-left             { float:left; }
-.f-right            { float:right; }
-.v-top              { vertical-align:top; }
-.v-middle           { vertical-align:middle; }
-.v-bottom           { vertical-align:bottom; }
-.a-left             { text-align:left; }
-.a-center           { text-align:center !important; }
-.a-right            { text-align:right; }
-.nm                 { margin:0 !important; }
-.np                 { padding:0 !important; }
-.no-display         { display:none; }
-.no-show            { display:none; }
-.no-br              { white-space:nowrap; }
-.no-float           { float:none !important; }
-.big                { font-size:1.2em !important; }
-
-.loading-mask { color:#d85909; font-size:1.1em; font-weight:bold; text-align:center; opacity:0.80; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; z-index:500; }
-.loading-mask .loader { position:absolute; /* position:absolute; top:143px; */ left:50%; width:120px; margin-left:-120px; padding:15px 60px; background:#fff4e9; border:2px solid #f1af73; color:#d85909; font-weight:bold; text-align:center; z-index:1000; }
-
-/* Settings Page */
-.settings-page .form-list td { width:200px; }
-.settings-page .form-list select { width:254px; }
-.settings-page .form-list .input-text { width:250px; }
diff --git a/downloader/skin/ieboxes.css b/downloader/skin/ieboxes.css
deleted file mode 100644
index 5f4469a025d945862e5a806ffa3f3eb6145f4560..0000000000000000000000000000000000000000
--- a/downloader/skin/ieboxes.css
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-button, .form-button    { filter:chroma(color=#000000); overflow:visible; width:auto; }
-.main { height:400px; }
-.nav, .form-btn-set, .header-top, .bar-head { zoom:1; }
-.clear { clear:both; height:0; font-size:0; line-height:0; overflow:hidden; }
-.connect-packages td .select { margin:0 0 2px; }
diff --git a/downloader/skin/images/Magento_Connect.jpg b/downloader/skin/images/Magento_Connect.jpg
deleted file mode 100644
index 23f3c50e614540e178ef4d5b1ad83cad1fa3fb01..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/Magento_Connect.jpg and /dev/null differ
diff --git a/downloader/skin/images/ajax-loader-tr.gif b/downloader/skin/images/ajax-loader-tr.gif
deleted file mode 100644
index efb7ba77049448a34cd45c8509e5c63f8ac5fb5b..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/ajax-loader-tr.gif and /dev/null differ
diff --git a/downloader/skin/images/btn_bg.gif b/downloader/skin/images/btn_bg.gif
deleted file mode 100644
index 32d6ca84f3f541bf3a7bf29d9eb67b7f0b403d27..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/btn_bg.gif and /dev/null differ
diff --git a/downloader/skin/images/header_bg.gif b/downloader/skin/images/header_bg.gif
deleted file mode 100644
index 47e9a5762994c991dbac829d337d7399a16dc8ad..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/header_bg.gif and /dev/null differ
diff --git a/downloader/skin/images/logo.gif b/downloader/skin/images/logo.gif
deleted file mode 100644
index c12ed97528360bdbecc230702810b1eba2c7320d..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/logo.gif and /dev/null differ
diff --git a/downloader/skin/images/nav_bg.gif b/downloader/skin/images/nav_bg.gif
deleted file mode 100644
index 8e6a4f1396c9ef51cb139e1bcc7826f2ed20b2fb..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/nav_bg.gif and /dev/null differ
diff --git a/downloader/skin/images/nav_separator.gif b/downloader/skin/images/nav_separator.gif
deleted file mode 100644
index 85dcf8ed8f4db079472384dd1751a13d889f2d4e..0000000000000000000000000000000000000000
Binary files a/downloader/skin/images/nav_separator.gif and /dev/null differ
diff --git a/downloader/skin/install/boxes.css b/downloader/skin/install/boxes.css
deleted file mode 100644
index 8c9f9b642e09822e4cff16c19ebe100991d5b2dd..0000000000000000000000000000000000000000
--- a/downloader/skin/install/boxes.css
+++ /dev/null
@@ -1,412 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-
-/*******************************************************/
-/***********[ Magento_CSS_B Common Elements ]***********/
-/*******************************************************/
-
-
-/********************** Columns */
-
-/* All */
-.col2-set, .col3-set, .col4-set, .col5-set { clear:both; }
-
-/* Col2 */
-.col2-set .col-1, .col2-set .col-2 { width:48.5%; }
-.col2-set .col-1 { float:left; }
-.col2-set .col-2 { float:right;}
-
-/* Col2-alt */
-.col2-alt-set .col-1 { width:32%; }
-.col2-alt-set .col-2 { width:65%; }
-.col2-alt-set .col-1 { float:left; }
-.col2-alt-set .col-2 { float:right;}
-
-/* Col3 */
-.col3-set .col-1, .col3-set .col-2, .col3-set .col-3 { float:left; width:31.3%; }
-.col3-set .col-1, .col3-set .col-2 { margin-right:3%; }
-
-/* Col4 */
-.col4-set .col-1, .col4-set .col-2, .col4-set .col-3, .col4-set .col-4 { float:left; width:22%; }
-.col4-set .col-1, .col4-set .col-2, .col4-set .col-3 { margin-right:4%; }
-
-/* Table Columns */
-table .col-1, table .col-2, table .col-3, table .col-4 { float:none !important; margin:0 !important; }
-.col3-set td.spacer { width:3%; }
-.col4-set td.spacer { width:4%; }
-
-
-
-/********************** Form */
-
-/* Form Elements */
-input.input-text, select, textarea { border:1px solid #b6b6b6; font:12px arial, helvetica, sans-serif; }
-option, optgroup { font:12px arial, helvetica, sans-serif; }
-optgroup { font-weight:bold; }
-input.input-text, textarea { padding:2px; }
-input.form-radio { margin-right:3px;}
-.qty { width:2.5em; }
-.group-select label, .form-list label, .payment-methods label { font-weight:bold;}
-.button-set { /* Container for form buttons*/
-    clear:both;
-    margin-top:4em;
-    border-top:1px solid #e4e4e4;
-    padding-top:8px;
-    text-align:right;
-    }
-.form-button, .form-button-alt {
-    overflow:visible;
-    width:auto;
-    background-color:transparent;
-    border:0;
-    padding:1px 8px;
-    background:#f18200;
-    color:#fff;
-    border:1px solid #de5400;
-    font:bold 12px arial, sans-serif !important;
-    cursor:pointer;
-    text-align:center;
-    vertical-align:middle;
-    }
-.form-button span, .form-button-alt span {
-    white-space:nowrap;
-    }
-.form-button-alt {
-    border:1px solid #406a83;
-    background-color:#618499;
-    }
-
-.fieldset-download .form-button { margin:0.8em 0 0; }
-    
-
-/* Form lists */
-.form-list li { margin-bottom:6px; }
-.form-list li .input-box .input-text, .form-list li .input-box textarea { width:250px; }
-.form-list li .input-box select { width:256px;}
-
-table.form-list td { padding:2px 5px 2px 0; width:225px; }
-table.form-list input { width:248px; }
-table.form-list select { width:254px; }
-
-.group-select {
-    margin:28px 0;
-    border:1px solid #bbafa0;
-    padding:22px 25px 12px 25px;
-    background:#fbfaf6;
-    }
-.group-select .legend {
-    margin-top:-33px;
-    float:left;
-    border:1px solid #f19900;
-    background:#F9F3E3;
-    padding:0 8px;
-    color:#E76200;
-    font-weight:bold;
-    font-size:1.1em;
-    }
-.group-select li { padding:4px 8px !important; }
-.group-select li .input-box { float:left; width:275px; }
-.group-select li .input-text, .group-select li select, .group-select li textarea { width:525px; }
-.group-select li .input-box .input-text, .group-select li .input-box textarea { width:250px; }
-.group-select li .input-box select { width:256px;}
-
-
-/* Form Messages */
-.validation-advice, .required { color:#EB340A; }
-.validation-advice {
-    clear:both;
-    min-height:15px;
-    margin-top:3px;
-    background:url(images/validation_advice_bg.gif) no-repeat 2px 1px;
-    padding-left:17px;
-    font-size:.95em;
-    font-weight:bold;
-    line-height:1.25em;
-    }
-.validation-failed {
-    border:1px dashed #EB340A !important;
-    background:#faebe7 !important;
-    }
-label.required {
-    font-weight:bold;
-    }
-p.required {
-    font-size:.95em;
-    text-align:right;
-    }
-
-
-
-/********************** Messages  */
-.success { color:#3d6611; }
-.error { color:#df280a; }
-.success, .error { font-weight:bold; }
-.error-msg, .success-msg, .notice-msg, .note-msg {
-    min-height:23px !important;
-    margin-bottom:1em !important;
-    border-style:solid !important;
-    border-width:1px !important;
-    background-repeat:no-repeat !important;
-    background-position:10px 10px !important;
-    padding:8px 8px 8px 32px !important;
-    font-size:.95em !important;
-    font-weight:bold !important;
-    }
-.error-msg li, .success-msg li, .notice-msg li {margin-bottom:.2em; }
-.error-msg {
-    border-color:#f16048;
-    color:#df280a;
-    background-color:#faebe7;
-    background-image:url(images/error_msg_icon.gif);
-    }
-.success-msg {
-    border-color:#446423;
-    color:#3d6611;
-    background-color:#eff5ea;
-    background-image:url(images/success_msg_icon.gif);
-    }
-.notice-msg, .note-msg {
-    border-color:#fcd344;
-    color:#3d6611;
-    background-color:#fafaec;
-    background-image:url(images/note_msg_icon.gif);
-    }
-
-
-
-/********************** Headings */
-
-.head, .inner-head { line-height:1.25em; text-align:right; }
-.head h1,.head h2, .head h3, .head h4, .head h5,
-.inner-head h1,.inner-head h2, .inner-head h3, .inner-head h4, .inner-head h5{ margin:0; float:left; }
-
-
-/* Page heading */
-.page-head { margin:0 0 25px 0; border-bottom:1px solid #ccc; }
-.page-head-alt { margin:0 0 12px 0; }
-.page-head, .page-head-alt { text-align:right; }
-.page-head h3, .page-head-alt h3 {
-    margin:0;
-    font-size:1.7em !important;
-    font-weight:normal !important;
-    text-transform:none  !important;
-    text-align:left;
-    }
-.button-level h3 { /* heading level with buttons */
-    float:left;
-    width:60%;
-    }
-
-
-/* Category list heading */
-.category-head {
-    margin-bottom:7px;
-    }
-.category-head h2 {
-    margin:0;
-    padding:3px 0;
-    color:#0a263c;
-    font-size:1.6em;
-    line-height:1.3em;
-    font-weight:normal;
-    }
-
-
-
-
-/********************** Lists */
-.disc { margin-bottom:10px; }
-.disc li { margin-left:20px; list-style:disc; }
-
-
-/* Bare List */ /* Unstyled list */
-.bare-list { margin:5px 0; }
-.bare-list li { margin:3px 0; }
-
-
-
-/********************** Space Creators */
-
-.no-show { display:none; }
-.no-wrap { white-space:nowrap; }
-.content-box { min-height:250px; } /* Set minimum height for visual presentation */
-.content { padding:12px 12px 12px 15px; } /* Sets default padding */
-.actions { line-height:1.3em; }
-.separator { padding:0 5px;}
-.pipe { padding:0 4px; font-size:.95em; }
-.divider {
-    margin:10px 0;
-    height:1px;
-    background:url(images/dotted_divider.gif) repeat-x;
-    font-size:1px;
-    line-height:1em;
-    overflow:hidden;
-    }
-
-
-
-
-/***************************************************************/
-/********************[ Magento_CSS_C Layout]********************/
-/***************************************************************/
-
-
-/********************** Base Layout */
-
-/* Structure */
-.header {
-    z-index:999;
-    text-align:left;
-    }
-.header-top {
-    position:relative;
-    width:930px;
-    margin:0 auto;
-    }
-.header-nav {
-    width:950px;
-    margin:0 auto;
-    }
-.middle {
-    min-height:400px;
-    width:900px;
-    margin:0 auto;
-    text-align:left;
-    position:relative;
-    }
-.side-col { width:195px; }
-.col-left { float:left; }
-.col-main { float:left; }
-.col-right { float:right; }
-.col-1-layout .col-main { float:none; margin:0; }
-.col-2-right-layout .col-main { float:left; width:685px;  }
-.col-2-left-layout .col-main { float:right; width:685px; }
-.col-3-layout .col-main { width:475px; margin-left:17px; }
-
-/* Style */
-.header { border-top:5px solid #0d2131; }
-.header-top-container { border-bottom:1px solid #415966; background:url(images/header_top_container_bg.jpg) repeat-x 50% 0; }
-.header-top { padding:10px; }
-.header-nav-container { background:url(images/nav_bg.jpg) repeat-y 50% 0 #0a263d; }
-.middle-container { background:url(images/main_container_bg.gif) no-repeat 50% 0 #fbfaf6; }
-.middle { background:url(images/main_bg.gif) no-repeat #fffffe;  padding:25px 25px 80px 25px; }
-
-
-
-/********************** Header */
-
-/* Logo */
-h1#logo {
-    float:left;
-    width:202px;
-    margin:3px 0 10px 12px;
-    }
-.page-popup h1#logo { display:none; }
-
-
-/* Quick Access*/
-.quick-access {
-    width:390px;
-    float:right;
-    margin-top:28px;
-    text-align:right;
-    padding:0 10px;
-    color:#fff;
-    }
-.quick-access p { margin-bottom:4px; }
-.quick-access li {
-    display:inline;
-    background:url(images/shop_access_pipe.gif) no-repeat 100% .35em;
-    padding-right:7px;
-    padding-left:3px;
-    }
-.quick-access li.first { padding-left:0;}
-.quick-access li.last { padding-right:0; background:none;}
-.account-access p, .account-access ul, .account-access li { display:inline; color:#fff; }
-.account-access a, .account-access a:hover { color:#e1f1fb; }
-.account-access ul { padding-left:10px; font-size:.95em; }
-.shop-access a, .shop-access a:hover { color:#ebbc58; font-size:.95em; }
-
-
-/* Breadcrumbs */
-.breadcrumbs {  margin-bottom:13px; font-size:.95em; line-height:1.25em; }
-.breadcrumbs li { display:inline; }
-
-
-
-/********************** Footer */
-.footer-container { border-top:15px solid #B6D1E2; }
-.footer {
-    width:930px;
-    margin:0 auto;
-    padding:1em 1em 4em 1em;
-    position:relative;
-    }
-.footer .store-switcher { display:inline; padding:0 10px 0 0; vertical-align:middle; }
-.footer .informational label { color:#fff; font-weight:bold; padding-right:3px; }
-.footer .informational ul {
-    display:inline;
-    }
-.footer .informational li {
-    display:inline;
-    background:url(images/footer_info_separator.gif) no-repeat 100% 50%;
-    padding-right:8px;
-    padding-left:4px;
-    }
-.footer .informational li.last { background:none; padding-right:0; }
-.footer .informational a, .footer .informational a:hover { color:#fff; }
-.footer .informational a { text-decoration:none; }
-.footer .legality {
-    padding:13px 0;
-    color:#ecf3f6;
-    text-align:center;
-    }
-.footer .legality a, .footer .legality a:hover { color:#ecf3f6; }
-
-
-/***************************************************************/
-/******************[ Magento_CSS_F Overrides]*******************/
-/***************************************************************/
-
-
-/* Alignment */
-.v-top { vertical-align:top; }
-.v-middle { vertical-align:middle; }
-.v-bottom { vertical-align:bottom; }
-.a-left { text-align:left; }
-.a-center { text-align:center; }
-.a-right { text-align:right; }
-.left { float:left; }
-.right { float:right !important; }
-
-.normal-weight { font-weight:normal; }
-.auto-width { width:auto;}
-
-/* Link highlights */
-.link-cart { color:#DC6809 !important; font-weight:bold !important;}
-.link-remove { color:#646464 !important;}
-.link-print { background:url(images/icon_printer.gif) no-repeat 0 2px; padding-left:23px; }
-
-
-/* For Demo store only */
-.demo-notice { margin:0; background:#d75f07; padding:5px 10px 6px 10px; color:#fff; line-height:1em; text-align:center; }
diff --git a/downloader/skin/install/clears.css b/downloader/skin/install/clears.css
deleted file mode 100644
index fc32a47711c160304e60cb3fc637ab9f585794f9..0000000000000000000000000000000000000000
--- a/downloader/skin/install/clears.css
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-
-/*******************************************************/
-/****************[ Magento_CSS_B Clears ]***************/
-/*******************************************************/
-
-.page-head:after,
-.page-head-alt:after,
-.clear:after,
-.col2-set:after,
-.col3-set:after,
-.col4-set:after,
-.col2-alt-set:after,
-.head:after,
-.inner-head:after,
-.header-top:after,
-.quick-access:after,
-.header-nav:after,
-#nav:after,
-.middle:after,
-.product-essential:after,
-.button-set:after,
-.actions:after,
-.legend:after,
-.form-list li:after,
-.button-container:after,
-.ratings:after,
-.page-head:after,
-.page-head-alt:after,
-.group-select li:after,
-.search-autocomplete li:after,
-.side-col li:after,
-.account-box li:after,
-.address-list li:after,
-.generic-product-list li:after,
-.listing-type-list .listing-item:after,
-.listing-type-list .product-info .product-reviews:after,
-.my-review-detail:after {
-    content:".";
-    display:block;
-    clear:both;
-    height:0;
-    font-size:0;
-    line-height:0em;
-    visibility:hidden;
-    overflow:hidden;
-    }
diff --git a/downloader/skin/install/iestyles.css b/downloader/skin/install/iestyles.css
deleted file mode 100644
index ef8eaf1589438fccb65a0a4dfdc13255c83a3685..0000000000000000000000000000000000000000
--- a/downloader/skin/install/iestyles.css
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-.col2-set,
-.col3-set,
-.col4-set,
-.col2-alt-set,
-.head,
-.page-head,
-.page-head-alt,
-.header-top-container,
-.header-top,
-.header-nav-container,
-.header-nav,
-.quick-access,
-#nav,
-#nav li,
-#nav a,
-.middle,
-.product-essential,
-.button-set,
-.actions,
-.form-list li,
-.button-container,
-.ratings,
-.page-head,
-.page-head-alt,
-.group-select li,
-.search-autocomplete li,
-.side-col li,
-.account-box li,
-.address-list li,
-.listing-type-list .listing-item,
-.listing-type-list .product-info .product-reviews,
-.account-nav a,
-.account-box,
-.my-review-detail,
-.generic-product-list li { zoom:1; }
-
-.clear {
-    display:block;
-    clear:both;
-    height:0;
-    font-size:0;
-    line-height:0;
-    }
-.multi-address-checkout-box .box { zoom:1; }
-.multi-address-checkout-box .legend { zoom:1; position:relative; margin-left:8px;}
-.quick-access li { padding-right:4px; padding-left:6px;}
-.search-autocomplete { left:39px !important; }
-.mini-search  { padding-top:-1px; line-height:1em;}
-.home-spot { display:inline; }
-.mini-related-items .product-details { margin-left:76px; }
-.mini-related-items .product-images input { float:left; margin:-4px 2px 0 -4px; }
-.mini-related-items .product-images img { float:left; }
-.header-top-container { position:relative; }
-#nav ul li.parent { margin-bottom:-3px;}
diff --git a/downloader/skin/install/images/error_msg_icon.gif b/downloader/skin/install/images/error_msg_icon.gif
deleted file mode 100644
index 9db2351303341d36bef063d1ca7a926be5981aac..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/error_msg_icon.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_bg.gif b/downloader/skin/install/images/footer_bg.gif
deleted file mode 100644
index 5c40b5aaa578d3abf145f5528861af27e9e02c13..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_container_bg.gif b/downloader/skin/install/images/footer_container_bg.gif
deleted file mode 100644
index d280dcad8ab94b5ff49944f6a83b218a5f126dda..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_container_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_info_separator.gif b/downloader/skin/install/images/footer_info_separator.gif
deleted file mode 100644
index 81d13b63be184806527c970812b7fb292dd47a5e..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_info_separator.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_informational_bg.gif b/downloader/skin/install/images/footer_informational_bg.gif
deleted file mode 100644
index a4161dad9279a1ec40406b21fdd5c84b1f10cbd7..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_informational_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_left.gif b/downloader/skin/install/images/footer_left.gif
deleted file mode 100644
index 2019017a9ef0aede78e181899835703f45c09d15..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_left.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_legality_bg.gif b/downloader/skin/install/images/footer_legality_bg.gif
deleted file mode 100644
index 2c1cc68d0a48cc241c62894b5616d4fe31e6bf70..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_legality_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/footer_right.gif b/downloader/skin/install/images/footer_right.gif
deleted file mode 100644
index 665f8099f8f6ba562bb209d5d1e6cc419fd328e2..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/footer_right.gif and /dev/null differ
diff --git a/downloader/skin/install/images/header_bg.gif b/downloader/skin/install/images/header_bg.gif
deleted file mode 100644
index 5ec714c9c94ad8b10788e544390199fdefd4fab0..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/header_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/header_nav_bg.gif b/downloader/skin/install/images/header_nav_bg.gif
deleted file mode 100644
index 479af3cfceee40fb7b3eba0a5754cbaa1d1df59f..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/header_nav_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/header_top_bg.jpg b/downloader/skin/install/images/header_top_bg.jpg
deleted file mode 100644
index 6375f3ffdd8ec43f86d3e2fa0c729cad079d9dd8..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/header_top_bg.jpg and /dev/null differ
diff --git a/downloader/skin/install/images/header_top_container_bg.jpg b/downloader/skin/install/images/header_top_container_bg.jpg
deleted file mode 100644
index 02f969177aea73618ee8f61e23d85923cb72dfd6..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/header_top_container_bg.jpg and /dev/null differ
diff --git a/downloader/skin/install/images/logo.gif b/downloader/skin/install/images/logo.gif
deleted file mode 100644
index 34b1f5978c9dfe2bbc2d40dd2cebf92b01e44fcd..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/logo.gif and /dev/null differ
diff --git a/downloader/skin/install/images/main_bg.gif b/downloader/skin/install/images/main_bg.gif
deleted file mode 100644
index 5a358b5e10a7ced8eb0bf2b3fd495d00761f38fc..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/main_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/main_container_bg.gif b/downloader/skin/install/images/main_container_bg.gif
deleted file mode 100644
index 65664ffa9be41fd80bf34777b734302611556c97..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/main_container_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/images/note_msg_icon.gif b/downloader/skin/install/images/note_msg_icon.gif
deleted file mode 100644
index c9cacc27ae2553a59993d9702953dc19c53c679b..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/note_msg_icon.gif and /dev/null differ
diff --git a/downloader/skin/install/images/professional.gif b/downloader/skin/install/images/professional.gif
deleted file mode 100644
index ab38e57010ceaa3bb5720d5e4893f316e5eff66e..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/professional.gif and /dev/null differ
diff --git a/downloader/skin/install/images/success_msg_icon.gif b/downloader/skin/install/images/success_msg_icon.gif
deleted file mode 100644
index 611faffbc5f4254d54bd031f87470be3b32b28cf..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/success_msg_icon.gif and /dev/null differ
diff --git a/downloader/skin/install/images/validation_advice_bg.gif b/downloader/skin/install/images/validation_advice_bg.gif
deleted file mode 100644
index 46b1a2267ba5ad31f59a9c6cd8eaac9ee3b0f8ce..0000000000000000000000000000000000000000
Binary files a/downloader/skin/install/images/validation_advice_bg.gif and /dev/null differ
diff --git a/downloader/skin/install/reset.css b/downloader/skin/install/reset.css
deleted file mode 100644
index aba46ebb49944eb65fcd42d1db53ac9f172ed179..0000000000000000000000000000000000000000
--- a/downloader/skin/install/reset.css
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-/*********************************************/
-/***********[ Magento_CSS_A Reset ]***********/
-/*********************************************/
-
-* { margin:0; padding:0; }
-
-body {
-    background-color: #496778;
-    color:#2f2f2f;
-    font:12px/1.55em arial, helvetica, sans-serif;
-    text-align:center;
-    }
-
-a { color:#1e7ec8; text-decoration:underline; }
-a:hover { color:#1e7ec8; text-decoration:underline; }
-a img { border:0;}
-
-/* Heading */
-h1, h2, h3, h4, h5, h6, .head {
-    margin-bottom:.4em;
-    line-height:1.3em;
-    color:#0A263C;
-    }
-h2 { font-size:1.5em; }
-h3 { font-size:1.35em; }
-h4 { font-size:1.05em; }
-h5 { font-size:1.05em; }
-h6 { font-size:.95em; }
-
-/* Table */
-th { padding:0; text-align:left; vertical-align:top; }
-td {padding:0;vertical-align:top;}
-
-/* Paragraph */
-p { margin-bottom:.8em; }
-address { margin-bottom:.4em; }
-address { font-style:normal; line-height:1.4em;}
-cite { font-style:normal; font-size:10px;}
-q:before, q:after{content:'';}
-
-/* Form */
-form { display:inline;}
-fieldset { border:none; }
-legend {display:none;}
-label { color:#666; /*font-size:.95em;*/  font-weight:bold; }
-input, select, button { vertical-align:middle; }
-
-/* Lists */
-dt { display:block; font-weight:bold; }
-li { list-style:none; }
-
-/* Size */
-small { font-size:.9em; }
-big { font-size:1.1em; }
-
-hr { height:0; margin:8px 0; overflow:hidden; visibility:hidden; }
-.nowrap { white-space:nowrap; }
-:focus { outline: 0; }
-.bold { font-weight:bold; }
diff --git a/downloader/target.xml b/downloader/target.xml
deleted file mode 100644
index dc6789d30d36c143b124f29b0886333c3080b3c0..0000000000000000000000000000000000000000
--- a/downloader/target.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
--->
-    <targets>
-        <target name="magecore" label="Magento module file" uri="./app/code" />
-        <target name="magedesign" label="Magento User Interface (layouts, templates)" uri="./app/design" />
-        <target name="mageetc" label="Magento Global Configuration" uri="./app/etc" />
-        <target name="magelib" label="Magento PHP Library file" uri="./lib/internal" />
-        <target name="magelocale" label="Magento Locale language file" uri="./app/locale" />
-        <target name="magemedia" label="Magento Media library" uri="./media" />
-        <target name="mageweb" label="Magento Other web accessible file" uri="." />
-        <target name="magetest" label="Magento PHPUnit test" uri="./tests" />
-        <target name="mage" label="Magento other" uri="." />
-    </targets>
diff --git a/downloader/template/.htaccess b/downloader/template/.htaccess
deleted file mode 100644
index 93169e4eb44ffa5e6251f3532bb1902854703f07..0000000000000000000000000000000000000000
--- a/downloader/template/.htaccess
+++ /dev/null
@@ -1,2 +0,0 @@
-Order deny,allow
-Deny from all
diff --git a/downloader/template/connect/iframe.phtml b/downloader/template/connect/iframe.phtml
deleted file mode 100644
index 18ff42931afa4c1019e91c4654379b1a8f71763c..0000000000000000000000000000000000000000
--- a/downloader/template/connect/iframe.phtml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<a name="connect_iframe"></a>
-
-<div id="connect_iframe_container" style="display:none;">
-    <input id="connect_iframe_scroll" type="checkbox" checked="checked"/> <label for="connect_iframe_scroll">Auto-scroll console contents</label><br/>
-    <iframe id="connect_iframe" name="connect_iframe" src="<?php echo $this->url('empty') ?>" style="width:100%; height:300px;" frameborder="no"></iframe>
-</div>
-
-<script type="text/javascript">
-function disableInputs(flag)
-{
-    top.$$('input, select, button').each(function(el){
-        if (el.id!='connect_iframe_scroll') el.disabled = flag;
-    });
-    if (flag) {
-        window.onbeforeunload = confirmExit;
-    } else {
-        window.onbeforeunload = null;
-    }
-}
-
-function confirmExit()
-{
-    return "There are Connect processes running.\nIf you will close the window or navigate away from the page, installation will be interrupted.";
-}
-
-function onSubmit(formObj)
-{
-    if(formObj){
-        formObj.action = addParamToUrl(formObj.action, 'maintenance', (top.$('maintenance').checked === true ? '1' : '0'));
-        formObj.action = addParamToUrl(formObj.action, 'archive_type', top.$('is_backup').checked === true ? top.$('archive_type').value:0);
-        formObj.action = addParamToUrl(formObj.action, 'backup_name', top.$('backup_name').value);
-    }
-    top.$('connect_iframe_success').style.display = 'none';
-    top.$('connect_iframe_failure').style.display = 'none';
-    top.$('connect_iframe_container').style.display = '';
-    top.location.href = '#connect_iframe';
-    return true;
-}
-
-function onSuccess()
-{
-    var div = top.$('connect_iframe_success');
-    if (div) {
-        top.location.href = top.location.href.replace(/#.*$/, '')+'#connect_iframe_result';
-        div.style.display = '';
-    }
-}
-
-function onFailure()
-{
-    var div = top.$('connect_iframe_failure');
-    if (div) {
-        top.location.href = top.location.href.replace(/#.*$/, '')+'#connect_iframe_result';
-        div.style.display = '';
-    }
-}
-
-function checkForUpdateClick()
-{
-    url = addParamToUrl(location.href, 'maintenance', (top.$('maintenance').checked === true ? '1' : '0'));
-    url = addParamToUrl(url, 'updates', 'yes');
-    location.href = url;
-}
-
-function addParamToUrl(url, param, value)
-{
-    var anchor = null, params = {};
-    var anchorPos = url.search(/#/);
-    if (anchorPos != -1) {
-        anchor = url.substr(anchorPos + 1);
-        url = url.substr(0, anchorPos);
-    }
-    getPos = url.search(/\?/);
-    if (getPos != -1) {
-        url.substr(getPos + 1).split('&').each(function(pv){
-            if (pv != 'loggedin') {
-                pv = pv.split('=');
-                params[pv[0]] = pv[1];
-            }
-        });
-        url = url.substr(0, getPos);
-    }
-
-    params[param] = value;
-
-    if (params) {
-        url += '?';
-        for (k in params) {
-            url += k + '=' + params[k] + '&';
-        }
-        url = url.substr(0, url.length - 1);
-    }
-    if (anchor) {
-        url = url + '#' + anchor;
-    }
-
-    return url;
-}
-</script>
diff --git a/downloader/template/connect/packages.phtml b/downloader/template/connect/packages.phtml
deleted file mode 100644
index f33e1b8f197a2aaa41f4aaf42f08bc58aeab0642..0000000000000000000000000000000000000000
--- a/downloader/template/connect/packages.phtml
+++ /dev/null
@@ -1,261 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('header.phtml') ?>
-<?php if ($this->get('writable_warning')) echo $this->template('writable.phtml');?>
-<div class="bar-head">
-    <h4>Settings</h4>
-</div>
-<ul class="bare-list">
-    <li>
-        <input type="checkbox" id="maintenance" value="1" checked="checked" /> &nbsp;
-        <label for="maintenance">Put store on the maintenance mode while installing/upgrading/backup creation</label>
-    </li>
-    <li>
-        <table cellpadding="0" cellspacing="0">
-            <tr>
-                <td rowspan="2" valign="top">
-                    <input type="checkbox" id="is_backup" value="1"  /> &nbsp;
-                </td>
-                <td>
-                    <label for="is_backup">Create Backup</label>
-                </td>
-                <td>
-                    &nbsp;<select id="archive_type" style="width: 320px;">
-                        <option value="1">Database</option>
-                        <option value="4">Database and Media</option>
-                        <option value="2">System</option>
-                        <option value="3">System (excluding Media)</option>
-                    </select>
-                </td>
-            </tr>
-            <tr id="backup-name-container" style="display: none; margin-top: 5px;">
-                <td valign="top">
-                    <div style="margin: 6px 0 0 5px;">
-                        <label for="backup_name">Backup Name</label>
-                    </div>
-                </td>
-                <td>
-                    <div style="margin: 6px 0 0 4px;">
-                        <input type="text" name="backup_name" id="backup_name" style="width: 318px;" maxlength="50"/>
-                        <div class="notice-msg">Please use only letters (a-z or A-Z), numbers (0-9) or<br/> space in this field. Other characters are not allowed.</div>
-                    </div>
-                </td>
-            </tr>
-        </table>
-    </li>
-</ul>
-<div class="bar-head">
-    <h4>Install New Extensions</h4>
-</div>
-<script type="text/javascript">
-<!--
-changeAvailableArchiveStatus = function (){
-    $('archive_type').disabled = !$('is_backup').checked;
-    $('is_backup').checked ? $('backup-name-container').show() : $('backup-name-container').hide();
-    $('backup_name').value = '';
-}
-
-Event.observe('is_backup', 'change', changeAvailableArchiveStatus);
-Event.observe(window, 'load', changeAvailableArchiveStatus);
-
-function connectPrepare(form) {
-    new Ajax.Request(form.action, {
-      method:'post',
-      parameters: {install_package_id: form.install_package_id.value},
-      onCreate: function() {
-          $('prepare_package_result').update(
-                '<div class="loading-mask" id="loading_mask_loader">'+
-                ' <p class="loader">'+
-                ' <img src="<?php echo $this->baseUrl()?>/skin/images/ajax-loader-tr.gif" alt="Loading..."/><br/>Please wait...'+
-                ' </p>'+
-                '</div>'
-          );
-          $('loading_mask_loader').style.position = 'relative';
-          $('loading_mask_loader').top = 0;
-          $('prepare_package_result').show();
-      },
-      onSuccess: function(transport) {
-          // @TODO: check transport.status to show errors
-          $('prepare_package_result').update(transport.responseText);
-          $('prepare_package_result').show();
-      },
-      onFailure: function() {
-          $('prepare_package_result').update(
-              '<div id="packages_failure">' +
-              ' <ul class="msgs"> ' +
-              '  <li>' +
-              '   <ul class="error-msg">' +
-              '     <li>Connection Error try again later.</li>' +
-              '   </ul>' +
-              '  </li>' +
-              ' </ul>' +
-              '</div> '
-          );
-      }
-    });
-    return(false);
- }
-//-->
-</script>
-<form action="<?php echo $this->url('connectPreparePackagePost')?>" method="post" onsubmit="return connectPrepare(this)">
-    <ul class="bare-list">
-        <li>
-            <span class="step-count">1</span> &nbsp; Search for modules via <a href="http://connect.magentocommerce.com/" target="Magento_Connect">Magento Connect</a>.
-        </li>
-        <li>
-            <span class="step-count">2</span> &nbsp;
-            <label for="install_package_id">Paste extension key to install:</label> <input type="text" id="install_package_id" name="install_package_id" style="width:300px"/>
-            <button type="submit">Install</button>
-        </li>
-    </ul>
-</form>
-
-<br/>
-
-<div class="connect-packages" id="prepare_package_result" style="display:none;"></div>
-<br/>
-
-<div class="bar-head">
-    <h4>Direct package file upload</h4>
-</div>
-<form action="<?php echo $this->url('connectInstallPackageUpload')?>" method="post" target="connect_iframe" onsubmit="onSubmit(this)" enctype="multipart/form-data">
-    <ul class="bare-list">
-        <li><span class="step-count">1</span> &nbsp; Download or build package file.</li>
-        <li>
-            <span class="step-count">2</span> &nbsp; Upload package file:
-            <label for="file"></label>
-            <input type="file" id="file" name="file"/>
-            <button type="submit">Upload</button>
-        </li>
-    </ul>
-</form>
-
-<br/><br/>
-<div class="bar-head">
-    <h4>Manage Existing Extensions</h4>
-    <?php if (empty($_GET['updates'])): ?>
-        <span class="bar-head-btn f-right"><button type="button" class="f-right" onclick="checkForUpdateClick()">Check for Upgrades</button></span>
-    <?php endif; ?>
-</div>
-<?php $packages = $this->get('connect')->getAllInstalledPackages(); $i = 0; $cnt = count($packages); ?>
-<?php $channelConfig=$this->get('channel_config');?>
-<script type="text/javascript">
-    function formSubmit(id)
-    {
-        var formObj = $(id);
-        if (onSubmit(formObj)) {
-            formObj.submit();
-        }
-    }
-</script>
-<?php foreach ($packages as $channel=>$pkgs): ?>
-
-<form id="connect_packages_<?php echo $i ?>" class="connect-packages" action="<?php echo $this->url('connectPackagesPost')?>" method="post" target="connect_iframe">
-    <div class="no-display">
-        <input type="hidden" id="ignore_local_modification" name="ignore_local_modification" value=""/>
-        <input type="hidden" name="form_id" value="connect_packages_<?php echo $i ?>"/>
-    </div>
-    <p class="nm"><button type="button" onclick="formSubmit('connect_packages_<?php echo $i ?>')" class="f-right">Commit Changes</button></p>
-    <h2 class="page-head">Channel: <?php echo $channelConfig->getChannelLabel($channel); ?></h2>
-    <p class="f-right"><label for="clean_sessions">Clear all sessions after successfull install or upgrade: <input type="checkbox" id="clean_sessions"/></label></p>
-    <div class="clear"></div>
-
-    <table cellspacing="0" cellpadding="0" width="100%">
-        <?php if (!empty($_GET['updates'])): ?>
-            <col width="190" />
-            <col width="60" />
-            <col width="60" />
-            <col width="160"  />
-            <col width="170" />
-        <?php else: ?>
-            <col width="200" />
-            <col width="100" />
-            <col width="70"  />
-            <col width="180" />
-        <?php endif; ?>
-        <thead>
-            <tr>
-                <th class="first">Package Name</th>
-                <th class="a-center">Installed</th>
-                <?php if (!empty($_GET['updates'])): ?><th class="a-center">Available</th><?php endif; ?>
-                <th>Actions</th>
-                <th class="last">Summary</th>
-            </tr>
-        </thead>
-        <tbody>
-        <?php foreach ($pkgs as $pkgName=>$pkg): ?>
-            <tr class="<?php echo $pkg['status']?>">
-                <td class="first"><?php echo $pkgName?></td>
-                <td class="a-center"><?php echo $pkg['version'].' ('.$pkg['stability'].')'?>&nbsp;</td>
-                <?php if (!empty($_GET['updates'])): ?><td class="a-center"><?php echo $pkg['upgrade_latest']?>&nbsp;</td><?php endif; ?>
-                <td><select class="select" name="actions[<?php echo $channel.'|'.$pkgName ?>]">
-                    <option selected="selected"></option>
-                    <?php if(isset($pkg['actions']) && is_array($pkg['actions'])): ?>
-                        <?php foreach ($pkg['actions'] as $k=>$v): ?>
-                        <option value="<?php echo $k ?>"><?php echo $v ?></option>
-                        <?php endforeach; ?>
-                    <?php endif; ?>
-                </select>
-                </td>
-                <td class="last"><?php echo $pkg['summary']?></td>
-            </tr>
-        <?php endforeach; /*channel*/ ?>
-        </tbody>
-    </table>
-    <div class="clear"></div>
-
-    <div class="form-btn-set">
-        <button type="button" onclick="formSubmit('connect_packages_<?php echo $i ?>')" class="f-right">Commit Changes</button>
-        <?php if (!empty($_GET['updates'])): ?>
-        <p class="f-left a-left">
-            <span style="background:#f6f6f6;padding:0 5px;">&nbsp;</span> &nbsp;Installed<br/>
-            <span style="background:#fcfbbb;padding:0 5px;">&nbsp;</span> &nbsp;Upgrade Available<br/>
-        </p>
-        <?php endif; ?>
-    </div>
-</form>
-<script type="text/javascript">
-$$('#connect_packages_' + <?php echo $i?> + ' select').each(function(el){el.value=''});
-</script>
-<?php if (++$i != $cnt): ?><div class="divider"></div><?php endif ?>
-<br/>
-<?php endforeach; /*all packages*/ ?>
-
-
-<?php echo $this->template('connect/iframe.phtml') ?>
-
-<a name="connect_iframe_result"></a>
-<div id="connect_iframe_success" style="display:none">
-    <?php $this->set('messages', array('success'=>array('Procedure completed. Please check the output frame for useful information and refresh the page to see changes.'))) ?>
-    <?php echo $this->template('messages.phtml') ?>
-    <button onclick="location.href='<?php echo $this->baseUrl() ?>'">Refresh</button>
-</div>
-<div id="connect_iframe_failure" style="display:none">
-    <?php $this->set('messages', array('error'=>array('Please check the output frame for errors and refresh the page to retry changes.'))) ?>
-    <?php echo $this->template('messages.phtml') ?>
-    <button onclick="location.href='<?php echo $this->baseUrl() ?>'">Refresh</button>
-</div>
-
-<?php echo $this->template('footer.phtml') ?>
diff --git a/downloader/template/connect/packages_prepare.phtml b/downloader/template/connect/packages_prepare.phtml
deleted file mode 100644
index 583d202900ad36412b1cdb5162a2e1d0926c815d..0000000000000000000000000000000000000000
--- a/downloader/template/connect/packages_prepare.phtml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php
-    $packages = $this->get('packages');
-    $errors = $this->get('errors');
-    $cnt = count($packages);
-    if($cnt):
-?>
-Extension dependencies
-<form action="<?php
-    echo $this->url('connectInstallPackagePost')?>" method="post" target="connect_iframe" onsubmit="onSubmit(this)">
-    <input type="hidden" name="install_package_id" value="<?php echo $this->get('package_id'); ?>">
-    <table cellspacing="0" cellpadding="0" width="100%">
-        <col width="150" />
-        <col width="250" />
-        <col width="150" />
-        <col width="100" />
-        <thead>
-            <tr>
-                <th class="first">Channel</th>
-                <th class="first">Package Name</th>
-                <th>Version</th>
-                <th class="last">Status</th>
-            </tr>
-        </thead>
-        <tbody>
-        <?php foreach ($packages as $pkg): ?>
-            <tr class="<?php echo $pkg['status']?>">
-                <td class="first"><?php echo $pkg['channel']?></td>
-                <td><?php echo $pkg['name']?></td>
-                <td><?php echo $pkg['version'] . (!empty($pkg['stability']) ? ' (' . $pkg['stability'] . ')' : '')?></td>
-                <td class="last"><?php echo $pkg['message']?></td>
-            </tr>
-        <?php endforeach;?>
-        </tbody>
-    </table>
-    <div class="form-btn-set">
-        <button class="f-right" type="submit">Proceed</button>
-        <button class="f-right" style="margin-right:10px;" onclick="$('prepare_package_result').update();" type="reset">Cancel installation</button>
-    </div>
-</form>
-<?php
-endif;
-if (!$cnt || !empty($errors['error'])):
-    $_errors = array('error'=>array('Extension key is not valid.'));
-    if(!empty($errors) && is_array($errors)) $_errors = $errors;
-    $this->set('messages', $_errors)
-?>
-<div id="packages_failure">
-    <?php echo $this->template('messages.phtml') ?>
-</div>
-<?php
-endif;
-?>
diff --git a/downloader/template/footer.phtml b/downloader/template/footer.phtml
deleted file mode 100644
index 6e2521a20a0344d4858e557d505b458b6576e201..0000000000000000000000000000000000000000
--- a/downloader/template/footer.phtml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-                </div>
-            </div>
-        </div>
-        <div class="footer">
-            <p class="copyright">
-                Help Us to Keep Magento Healthy - <a href="http://www.magentocommerce.com/bug-tracking" id="bug_tracking_link"><strong>Report All Bugs</strong></a> (Magento Connect Manager ver. <?php echo \Magento\Downloader\Controller::getVersion();?>)<br/>
-                <script type="text/javascript">
-                    $('bug_tracking_link').target = "varien_external";
-                </script>
-                <?php echo $this->template('copyright.phtml'); ?>
-            </p>
-        </div>
-    </body>
-</html>
diff --git a/downloader/template/header.phtml b/downloader/template/header.phtml
deleted file mode 100644
index 1de5b73fb5b0ce1e72c5dac0779cec8a2e6e57e9..0000000000000000000000000000000000000000
--- a/downloader/template/header.phtml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title><?php echo __('Magento Downloader') ?></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <link type="image/x-icon" href="<?php echo $this->baseUrl()?>/favicon.ico" rel="icon"/>
-    <link type="image/x-icon" href="<?php echo $this->baseUrl()?>/favicon.ico" rel="shortcut icon"/>
-    <script type="text/javascript" src="js/prototype.js"></script>
-    <link type="text/css" rel="stylesheet" href="skin/boxes.css"></link>
-    <!--[if IE]>
-    <link type="text/css" rel="stylesheet" href="skin/ieboxes.css" media="all"></link>
-    <![endif]-->
-    <!--[if gt IE 6]>
-    <link type="text/css" rel="stylesheet" href="skin/ie7boxes.css" media="all"></link>
-    <![endif]-->
-</head>
-<body>
-    <div class="container">
-
-        <div class="header-top">
-            <h1 id="logo">Magento Downloader</h1>
-        </div>
-        <div class="main">
-        <?php if ($this->controller()->getAction()!='login' && !$this->get('exception')): ?>
-            <div class="nav">
-            <?php if (true||$this->controller()->isWritable()): ?>
-                <?php if ($this->controller()->session()->getUserId()): ?>
-                    <a href="<?php echo $this->url('logout') ?>" class="f-right" style="margin:0px 10px;">Log Out</a>
-                    <?php if ($returnUrl = $this->controller()->session()->getReturnUrl()): ?>
-                        <a href="<?php echo $returnUrl ?>" class="f-right" style="margin:0px 10px;">Return to Admin</a>
-                    <?php endif; ?>
-                <?php endif; ?>
-                <ul>
-                    <li class="first"><a <?php echo $this->getNavLinkParams('connectPackages') ?>>Extensions</a></li>
-                    <li class="last"><a <?php echo $this->getNavLinkParams('settings') ?>>Settings</a></li>
-                </ul>
-             <?php else: ?>
-                <ul>
-                    <li class="first last"><a class="active">Check Write Permissions</a></li>
-                </ul>
-             <?php endif; ?>
-            </div>
-        <?php endif; ?>
-            <div class="content">
-<?php $this->set('messages', $this->controller()->session()->getMessages()) ?>
-<?php echo $this->template('messages.phtml') ?>
diff --git a/downloader/template/index.phtml b/downloader/template/index.phtml
deleted file mode 100644
index 8212596a27a71af71fe8062e4cff64db058847ea..0000000000000000000000000000000000000000
--- a/downloader/template/index.phtml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('header.phtml') ?>
-
-<h2 class="page-head">Start Here</h2>
-<p>Here is some explanation about PEAR. Suspendisse sapien urna, facilisis sed, pharetra ut, blandit nec, nulla. Vivamus ac dui. Morbi justo ipsum, bibendum sed, egestas sed, pharetra ut, ligula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer quis sapien vel sem semper luctus. Vestibulum tristique venenatis velit. Ut urna nisl, dignissim vitae, cursus eget, pulvinar scelerisque, lectus. In ac leo id libero consequat dignissim. Sed aliquam est a pede. Phasellus ut turpis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed magna leo, volutpat eget, pretium tristique, varius vitae, tellus. Sed odio ante, sagittis id, euismod eu, bibendum quis, purus. Proin consectetuer elementum nunc. Mauris turpis. In sed eros eu enim sagittis viverra. Integer adipiscing vestibulum tortor. Proin ante. Vivamus euismod, tortor id condimentum condimentum, arcu odio posuere est, eu eleifend nunc nulla sed nibh. Proin pretium sapien vitae erat.<br/><a href="<?php echo $this->url('settings') ?>">Change your PEAR settings</a></p>
-
-<p class="a-center"><a href="<?php echo $this->url('pearGlobal') ?>" class="form-btn">Proceed with complete Magento PEAR Download/Upgrade</a></p>
-<p class="a-center"><a href="<?php echo $this->url('pearPackages') ?>" class="form-btn">Proceed to individual PEAR packages management</a></p>
-
-<?php echo $this->template('footer.phtml') ?>
-
diff --git a/downloader/template/install/download.phtml b/downloader/template/install/download.phtml
deleted file mode 100644
index c7f00b397b5236abd1b6f0eb35d26fc3b59ec198..0000000000000000000000000000000000000000
--- a/downloader/template/install/download.phtml
+++ /dev/null
@@ -1,192 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('install/header.phtml') ?>
-
-<div class="page-head">
-    <h3>Welcome to Magento's Installation Wizard!</h3>
-</div>
-
-<?php if (!$this->controller()->isDownloaded()): ?>
-    <p>You are now ready to continue the installation process by downloading the most up-to-date copy of the Magento software.</p>
-  <?php echo($this->get('channel_notice')); ?>
-    <form id="install_all" method="post" action="<?php echo $this->url('connectInstallAll') ?>" target="connect_iframe" onsubmit="return installAll()">
-        <fieldset class="fieldset-download">
-<?php else: ?>
-    <p>There's an indication that Magento files already have been downloaded.</p>
-    <p>If you feel that you have arrived to this page by mistake, please continue installation:</p>
-    <button class="form-button" type="button" onclick="location.href='<?php echo $this->mageUrl() ?>'"><span>Continue Magento installation</span></button>
-    <br/><br/><br/>
-    <p>Alternatively, you could proceed with Re-Downloading all packages</p>
-    <?php echo($this->get('channel_notice')); ?>
-    <form id="reinstall_all" method="post" action="<?php echo $this->url('connectInstallAll') ?>&force=1" target="connect_iframe" onsubmit="return installAll(true)">
-        <fieldset class="fieldset-download">
-<?php endif; ?>
-
-            <table cellspacing="0" class="form-list">
-                <tr>
-                    <td class="label">Magento Connect Channel Protocol:</td>
-                    <td class="value">
-                        <select id="protocol" name="protocol">
-                            <option value="http" <?php if ($this->get('protocol')=='http'):?>selected="selected"<?php endif ?>>Http</option>
-                            <option value="ftp" <?php if ($this->get('protocol')=='ftp'):?>selected="selected"<?php endif ?>>Ftp</option>
-                        </select>
-                    </td>
-                </tr>
-                <?php echo($this->get('channel_protocol_fields')); ?>
-                <tr>
-                    <td class="label">Magento Version Stability:</td>
-                    <td class="value">
-                        <select id="preferred_state" name="preferred_state">
-                            <option value="stable" <?php if ($this->get('preferred_state') == 'stable'):?>selected="selected"<?php endif ?>>stable</option>
-                            <option value="beta" <?php if ($this->get('preferred_state') == 'beta'):?>selected="selected"<?php endif ?>>beta</option>
-                            <option value="alpha" <?php if ($this->get('preferred_state') == 'alpha'):?>selected="selected"<?php endif ?>>alpha</option>
-                        </select>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">Use Custom Permissions:</td>
-                    <td class="value">
-                        <select onchange="togglePanel(this)" id="use_custom_permissions_mode" name="use_custom_permissions_mode">
-                            <option value="1" <?php if ($this->get('use_custom_permissions_mode')=='1'):?>selected="selected"<?php endif ?>>Yes</option>
-                            <option value="0" <?php if ($this->get('use_custom_permissions_mode')=='0'):?>selected="selected"<?php endif ?>>No</option>
-                        </select>
-                    </td>
-                </tr>
-            </table>
-            <table cellspacing="0" cellpadding="0" class="form-list" id="use_custom_permissions_mode_panel" <?php if ($this->get('use_custom_permissions_mode')=='0'):?>style="display:none;"<?php endif ?> >
-                <tr>
-                    <td class="label">Folders:</td>
-                    <td class="value">
-                        <input id="mkdir_mode" name="mkdir_mode" value="<?php echo($this->get('mkdir_mode'));?>" type="text" class="input-text"/>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">Files:</td>
-                    <td class="value">
-                        <input id="chmod_file_mode" name="chmod_file_mode" value="<?php echo($this->get('chmod_file_mode'));?>" type="text" class="input-text"/>
-                    </td>
-                </tr>
-            </table>
-            <table cellspacing="0" cellpadding="0" class="form-list">
-                <tr>
-                    <td class="label">Deployment Type:</td>
-                    <td class="value">
-                        <select id="inst_protocol" onchange="togglePanel(this)" name="inst_protocol">
-                            <option value="0">Local Filesystem</option>
-                            <option value="1">FTP Connection</option>
-                        </select>
-                    </td>
-                </tr>
-            </table>
-            <table cellspacing="0" cellpadding="0" class="form-list" id="inst_protocol_panel">
-                <tr>
-                    <td class="label">Host:</td>
-                    <td class="value">
-                        <input type="text" class="input-text" id="ftp_host" value="" name="ftp_host" />
-                    </td>
-                </tr>
-
-                <tr>
-                    <td class="label">User:</td>
-                    <td class="value">
-                        <input type="text" class="input-text" id="ftp_login" value="" name="ftp_login" />
-                    </td>
-                </tr>
-
-                <tr>
-                    <td class="label">Password:</td>
-                    <td class="value">
-                        <input type="password" id="ftp_password" value="" name="ftp_password" class="input-text" />
-                    </td>
-                </tr>
-
-                <tr>
-                    <td class="label">Installation Path:</td>
-                    <td class="value">
-                        <input id="ftp_path" name="ftp_path" value="" type="text" class="input-text" />
-                    </td>
-                </tr>
-            </table>
-
-<?php if (!$this->controller()->isDownloaded()): ?>
-            <button class="form-button" type="submit">Start the download process</button>
-        </fieldset>
-    </form>
-<?php else: ?>
-            <button class="form-button" type="submit">Re-Download All Magento Core Packages</button>
-        </fieldset>
-    </form>
-<?php endif; ?>
-
-<br/>
-<?php echo $this->template('connect/iframe.phtml') ?>
-
-<a name="connect_iframe_result"></a>
-<div id="connect_iframe_success" style="display:none">
-    <?php $this->set('messages', array('success'=>array(
-       'Download completed. You can proceed with installation',
-    ))) ?>
-    <?php echo $this->template('messages.phtml') ?>
-
-    <button class="form-button" type="button" onclick="location.href='<?php echo $this->mageUrl() ?>'"><span>Continue Magento installation</span></button>
-</div>
-
-<div id="connect_iframe_failure" style="display:none">
-    <?php $this->set('messages', array('error'=>array('There was a problem during downloading of Magento packages. Please check the output frame for errors information and refresh the page to retry again.'))) ?>
-    <?php echo $this->template('messages.phtml') ?>
-    <button class="form-button" type="button" onclick="location.reload()"><span>Refresh</span></button>
-</div>
-
-<script type="text/javascript">
-function togglePanel (element)
-{
-    if (element.value == '1') {
-        disabledMode = '';
-    } else {
-        disabledMode = 'none';
-    }
-    document.getElementById(element.id+'_panel').style.display = disabledMode;
-}
-togglePanel(document.getElementById('use_custom_permissions_mode'));
-togglePanel(document.getElementById('inst_protocol'));
-</script>
-
-<script type="text/javascript">
-function installAll(force)
-{
-    if (force) {
-        if (!confirm("This will delete all files from core packages.\n\nAre you sure you wish to force re-install all Magento files?")) {
-            return false;
-        }
-    }
-    /**
-     * @TODO: create validation of directory/file permission fields
-     */
-
-    return onSubmit();
-}
-</script>
-
-<?php echo $this->template('install/footer.phtml') ?>
diff --git a/downloader/template/install/header.phtml b/downloader/template/install/header.phtml
deleted file mode 100644
index b7b1208120facdb4707233af3bbcd41d9e198452..0000000000000000000000000000000000000000
--- a/downloader/template/install/header.phtml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title>Magento Installation Wizard</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-
-    <link type="image/x-icon" href="<?php echo $this->baseUrl()?>/favicon.ico" rel="icon"/>
-    <link type="image/x-icon" href="<?php echo $this->baseUrl()?>/favicon.ico" rel="shortcut icon"/>
-
-    <script type="text/javascript" src="<?php echo $this->baseUrl()?>/js/prototype.js" ></script>
-
-    <link rel="stylesheet" href="<?php echo $this->baseUrl()?>/skin/install/reset.css" type="text/css" media="all"/>
-    <link rel="stylesheet" href="<?php echo $this->baseUrl()?>/skin/install/boxes.css" type="text/css" media="all"/>
-    <link rel="stylesheet" href="<?php echo $this->baseUrl()?>/skin/install/clears.css" type="text/css" media="all"/>
-
-    <!--[if IE]><link rel="stylesheet" href="<?php echo $this->baseUrl()?>/skin/install/iestyles.css" type="text/css" media="all"/><![endif]-->
-    <!--[if lt IE 7]><link rel="stylesheet" href="<?php echo $this->baseUrl()?>/skin/install/ie7minus.css" type="text/css" media="all"/><![endif]-->
-</head>
-
-<body>
-<!-- [start] header -->
-    <div class="header">
-        <div class="header-top-container">
-            <div class="header-top">
-                <h1 id="logo">
-                    <a href="<?php echo $this->baseUrl()?>"><img src="<?php echo $this->baseUrl()?>/skin/install/images/<?php echo($this->get('channel_logo')); ?>.gif" alt="Magento"/></a>
-                </h1>
-            </div>
-        </div>
-            </div>
-<!-- [end] header -->
-
-        <!-- [start] middle -->
-           <div class="middle-container">
-        <div class="middle col-2-left-layout">
-
-
-
-            <!-- [start] left -->
-
-            <div class="col-left side-col">
-                <div style="border:1px solid #ccc; background:#f6f6f6;">
-    <h2 style="margin-bottom:0; border-bottom:1px solid #ccc; padding:4px 10px; color:#3c5974; font-size:1.4em;">Installation</h2>
-<ol style="padding:10px; border-top:1px solid #fff;">
-    <li>Welcome</li>
-    <li>Validation</li>
-    <li>Magento Connect Manager Deployment</li>
-    <?php echo($this->get('channel_steps')); ?>
-    <li style="color:green; font-weight:bold; ">Download</li>
-    <li >License Agreement</li>
-    <li >Localization</li>
-    <li >Configuration</li>
-
-    <li >Create Admin Account</li>
-    <li >You're All Set!</li>
-</ol>
-</div>
-
-<br/>
-<p>
-    Having trouble installing Magento?    Check out our <a href="http://www.magentocommerce.com/magento2/install" id="installation_guide_link">Installation Guide</a>
-    <script type="text/javascript">
-        $('installation_guide_link').target = "installation_guide";
-    </script>
-
-</p>
-&nbsp;
-            </div>
-            <div id="main" class="col-main">
-            <!-- [start] global messages -->
-                            <!-- [end] global messages -->
-            <!-- [start] content -->
diff --git a/downloader/template/install/writable.phtml b/downloader/template/install/writable.phtml
deleted file mode 100644
index 587f44765afd9f5b907ee76b34450963753140e0..0000000000000000000000000000000000000000
--- a/downloader/template/install/writable.phtml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('install/header.phtml') ?>
-<div class="page-head">
-<h3 style="color:red">Error: Please check for sufficient write file permissions</h3>
-</div>
-
-<p>Your Magento folder does not have sufficient write permissions, which this web based downloader requires.</p>
-<p>If you wish to proceed downloading Magento packages online, please set all Magento folders to have writable permission for the web server user (example: apache) and press the "Refresh" button to try again.</p>
-
-<button class="form-button" type="button" onclick="location.reload()"><span>Refresh</span></button>
-<br/><br/><br/>
-<p>To learn more about setting write permissions, please visit <a href="http://www.magentocommerce.com/knowledge-base/entry/magento-installation-guide" target="Install_Help">the Magento community site</a> for further details.</p>
-<p>Alternatively, if you are a developer and familiar with SVN, you can follow <a href="http://www.magentocommerce.com/svn" target="Install_Help">these instructions</a> to check out the latest Magento branch.</p>
-<?php echo $this->template('install/footer.phtml') ?>
-
diff --git a/downloader/template/login.phtml b/downloader/template/login.phtml
deleted file mode 100644
index 6853619af66b3959f2fcdafcf9e9b20537a6876a..0000000000000000000000000000000000000000
--- a/downloader/template/login.phtml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('header.phtml') ?>
-<?php if ($returnUrl = $this->controller()->session()->getReturnUrl()): ?>
-<a class="f-right" href="<?php echo htmlentities($returnUrl) ?>">Return to Magento Administration</a>
-<?php endif ?>
-<div style="width:300px; padding:20px; margin:90px auto !important; background:#f6f6f6;">
-<form method="post" action="#">
-    <h2 class="page-head">Log In</h2>
-    <p><small>Please re-enter your Magento Adminstration Credentials.<br/>Only administrators with full permissions will be able to log in.</small></p>
-    <table class="form-list">
-        <tr><td class="label"><label for="username">Username:</label></td><td class="value"><input id="username" name="username" value=""/></td></tr>
-        <tr><td class="label"><label for="password">Password:</label></td><td class="value"><input type="password" id="password" name="password"/></td></tr>
-        <tr><td></td>
-            <td class="value"><button type="submit">Log In</button></td></tr>
-        </table>
-</form>
-</div>
-<?php echo $this->template('footer.phtml') ?>
diff --git a/downloader/template/noroute.phtml b/downloader/template/noroute.phtml
deleted file mode 100644
index af351dda21812e7bb6d4eb161575dc3db780d002..0000000000000000000000000000000000000000
--- a/downloader/template/noroute.phtml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('header.phtml') ?>
-<h2 class="page-head">404 - Invalid Page</h2>
-<p>Vestibulum tristique venenatis velit. Ut urna nisl, dignissim vitae, cursus eget, pulvinar scelerisque, lectus. In ac leo id libero consequat dignissim. Sed aliquam est a pede. Phasellus ut turpis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed magna leo, volutpat eget, pretium tristique, varius vitae, tellus. Sed odio ante, sagittis id, euismod eu, bibendum quis, purus. Proin consectetuer elementum nunc. Mauris turpis.</p>
-<?php echo $this->template('footer.phtml') ?>
-
diff --git a/downloader/template/settings.phtml b/downloader/template/settings.phtml
deleted file mode 100644
index 5cb5f3c0f674681503e4c7cf1c8e10a6cd50bc5c..0000000000000000000000000000000000000000
--- a/downloader/template/settings.phtml
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<?php echo $this->template('header.phtml') ?>
-
-<script type="text/javascript">
-function useCustomPermissions (element)
-{
-    if (element.value == '1') {
-        disabledMode = 'block';
-    } else {
-        disabledMode = 'none';
-    }
-    document.getElementById('use_custom_permissions_mode_panel').style.display = disabledMode;
-}
-function changeDeploymentType (element)
-{
-    if (element.value == 'ftp') {
-        disabledMode = 'block';
-    } else {
-        disabledMode = 'none';
-    }
-    document.getElementById('deployment_type_panel').style.display = disabledMode;
-}
-</script>
-
-<div class="settings-page">
-    <h2 class="page-head">Settings</h2>
-    <form action="<?php echo $this->url('settingsPost') ?>" method="post">
-        <fieldset>
-            <p>Magento Extensions are available in three different versions.</p>
-            <ul class="disc">
-                <li><strong>Stable</strong> means the extension can be used in a production environment.</li>
-                <li><strong>Beta</strong> means the extension is not recommended for use in a production environment.</li>
-                <li><strong>Alpha</strong> means the extension is still in development.</li>
-            </ul>
-            <p><strong>Please note: extensions are provided as is. Make sure to backup your data before installing new extensions.</strong></p>
-            <table cellspacing="0" class="form-list">
-                <tr>
-                    <td class="label">Magento Connect Channel Protocol:</td>
-                    <td class="value">
-                        <select id="protocol" name="protocol">
-                            <option value="http" <?php if ($this->get('protocol')=='http'):?>selected="selected"<?php endif ?>>Http</option>
-                            <option value="ftp" <?php if ($this->get('protocol')=='ftp'):?>selected="selected"<?php endif ?>>Ftp</option>
-                        </select>
-                    </td>
-                </tr>
-                <?php echo $this->get('channel_protocol_fields'); ?>
-                <tr>
-                    <td class="label">Preferred State:</td>
-                    <td class="value">
-                        <select id="preferred_state" name="preferred_state">
-                            <option value="stable" <?php if ($this->get('preferred_state')=='stable'):?>selected="selected"<?php endif ?>>Stable</option>
-                            <option value="beta" <?php if ($this->get('preferred_state')=='beta'):?>selected="selected"<?php endif ?>>Beta</option>
-                            <option value="alpha" <?php if ($this->get('preferred_state')=='alpha'):?>selected="selected"<?php endif ?>>Alpha</option>
-                        </select>
-                    </td>
-                </tr>
-                <!--
-                <tr>
-                    <td class="label">Magento Installation Directory:</td>
-                    <td class="value"><input name="mage_dir" value="<?php echo htmlentities($this->get('mage_dir'))?>" style="width:250px;"/></td>
-                </tr>
-                -->
-            </table>
-            <p><strong>Permission to create new files and folders.</strong></p>
-            <table cellspacing="0" class="form-list">
-                <tr>
-                    <td class="label">Use custom permissions:</td>
-                    <td class="value">
-                        <select onchange="useCustomPermissions(this)" id="use_custom_permissions_mode" name="use_custom_permissions_mode">
-                            <option value="1" <?php if ($this->get('use_custom_permissions_mode')=='1'):?>selected="selected"<?php endif ?>>Yes</option>
-                            <option value="0" <?php if ($this->get('use_custom_permissions_mode')=='0'):?>selected="selected"<?php endif ?>>No</option>
-                        </select>
-                    </td>
-                </tr>
-            </table>
-            <table cellspacing="0" class="form-list" id="use_custom_permissions_mode_panel" <?php if ($this->get('use_custom_permissions_mode')=='0'):?>style="display:none;"<?php endif ?>>
-                <tr>
-                    <td class="label">Folders:</td>
-                    <td class="value">
-                        <input id="mkdir_mode" name="mkdir_mode" value="<?php echo($this->get('mkdir_mode'));?>" class="input-text" type="text"></input>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">Files:</td>
-                    <td class="value">
-                        <input id="chmod_file_mode" name="chmod_file_mode" value="<?php echo($this->get('chmod_file_mode'));?>" class="input-text" type="text"></input>
-                    </td>
-                </tr>
-            </table>
-
-            <p><strong>Deployment.</strong></p>
-            <table cellspacing="0" class="form-list">
-                <tr>
-                    <td class="label">Deployment Type:</td>
-                    <td class="value">
-                        <input value="fs" type="radio" name="deployment_type" id="deployment_fs" onclick="changeDeploymentType(this)" <?php if ($this->get('deployment_type')=='fs'):?>checked="checked"<?php endif ?> <?php if ($this->get('fs_disabled')):?>disabled="disabled"<?php endif ?> />
-                        <label for="deployment_fs"> <span class="label">Local Filesystem</span> </label>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">&nbsp;</td>
-                    <td class="value">
-                        <input value="ftp" type="radio" name="deployment_type" id="deployment_ftp" onclick="changeDeploymentType(this)" <?php if ($this->get('deployment_type')=='ftp'):?>checked="checked"<?php endif ?> />
-                        <label for="deployment_ftp"><span class="label">FTP Connection</span></label>
-                    </td>
-                </tr>
-            </table>
-            <table cellspacing="0" class="form-list" id="deployment_type_panel" <?php if ($this->get('deployment_type')!='ftp'):?>style="display:none;"<?php endif ?>>
-                <tr>
-                    <td class="label">FTP Host:</td>
-                    <td class="value">
-                        <input id="ftp_host" name="ftp_host" value="<?php echo($this->get('ftp_host'));?>" class="input-text" type="text"></input>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">FTP Login:</td>
-                    <td class="value">
-                        <input id="ftp_login" name="ftp_login" value="<?php echo($this->get('ftp_login'));?>" class="input-text" type="text"></input>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">FTP Password:</td>
-                    <td class="value">
-                        <input id="ftp_password" name="ftp_password" value="<?php echo($this->get('ftp_password'));?>" class="input-text" type="password"></input>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="label">Installation Path:</td>
-                    <td class="value">
-                        <input id="ftp_path" name="ftp_path" value="<?php echo($this->get('ftp_path'));?>" class="input-text" type="text"></input>
-                    </td>
-                </tr>
-            </table>
-
-            <p><button type="submit">Save Settings</button></p>
-        </fieldset>
-    </form>
-</div>
-
-<?php echo $this->template('footer.phtml') ?>
-
diff --git a/downloader/template/writable.phtml b/downloader/template/writable.phtml
deleted file mode 100644
index 2d13cf9176a426012961c84a006f43d7b88e5f01..0000000000000000000000000000000000000000
--- a/downloader/template/writable.phtml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-?>
-<div class="error-msg">
-    <h4>Warning: Your Magento folder does not have sufficient write permissions.</h4>
-</div>
-
-<p>
-    If you wish to proceed downloading Magento packages online, please set all Magento folders to
-have writable permission for the web server user (example: apache) or set up FTP Connection on the 
-Magento Connect Manager <a href="<?php echo $this->url('settings')?>">Settings</a> tab.
-</p>
diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php
index 14cdde47f814fc543dbf6cddf0664e75957d52d3..b3124782474f9130194eac121c7792b2b67ea8e0 100644
--- a/lib/internal/Magento/Framework/AppInterface.php
+++ b/lib/internal/Magento/Framework/AppInterface.php
@@ -35,7 +35,7 @@ interface AppInterface
     /**
      * Magento version
      */
-    const VERSION = '2.0.0.0-dev88';
+    const VERSION = '0.1.0-alpha89';
 
     /**
      * Launch application
diff --git a/lib/internal/Magento/Framework/Code/Generator/Io.php b/lib/internal/Magento/Framework/Code/Generator/Io.php
index 7be6fae6d81971088c50723e624d8f83b6e41020..1ef24819b9b52f5eb9304cbe04385638c87f7845 100644
--- a/lib/internal/Magento/Framework/Code/Generator/Io.php
+++ b/lib/internal/Magento/Framework/Code/Generator/Io.php
@@ -164,7 +164,9 @@ class Io
             return true;
         }
         try {
-            $this->filesystemDriver->createDirectory($directory, self::DIRECTORY_PERMISSION);
+            if (!$this->filesystemDriver->isDirectory($directory)) {
+                $this->filesystemDriver->createDirectory($directory, self::DIRECTORY_PERMISSION);
+            }
             return true;
         } catch (\Magento\Framework\Filesystem\FilesystemException $e) {
             return false;
diff --git a/lib/internal/Magento/Framework/Connect/Channel/VO.php b/lib/internal/Magento/Framework/Connect/Channel/VO.php
deleted file mode 100644
index 5323eb0607eb4bf4db3ec9c0467e4c5ff3354401..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Channel/VO.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Channel;
-
-use Magento\Framework\Connect\Validator;
-
-class VO implements \Iterator
-{
-    /**
-     * @var Validator
-     */
-    private $_validator = null;
-
-    /**
-     * @var array
-     */
-    protected $properties = array('name' => '', 'uri' => '', 'summary' => '');
-
-    /**
-     * @return void
-     */
-    public function rewind()
-    {
-        reset($this->properties);
-    }
-
-    /**
-     * @return bool
-     */
-    public function valid()
-    {
-        return current($this->properties) !== false;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function key()
-    {
-        return key($this->properties);
-    }
-
-    /**
-     * @return mixed
-     */
-    public function current()
-    {
-        return current($this->properties);
-    }
-
-    /**
-     * @return void
-     */
-    public function next()
-    {
-        next($this->properties);
-    }
-
-    /**
-     * @param string $var
-     * @return null|string
-     */
-    public function __get($var)
-    {
-        if (isset($this->properties[$var])) {
-            return $this->properties[$var];
-        }
-        return null;
-    }
-
-    /**
-     * @param string $var
-     * @param string|null $value
-     * @return void
-     */
-    public function __set($var, $value)
-    {
-        if (is_string($value)) {
-            $value = trim($value);
-        }
-        if (isset($this->properties[$var])) {
-            if ($value === null) {
-                $value = '';
-            }
-            $this->properties[$var] = $value;
-        }
-    }
-
-    /**
-     * @return array
-     */
-    public function toArray()
-    {
-        return array('channel' => $this->properties);
-    }
-
-    /**
-     * @param array $arr
-     * @return void
-     */
-    public function fromArray(array $arr)
-    {
-        foreach ($arr as $k => $v) {
-            $this->{$k} = $v;
-        }
-    }
-
-    /**
-     * @return Validator
-     */
-    private function validator()
-    {
-        if (is_null($this->_validator)) {
-            $this->_validator = new Validator();
-        }
-        return $this->_validator;
-    }
-
-    /**
-     * Stub for validation result
-     *
-     * @return bool
-     */
-    public function validate()
-    {
-        $v = $this->validator();
-        if (!$v->validatePackageName($this->name)) {
-            return false;
-        }
-        return true;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command.php b/lib/internal/Magento/Framework/Connect/Command.php
deleted file mode 100644
index a5dd20c163be57596b44b0d573eccb9f497f5049..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command.php
+++ /dev/null
@@ -1,427 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-class Command
-{
-    /**
-     * All commands list
-     * @var array
-     */
-    protected static $_commandsAll = array();
-
-    /**
-     * Commands list hash (key=class)
-     * @var array
-     */
-    protected static $_commandsByClass = array();
-
-    /**
-     * Frontend object
-     * @var \Magento\Framework\Connect\Frontend
-     */
-    protected static $_frontend = null;
-
-    /**
-     * @var Config
-     */
-    protected static $_config = null;
-
-    /**
-     * @var mixed
-     */
-    protected static $_registry = null;
-
-    /**
-     * @var Validator
-     */
-    protected static $_validator = null;
-
-    /**
-     * @var Rest
-     */
-    protected static $_rest = null;
-
-    /**
-     * @var Singleconfig
-     */
-    protected static $_sconfig = null;
-
-    /**
-     * @var mixed
-     */
-    protected $_data;
-
-    /**
-     * String name of this class
-     *
-     * @var string
-     */
-    protected $_class;
-
-    /**
-     * @var \Magento\Framework\Connect\Packager
-     */
-    protected static $_packager = null;
-
-    /**
-     * @var array
-     */
-    protected static $_return = array();
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $class = $this->_class = get_class($this);
-        if (__CLASS__ == $class) {
-            throw new \Exception("You shouldn't instantiate {$class} directly!");
-        }
-        $this->commandsInfo = self::$_commandsByClass[$class];
-    }
-
-    /**
-     * Get command info (static)
-     * @param string $name command name
-     * @return array|bool
-     */
-    public static function commandInfo($name)
-    {
-        $name = strtolower($name);
-        if (!isset(self::$_commandsAll[$name])) {
-            return false;
-        }
-        return self::$_commandsAll[$name];
-    }
-
-    /**
-     * Get command info for current command object
-     * @param string $name
-     * @return array|bool
-     */
-    public function getCommandInfo($name)
-    {
-        if (!isset(self::$_commandsByClass[$this->_class][$name])) {
-            return false;
-        }
-        return self::$_commandsByClass[$this->_class][$name];
-    }
-
-    /**
-     * Run command
-     * @param string $command
-     * @param string $options
-     * @param string $params
-     * @throws \Exception If there's no needed method
-     * @return mixed
-     */
-    public function run($command, $options, $params)
-    {
-        $data = $this->getCommandInfo($command);
-        $method = $data['function'];
-        if (!method_exists($this, $method)) {
-            throw new \Exception("{$method} can not be executed in class " . $this->_class);
-        }
-        return $this->{$method}($command, $options, $params);
-    }
-
-    /**
-     * Static functions
-     */
-
-    /**
-     * Static
-     * @param string $commandName
-     * @return object
-     * @throws \UnexpectedValueException
-     */
-    public static function getInstance($commandName)
-    {
-        if (!isset(self::$_commandsAll[$commandName])) {
-            throw new \UnexpectedValueException("Cannot find command {$commandName}");
-        }
-        $currentCommand = self::$_commandsAll[$commandName];
-        return new $currentCommand['class']();
-    }
-
-    /**
-     * @param Singleconfig $obj
-     * @return void
-     */
-    public static function setSconfig($obj)
-    {
-        self::$_sconfig = $obj;
-    }
-
-    /**
-     *
-     * @return Singleconfig
-     */
-    public function getSconfig()
-    {
-        return self::$_sconfig;
-    }
-
-    /**
-     * Sets frontend object for all commands
-     *
-     * @param \Magento\Framework\Connect\Frontend $obj
-     * @return void
-     */
-    public static function setFrontendObject($obj)
-    {
-        self::$_frontend = $obj;
-    }
-
-    /**
-     * Set config object for all commands
-     *
-     * @param Config $obj
-     * @return void
-     */
-    public static function setConfigObject($obj)
-    {
-        self::$_config = $obj;
-    }
-
-    /**
-     * Non-static getter for config
-     *
-     * @return Config
-     */
-    public function config()
-    {
-        return self::$_config;
-    }
-
-    /**
-     * Non-static getter for UI
-     * @return \Magento\Framework\Connect\Frontend
-     */
-    public function ui()
-    {
-        return self::$_frontend;
-    }
-
-    /**
-     * Get validator object
-     *
-     * @return Validator
-     */
-    public function validator()
-    {
-        if (is_null(self::$_validator)) {
-            self::$_validator = new Validator();
-        }
-        return self::$_validator;
-    }
-
-    /**
-     * Get rest object
-     *
-     * @return Rest
-     */
-    public function rest()
-    {
-        if (is_null(self::$_rest)) {
-            self::$_rest = new Rest(self::config()->protocol);
-        }
-        return self::$_rest;
-    }
-
-    /**
-     * Get commands list sorted
-     * @return array
-     */
-    public static function getCommands()
-    {
-        if (!count(self::$_commandsAll)) {
-            self::registerCommands();
-        }
-        ksort(self::$_commandsAll);
-        return self::$_commandsAll;
-    }
-
-    /**
-     * Get Getopt args from command definitions
-     * and parse them
-     * @param string $command
-     * @return array|void
-     */
-    public static function getGetoptArgs($command)
-    {
-        $commandInfo = self::commandInfo($command);
-        $short_args = '';
-        $long_args = array();
-        if (empty($commandInfo) || empty($commandInfo['options'])) {
-            return;
-        }
-        reset($commandInfo['options']);
-        while (list($option, $info) = each($commandInfo['options'])) {
-            $larg = $sarg = '';
-            if (isset($info['arg'])) {
-                if ($info['arg'][0] == '(') {
-                    $larg = '==';
-                    $sarg = '::';
-                    $arg = substr($info['arg'], 1, -1);
-                } else {
-                    $larg = '=';
-                    $sarg = ':';
-                    $arg = $info['arg'];
-                }
-            }
-            if (isset($info['shortopt'])) {
-                $short_args .= $info['shortopt'] . $sarg;
-            }
-            $long_args[] = $option . $larg;
-        }
-        return array($short_args, $long_args);
-    }
-
-    /**
-     * Try to register commands automatically
-     * @return void
-     */
-    public static function registerCommands()
-    {
-        $pathCommands = __DIR__ . '/' . basename(__FILE__, ".php");
-        $f = new \DirectoryIterator($pathCommands);
-        foreach ($f as $file) {
-            if (!$file->isFile()) {
-                continue;
-            }
-            $pattern = preg_match("/(.*)_Header\.php/imsu", $file->getFilename(), $matches);
-            if (!$pattern) {
-                continue;
-            }
-            include $file->getPathname();
-            if (!isset($commands)) {
-                continue;
-            }
-            $class = __CLASS__ . "_" . $matches[1];
-            foreach ($commands as $k => $v) {
-                $commands[$k]['class'] = $class;
-                self::$_commandsAll[$k] = $commands[$k];
-            }
-            self::$_commandsByClass[$class] = $commands;
-        }
-    }
-
-    /**
-     * @param string $command
-     * @param string $message
-     * @return void
-     */
-    public function doError($command, $message)
-    {
-        return $this->ui()->doError($command, $message);
-    }
-
-    /**
-     * Set command return
-     * @param string $key
-     * @param mixed $val
-     * @return void
-     */
-    public static function setReturn($key, $val)
-    {
-        self::$_return[$key] = $val;
-    }
-
-    /**
-     * Get command return
-     * @param string $key
-     * @param bool $clear
-     * @return array|null
-     */
-    public static function getReturn($key, $clear = true)
-    {
-        if (isset(self::$_return[$key])) {
-            $out = self::$_return[$key];
-            if ($clear) {
-                unset(self::$_return[$key]);
-            }
-            return $out;
-        }
-        return null;
-    }
-
-    /**
-     * Cleanup command params from empty strings
-     *
-     * @param array &$params by reference
-     * @return void
-     */
-    public function cleanupParams(array &$params)
-    {
-        $newParams = array();
-        if (!count($params)) {
-            return;
-        }
-        foreach ($params as $k => $v) {
-            if (is_string($v)) {
-                $v = trim($v);
-                if (!strlen($v)) {
-                    continue;
-                }
-            }
-            $newParams[] = $v;
-        }
-        $params = $newParams;
-    }
-
-    /**
-     * Splits first command argument: channel/package
-     * to two arguments if found in top of array
-     *
-     * @param array &$params
-     * @return void
-     */
-    public function splitPackageArgs(array &$params)
-    {
-        if (!count($params) || !isset($params[0])) {
-            return;
-        }
-        if ($this->validator()->validateUrl($params[0])) {
-            return;
-        }
-        if (preg_match("@([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)@ims", $params[0], $subs)) {
-            $params[0] = $subs[2];
-            array_unshift($params, $subs[1]);
-        }
-    }
-
-    /**
-     * Get packager instance
-     * @return \Magento\Framework\Connect\Packager
-     */
-    public function getPackager()
-    {
-        if (!self::$_packager) {
-            self::$_packager = new \Magento\Framework\Connect\Packager();
-        }
-        return self::$_packager;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Channels.php b/lib/internal/Magento/Framework/Connect/Command/Channels.php
deleted file mode 100644
index fd5e95174de9726d4415db16fca98decd439a438..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Channels.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Channels extends \Magento\Framework\Connect\Command
-{
-    /**
-     * List available channels
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doList($command, $options, $params)
-    {
-
-        try {
-            $title = "Available channels:";
-            $aliasT = "Available aliases:";
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $data = $cache->getData();
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-                $data = $cache->getData();
-            }
-            $out = array($command => array('data' => $data, 'title' => $title, 'title_aliases' => $aliasT));
-            $this->ui()->output($out);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Channel-delete callback method
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doDelete($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) != 1) {
-                throw new \Exception("Parameters count should be equal to 1");
-            }
-            $packager = $this->getPackager();
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $cache->deleteChannel($params[0]);
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            } else {
-                $config = $this->config();
-                $cache = $this->getSconfig();
-                $cache->deleteChannel($params[0]);
-            }
-            $this->ui()->output("Successfully deleted");
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Channel-add callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doAdd($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) != 1) {
-                throw new \Exception("Parameters count should be equal to 1");
-            }
-            $url = $params[0];
-            $rest = $this->rest();
-            $rest->setChannel($url);
-            $data = $rest->getChannelInfo();
-            $data->url = $url;
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $cache->addChannel($data->name, $url);
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-                $cache->addChannel($data->name, $url);
-            }
-
-            $this->ui()->output("Successfully added: " . $url);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Get information about given channel callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doInfo($command, $options, $params)
-    {
-    }
-
-    /**
-     * Channel-alias
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doAlias($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) != 2) {
-                throw new \Exception("Parameters count should be equal to 2");
-            }
-
-            $packager = $this->getPackager();
-            $chanUrl = $params[0];
-            $alias = $params[1];
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-                $cache->addChannelAlias($chanUrl, $alias);
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-                $cache->addChannelAlias($chanUrl, $alias);
-            }
-            $this->ui()->output("Successfully added: " . $alias);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doLogin($command, $options, $params)
-    {
-    }
-
-    /**
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doLogout($command, $options, $params)
-    {
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Channels_Header.php b/lib/internal/Magento/Framework/Connect/Command/Channels_Header.php
deleted file mode 100644
index 3e119c714d05f0a050a7987877867a88d663aec3..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Channels_Header.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'list-channels' => array(
-        'summary' => 'List Available Channels',
-        'function' => 'doList',
-        'shortcut' => 'lc',
-        'options' => array(),
-        'doc' => '
-List all available channels for installation.
-'
-    ),
-    'channel-delete' => array(
-        'summary' => 'Remove a Channel From the List',
-        'function' => 'doDelete',
-        'shortcut' => 'cde',
-        'options' => array(),
-        'doc' => '<channel name>
-Delete a channel from the registry.  You may not
-remove any channel that has installed packages.
-'
-    ),
-    'channel-add' => array(
-        'summary' => 'Add a Channel',
-        'function' => 'doAdd',
-        'shortcut' => 'ca',
-        'options' => array(),
-        'doc' => '<channel.xml>
-Add a private channel to the channel list.  Note that all
-public channels should be synced using "update-channels".
-Parameter may be either a local file or remote URL to a
-channel.xml.
-'
-    ),
-    'channel-info' => array(
-        'summary' => 'Retrieve Information on a Channel',
-        'function' => 'doInfo',
-        'shortcut' => 'ci',
-        'options' => array(),
-        'doc' => '<package>
-List the files in an installed package.
-'
-    ),
-    'channel-alias' => array(
-        'summary' => 'Specify an alias to a channel name',
-        'function' => 'doAlias',
-        'shortcut' => 'cha',
-        'options' => array(),
-        'doc' => '<channel> <alias>
-Specify a specific alias to use for a channel name.
-The alias may not be an existing channel name or
-alias.
-'
-    ),
-    'channel-login' => array(
-        'summary' => 'Connects and authenticates to remote channel server',
-        'shortcut' => 'cli',
-        'function' => 'doLogin',
-        'options' => array(),
-        'doc' => '<channel name>
-Log in to a remote channel server.  If <channel name> is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first.  The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems).  After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.'
-    ),
-    'channel-logout' => array(
-        'summary' => 'Logs out from the remote channel server',
-        'shortcut' => 'clo',
-        'function' => 'doLogout',
-        'options' => array(),
-        'doc' => '<channel name>
-Logs out from a remote channel server.  If <channel name> is not supplied,
-the default channel is used. This command does not actually connect to the
-remote server, it only deletes the stored username and password from your user
-configuration.'
-    )
-);
diff --git a/lib/internal/Magento/Framework/Connect/Command/Config.php b/lib/internal/Magento/Framework/Connect/Command/Config.php
deleted file mode 100644
index 27bc4ca9c2d4b0c0deb1bcefe5f5803691936f7f..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Config.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-class Config extends \Magento\Framework\Connect\Command
-{
-    const PARAM_KEY = 0;
-
-    const PARAM_VAL = 1;
-
-    /**
-     * Show config variable
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doConfigShow($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            $values = array();
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-            foreach ($config as $k => $v) {
-                $values[$k] = $v;
-            }
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            $data = array($command => array('data' => $values));
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Set config variable
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doConfigSet($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            if (count($params) < 2) {
-                throw new \Exception("Parameters count should be >= 2");
-            }
-            $key = strtolower($params[self::PARAM_KEY]);
-            $val = strval($params[self::PARAM_VAL]);
-            $packager = $this->getPackager();
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-
-            if (!$config->hasKey($key)) {
-                throw new \Exception("No such config variable: {$key}!");
-            }
-            if (!$config->validate($key, $val)) {
-                $possible = $this->config()->possible($key);
-                $type = $this->config()->type($key);
-                $errString = "Invalid value specified for {$key}!";
-                throw new \Exception($errString);
-            }
-            if ($ftp) {
-                $packager->writeToRemoteConfig($config, $ftpObj);
-            }
-            $this->config()->{$key} = $val;
-            $this->ui()->output('Success');
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Get config var
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doConfigGet($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            if (count($params) < 1) {
-                throw new \Exception("Parameters count should be >= 1");
-            }
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-            $key = strtolower($params[self::PARAM_KEY]);
-            if (!$config->hasKey($key)) {
-                throw new \Exception("No such config variable '{$key}'!");
-            }
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            $this->ui()->output($config->{$key});
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Config help
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doConfigHelp($command, $options, $params)
-    {
-        try {
-            $this->cleanupParams($params);
-            if (count($params) < 1) {
-                throw new \Exception("Parameters count should be >= 1");
-            }
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($config, $ftpObj) = $packager->getRemoteConfig($ftp);
-            } else {
-                $config = $this->config();
-            }
-
-            $key = strtolower($params[self::PARAM_KEY]);
-            if (!$this->config()->hasKey($key)) {
-                throw new \Exception("No such config variable '{$key}'!");
-            }
-
-            $possible = $config->possible($key);
-            $type = $config->type($key);
-            $doc = $config->doc($key);
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            $data = array();
-            $data[$command]['data'] = array(
-                'name' => array('Variable name', $key),
-                'type' => array('Value type', $type),
-                'possible' => array('Possible values', $possible),
-                'doc' => $doc
-            );
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Config_Header.php b/lib/internal/Magento/Framework/Connect/Command/Config_Header.php
deleted file mode 100644
index 2d6892ade0d71801985d22c493559f9de131302d..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Config_Header.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'config-show' => array(
-        'summary' => 'Show All Settings',
-        'function' => 'doConfigShow',
-        'shortcut' => 'csh',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'show configuration variables for another channel',
-                'arg' => 'CHAN'
-            )
-        ),
-        'doc' => '[layer]
-Displays all configuration values.  An optional argument
-may be used to tell which configuration layer to display.  Valid
-configuration layers are "user", "system" and "default". To display
-configurations for different channels, set the default_channel
-configuration variable and run config-show again.
-'
-    ),
-    'config-get' => array(
-        'summary' => 'Show One Setting',
-        'function' => 'doConfigGet',
-        'shortcut' => 'cg',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'show configuration variables for another channel',
-                'arg' => 'CHAN'
-            )
-        ),
-        'doc' => '<parameter> [layer]
-Displays the value of one configuration parameter.  The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in.  Valid configuration
-layers are "user", "system" and "default".  If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified.  The configuration value will be retrieved for the channel
-specified by the default_channel configuration variable.
-'
-    ),
-    'config-set' => array(
-        'summary' => 'Change Setting',
-        'function' => 'doConfigSet',
-        'shortcut' => 'cs',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'show configuration variables for another channel',
-                'arg' => 'CHAN'
-            )
-        ),
-        'doc' => '<parameter> <value> [layer]
-Sets the value of one configuration parameter.  The first argument is
-the name of the parameter, the second argument is the new value.  Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense.  An optional
-third argument may be used to specify in which layer to set the
-configuration parameter.  The default layer is "user".  The
-configuration value will be set for the current channel, which
-is controlled by the default_channel configuration variable.
-'
-    ),
-    'config-help' => array(
-        'summary' => 'Show Information About Setting',
-        'function' => 'doConfigHelp',
-        'shortcut' => 'ch',
-        'options' => array(),
-        'doc' => '[parameter]
-Displays help for a configuration parameter.  Without arguments it
-displays help for all configuration parameters.
-'
-    )
-);
diff --git a/lib/internal/Magento/Framework/Connect/Command/Install.php b/lib/internal/Magento/Framework/Connect/Command/Install.php
deleted file mode 100644
index a9c763d1793dfdf699cba09a71e94fbbad6d7294..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Install.php
+++ /dev/null
@@ -1,468 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Install extends \Magento\Framework\Connect\Command
-{
-    /**
-     * Install action callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @param array $objects
-     * @return array
-     */
-    public function doInstall($command, $options, $params, $objects = array())
-    {
-        $this->cleanupParams($params);
-
-        $installFileMode = $command === 'install-file';
-
-
-
-
-        try {
-            $packager = $this->getPackager();
-            $forceMode = isset($options['force']);
-            $upgradeAllMode = $command == 'upgrade-all';
-            $upgradeMode = $command == 'upgrade' || $command == 'upgrade-all';
-            $noFilesInstall = isset($options['nofiles']);
-            $withDepsMode = !isset($options['nodeps']);
-            $ignoreModifiedMode = true || !isset($options['ignorelocalmodification']);
-
-            $rest = $this->rest();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $config = $this->config();
-                $cache = $this->getSconfig();
-            }
-            if ($installFileMode) {
-                if (count($params) < 1) {
-                    throw new \Exception("Argument should be: filename");
-                }
-                $filename = $params[0];
-                if (!@file_exists($filename)) {
-                    throw new \Exception("File '{$filename}' not found");
-                }
-                if (!@is_readable($filename)) {
-                    throw new \Exception("File '{$filename}' is not readable");
-                }
-
-                $package = new \Magento\Framework\Connect\Package($filename);
-                $package->validate();
-                $errors = $package->getErrors();
-                if (count($errors)) {
-                    throw new \Exception("Package file is invalid\n" . implode("\n", $errors));
-                }
-
-                $pChan = $package->getChannel();
-                $pName = $package->getName();
-                $pVer = $package->getVersion();
-
-
-                if (!$cache->isChannel($pChan)) {
-                    throw new \Exception("'{$pChan}' is not installed channel");
-                }
-
-                $conflicts = $cache->hasConflicts($pChan, $pName, $pVer);
-
-                if (false !== $conflicts) {
-                    $conflicts = implode(", ", $conflicts);
-                    if ($forceMode) {
-                        $this->doError($command, "Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
-                    } else {
-                        throw new \Exception("Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
-                    }
-                }
-
-                $conflicts = $package->checkPhpDependencies();
-                if (true !== $conflicts) {
-                    $confilcts = implode(",", $conflicts);
-                    $err = "Package {$pChan}/{$pName} {$pVer} depends on PHP extensions: " . $conflicts;
-                    if ($forceMode) {
-                        $this->doError($command, $err);
-                    } else {
-                        throw new \Exception($err);
-                    }
-                }
-
-                $conflicts = $package->checkPhpVersion();
-                if (true !== $conflicts) {
-                    $err = "Package {$pChan}/{$pName} {$pVer}: " . $conflicts;
-                    if ($forceMode) {
-                        $this->doError($command, $err);
-                    } else {
-                        throw new \Exception($err);
-                    }
-                }
-
-
-                if (!$noFilesInstall) {
-                    if ($ftp) {
-                        $packager->processInstallPackageFtp($package, $filename, $config, $ftpObj);
-                    } else {
-                        $packager->processInstallPackage($package, $filename, $config);
-                    }
-                }
-                $cache->addPackage($package);
-                $installedDeps = array();
-                $installedDepsAssoc = array();
-                $installedDepsAssoc[] = array('channel' => $pChan, 'name' => $pName, 'version' => $pVer);
-                $installedDeps[] = array($pChan, $pName, $pVer);
-
-
-                $title = isset($options['title']) ? $options['title'] : "Package installed: ";
-                $out = array(
-                    $command => array('data' => $installedDeps, 'assoc' => $installedDepsAssoc, 'title' => $title)
-                );
-
-                if ($ftp) {
-                    $packager->writeToRemoteCache($cache, $ftpObj);
-                    @unlink($config->getFilename());
-                }
-
-                $this->ui()->output($out);
-                return $out[$command]['data'];
-            }
-
-            if (!$upgradeAllMode) {
-
-                if (count($params) < 2) {
-                    throw new \Exception("Argument should be: channelName packageName");
-                }
-                $channel = $params[0];
-                $package = $params[1];
-                $argVersionMax = isset($params[2]) ? $params[2] : false;
-                $argVersionMin = false;
-
-                if ($cache->isChannelName($channel)) {
-                    $uri = $cache->chanUrl($channel);
-                } elseif ($this->validator()->validateUrl($channel)) {
-                    $uri = $channel;
-                } elseif ($channel) {
-                    $uri = $config->protocol . '://' . $channel;
-                } else {
-                    throw new \Exception("'{$channel}' is not existant channel name / valid uri");
-                }
-
-                if ($uri && !$cache->isChannel($uri)) {
-                    $rest->setChannel($uri);
-                    $data = $rest->getChannelInfo();
-                    $data->uri = $uri;
-                    $cache->addChannel($data->name, $uri);
-                    $this->ui()->output("Successfully added channel: " . $uri);
-                }
-                $channelName = $cache->chanName($channel);
-                //var_dump($channelName);
-                $packagesToInstall = $packager->getDependenciesList(
-                    $channelName,
-                    $package,
-                    $cache,
-                    $config,
-                    $argVersionMax,
-                    $argVersionMin,
-                    $withDepsMode
-                );
-                $packagesToInstall = $packagesToInstall['result'];
-                //var_dump($packagesToInstall);
-            } else {
-                if (empty($params[0])) {
-                    $channels = $cache->getChannelNames();
-                } else {
-                    $channel = $params[0];
-                    if (!$cache->isChannel($channel)) {
-                        throw new \Exception("'{$channel}' is not existant channel name / valid uri");
-                    }
-                    $channels = $cache->chanName($channel);
-                }
-                $packagesToInstall = array();
-                $neededToUpgrade = $packager->getUpgradesList($channels, $cache, $config);
-                foreach ($neededToUpgrade as $chan => $packages) {
-                    foreach ($packages as $name => $data) {
-                        $versionTo = $data['to'];
-                        $tmp = $packager->getDependenciesList(
-                            $chan,
-                            $name,
-                            $cache,
-                            $config,
-                            $versionTo,
-                            $versionTo,
-                            $withDepsMode
-                        );
-                        if (count($tmp['result'])) {
-                            $packagesToInstall = array_merge($packagesToInstall, $tmp['result']);
-                        }
-                    }
-                }
-            }
-
-            /**
-             * Make installation
-             */
-            $installedDeps = array();
-            $installedDepsAssoc = array();
-            $keys = array();
-
-            foreach ($packagesToInstall as $package) {
-                try {
-                    $pName = $package['name'];
-                    $pChan = $package['channel'];
-                    $pVer = $package['downloaded_version'];
-                    $rest->setChannel($cache->chanUrl($pChan));
-
-                    /**
-                     * Upgrade mode
-                     */
-                    if ($upgradeMode && $cache->hasPackage($pChan, $pName, $pVer, $pVer)) {
-                        $this->ui()->output("Already installed: {$pChan}/{$pName} {$pVer}, skipping");
-                        continue;
-                    }
-
-                    $conflicts = $cache->hasConflicts($pChan, $pName, $pVer);
-
-                    if (false !== $conflicts) {
-                        $conflicts = implode(", ", $conflicts);
-                        if ($forceMode) {
-                            $this->doError(
-                                $command,
-                                "Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts
-                            );
-                        } else {
-                            throw new \Exception("Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
-                        }
-                    }
-
-
-                    /**
-                     * Modifications
-                     */
-                    if ($upgradeMode && !$ignoreModifiedMode) {
-                        if ($ftp) {
-                            $modifications = $packager->getRemoteModifiedFiles($pChan, $pName, $cache, $config, $ftp);
-                        } else {
-                            $modifications = $packager->getLocalModifiedFiles($pChan, $pName, $cache, $config);
-                        }
-                        if (count($modifications) > 0) {
-                            $this->ui()->output('Changed locally: ');
-                            foreach ($modifications as $row) {
-                                if (!$ftp) {
-                                    $this->ui()->output($config->magento_root . '/' . $row);
-                                } else {
-                                    $this->ui()->output($row);
-                                }
-                            }
-                            /*$this->ui()->confirm('Do you want rewrite all files?');
-                             continue;*/
-                        }
-                    }
-
-                    $dir = $config->getChannelCacheDir($pChan);
-                    @mkdir($dir, 0777, true);
-                    $file = $dir . '/' . $pName . "-" . $pVer . ".tgz";
-                    if (!@file_exists($file)) {
-                        $rest->downloadPackageFileOfRelease($pName, $pVer, $file);
-                    }
-                    $package = new \Magento\Framework\Connect\Package($file);
-
-
-
-                    $conflicts = $package->checkPhpDependencies();
-                    if (true !== $conflicts) {
-                        $confilcts = implode(",", $conflicts);
-                        $err = "Package {$pChan}/{$pName} {$pVer} depends on PHP extensions: " . $conflicts;
-                        if ($forceMode) {
-                            $this->doError($command, $err);
-                        } else {
-                            throw new \Exception($err);
-                        }
-                    }
-
-                    $conflicts = $package->checkPhpVersion();
-                    if (true !== $conflicts) {
-                        $err = "Package {$pChan}/{$pName} {$pVer}: " . $conflicts;
-                        if ($forceMode) {
-                            $this->doError($command, $err);
-                        } else {
-                            throw new \Exception($err);
-                        }
-                    }
-
-                    if (!$noFilesInstall) {
-                        if ($ftp) {
-                            $packager->processInstallPackageFtp($package, $file, $config, $ftpObj);
-                        } else {
-                            $packager->processInstallPackage($package, $file, $config);
-                        }
-                    }
-                    $cache->addPackage($package);
-
-                    $installedDepsAssoc[] = array('channel' => $pChan, 'name' => $pName, 'version' => $pVer);
-                    $installedDeps[] = array($pChan, $pName, $pVer);
-                } catch (\Exception $e) {
-                    $this->doError($command, $e->getMessage());
-                }
-            }
-
-
-
-            $title = isset($options['title']) ? $options['title'] : "Package installed: ";
-            $out = array(
-                $command => array('data' => $installedDeps, 'assoc' => $installedDepsAssoc, 'title' => $title)
-            );
-
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-
-            $this->ui()->output($out);
-            return $out[$command]['data'];
-        } catch (\Exception $e) {
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Upgrade action callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return array
-     */
-    public function doUpgrade($command, $options, $params)
-    {
-        $options['title'] = "Package upgraded: ";
-        return $this->doInstall($command, $options, $params);
-    }
-
-    /**
-     * Updgrade action callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return array
-     */
-    public function doUpgradeAll($command, $options, $params)
-    {
-        $options['title'] = "Package upgraded: ";
-        return $this->doInstall($command, $options, $params);
-    }
-
-    /**
-     * Uninstall package callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param array $params
-     * @return void
-     */
-    public function doUninstall($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-
-        try {
-            if (count($params) != 2) {
-                throw new \Exception("Argument count should be = 2");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-            $packager = $this->getPackager();
-            $withDepsMode = !isset($options['nodeps']);
-            $forceMode = isset($options['force']);
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            $chan = $cache->getChannel($channel);
-            $channel = $cache->chanName($channel);
-            if (!$cache->hasPackage($channel, $package)) {
-                throw new \Exception("Package is not installed");
-            }
-
-            $deletedPackages = array();
-            $list = $packager->getUninstallList($channel, $package, $cache, $config, $withDepsMode);
-            foreach ($list['list'] as $packageData) {
-                try {
-                    $reqd = $cache->requiredByOtherPackages(
-                        $packageData['channel'],
-                        $packageData['name'],
-                        $list['list']
-                    );
-                    if (count($reqd)) {
-                        $errMessage = "{$packageData['channel']}/{$packageData['name']} {$packageData['version']} is required by: ";
-                        $t = array();
-                        foreach ($reqd as $r) {
-                            $t[] = $r['channel'] . "/" . $r['name'] . " " . $r['version'];
-                        }
-                        $errMessage .= implode(", ", $t);
-                        if ($forceMode) {
-                            $this->ui()->output("Warning: " . $errMessage);
-                        } else {
-                            throw new \Exception($errMessage);
-                        }
-                    }
-
-                    list($chan, $pack) = array($packageData['channel'], $packageData['name']);
-                    if ($ftp) {
-                        $packager->processUninstallPackageFtp($chan, $pack, $cache, $config, $ftp);
-                    } else {
-                        $packager->processUninstallPackage($chan, $pack, $cache, $config);
-                    }
-                    $cache->deletePackage($chan, $pack);
-                    $deletedPackages[] = array($chan, $pack);
-                } catch (\Exception $e) {
-                    if ($forceMode) {
-                        $this->doError($command, $e->getMessage());
-                    } else {
-                        throw new \Exception($e->getMessage());
-                    }
-                }
-            }
-            if ($ftp) {
-                $packager->writeToRemoteCache($cache, $ftpObj);
-                @unlink($config->getFilename());
-            }
-            $out = array($command => array('data' => $deletedPackages, 'title' => 'Package deleted: '));
-            $this->ui()->output($out);
-        } catch (\Exception $e) {
-            return $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Install_Header.php b/lib/internal/Magento/Framework/Connect/Command/Install_Header.php
deleted file mode 100644
index da341457f642546ef9a5a8d8c4370caaf17c1944..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Install_Header.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'install-file' => array(
-        'summary' => 'Install Package Archive File',
-        'function' => 'doInstall',
-        'shortcut' => 'if',
-        'options' => array(),
-        'doc' => ''
-    ),
-    'install' => array(
-        'summary' => 'Install Package',
-        'function' => 'doInstall',
-        'shortcut' => 'i',
-        'options' => array(
-            'force' => array('shortopt' => 'f', 'doc' => 'will overwrite newer installed packages'),
-            'loose' => array('shortopt' => 'l', 'doc' => 'do not check for recommended dependency version'),
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, install anyway'),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'alldeps' => array('shortopt' => 'a', 'doc' => 'install all required and optional dependencies'),
-            'pretend' => array('shortopt' => 'p', 'doc' => 'Only list the packages that would be downloaded'),
-            'ftp=' => array('shortopt' => 'r=', 'doc' => 'Remote side FTP connect string')
-        ),
-        'doc' => '[channel/]<package> ...
-Installs one or more PEAR packages.  You can specify a package to
-install in four ways:
-
-"Package-1.0.tgz" : installs from a local file
-
-"http://example.com/Package-1.0.tgz" : installs from
-anywhere on the net.
-
-"package.xml" : installs the package described in
-package.xml.  Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-"Package[-version/state][.tar]" : queries your default channel\'s server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-To retrieve Package version 1.1, use "Package-1.1," to retrieve
-Package state beta, use "Package-beta."  To retrieve an uncompressed
-file, append .tar (make sure there is no file by the same name first)
-
-To download a package from another channel, prefix with the channel name like
-"channel/Package"
-
-More than one package may be specified at once.  It is ok to mix these
-four ways of specifying packages.
-'
-    ),
-    'upgrade' => array(
-        'summary' => 'Upgrade Package',
-        'function' => 'doUpgrade',
-        'shortcut' => 'up',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'upgrade packages from a specific channel',
-                'arg' => 'CHAN'
-            ),
-            'force' => array('shortopt' => 'f', 'doc' => 'overwrite newer installed packages'),
-            'loose' => array('shortopt' => 'l', 'doc' => 'do not check for recommended dependency version'),
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, upgrade anyway'),
-            'register-only' => array(
-                'shortopt' => 'r',
-                'doc' => 'do not install files, only register the package as upgraded'
-            ),
-            'nobuild' => array('shortopt' => 'B', 'doc' => 'don\'t build C extensions'),
-            'nocompress' => array('shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading'),
-            'installroot' => array(
-                'shortopt' => 'R',
-                'arg' => 'DIR',
-                'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)'
-            ),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'alldeps' => array('shortopt' => 'a', 'doc' => 'install all required and optional dependencies'),
-            'onlyreqdeps' => array('shortopt' => 'o', 'doc' => 'install all required dependencies'),
-            'offline' => array('shortopt' => 'O', 'doc' => 'do not attempt to download any urls or contact channels'),
-            'pretend' => array('shortopt' => 'p', 'doc' => 'Only list the packages that would be downloaded')
-        ),
-        'doc' => '<package> ...
-Upgrades one or more PEAR packages.  See documentation for the
-"install" command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-'
-    ),
-    'upgrade-all' => array(
-        'summary' => 'Upgrade All Packages',
-        'function' => 'doUpgradeAll',
-        'shortcut' => 'ua',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'upgrade packages from a specific channel',
-                'arg' => 'CHAN'
-            ),
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, upgrade anyway'),
-            'register-only' => array(
-                'shortopt' => 'r',
-                'doc' => 'do not install files, only register the package as upgraded'
-            ),
-            'nobuild' => array('shortopt' => 'B', 'doc' => 'don\'t build C extensions'),
-            'nocompress' => array('shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading'),
-            'installroot' => array(
-                'shortopt' => 'R',
-                'arg' => 'DIR',
-                'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM'
-            ),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'loose' => array('doc' => 'do not check for recommended dependency version')
-        ),
-        'doc' => '
-WARNING: This function is deprecated in favor of using the upgrade command with no params
-
-Upgrades all packages that have a newer release available.  Upgrades are
-done only if there is a release available of the state specified in
-"preferred_state" (currently {config preferred_state}), or a state considered
-more stable.
-'
-    ),
-    'uninstall' => array(
-        'summary' => 'Un-install Package',
-        'function' => 'doUninstall',
-        'shortcut' => 'un',
-        'options' => array(
-            'nodeps' => array('shortopt' => 'n', 'doc' => 'ignore dependencies, uninstall anyway'),
-            'register-only' => array(
-                'shortopt' => 'r',
-                'doc' => 'do not remove files, only register the packages as not installed'
-            ),
-            'ignore-errors' => array('doc' => 'force install even if there were errors'),
-            'offline' => array('shortopt' => 'O', 'doc' => 'do not attempt to uninstall remotely')
-        ),
-        'doc' => '[channel/]<package> ...
-Uninstalls one or more PEAR packages.  More than one package may be
-specified at once.  Prefix with channel name to uninstall from a
-channel not in your default channel ({config default_channel})
-'
-    )
-);
diff --git a/lib/internal/Magento/Framework/Connect/Command/Package.php b/lib/internal/Magento/Framework/Connect/Command/Package.php
deleted file mode 100644
index 6bb1a83097785c54136a6dde4899c088b66fec37..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Package.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Package extends \Magento\Framework\Connect\Command
-{
-    /**
-     * Dependencies list
-     * @var array
-     */
-    private $_depsList = array();
-
-    /**
-     * Releases list
-     * @var array
-     */
-    private $_releasesList = array();
-
-    /**
-     * Package command callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doPackage($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        if (count($params) < 1) {
-            return $this->doError($command, "Parameters count should be >= 1");
-        }
-
-        $file = strtolower($params[0]);
-        $file = realpath($file);
-
-        if (!file_exists($file)) {
-            return $this->doError($command, "File {$params[0]} doesn't exist");
-        }
-
-        try {
-            $packager = new \Magento\Framework\Connect\Package($file);
-            $res = $packager->validate();
-            if (!$res) {
-                $this->doError($command, implode("\n", $packager->getErrors()));
-                return;
-            }
-            $packager->save(dirname($file));
-            $this->ui()->output('Done building package');
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Display/get dependencies
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doPackageDependencies($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) < 2) {
-                return $this->doError($command, "Argument count should be >= 2");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-
-            $argVersionMin = isset($params[3]) ? $params[3] : false;
-            $argVersionMax = isset($params[2]) ? $params[2] : false;
-
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            $packager = $this->getPackager();
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-            $data = $packager->getDependenciesList(
-                $channel,
-                $package,
-                $cache,
-                $config,
-                $argVersionMax,
-                $argVersionMin
-            );
-            $this->ui()->output(
-                array($command => array('data' => $data['deps'], 'title' => "Package deps for {$params[1]}: "))
-            );
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doConvert($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            if (count($params) < 1) {
-                throw new \Exception("Arguments should be: source.tgz [target.tgz]");
-            }
-            $sourceFile = $params[0];
-            $converter = new \Magento\Framework\Connect\Converter();
-            $targetFile = isset($params[1]) ? $params[1] : false;
-            $result = $converter->convertPearToMage($sourceFile, $targetFile);
-            $this->ui()->output("Saved to: " . $result);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Package_Header.php b/lib/internal/Magento/Framework/Connect/Command/Package_Header.php
deleted file mode 100644
index 682bd67089b1c817d11285cc8ec80792f41ec8c8..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Package_Header.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'package' => array(
-        'summary' => 'Build Package',
-        'function' => 'doPackage',
-        'shortcut' => 'p',
-        'options' => array(
-            'nocompress' => array('shortopt' => 'Z', 'doc' => 'Do not gzip the package file'),
-            'showname' => array('shortopt' => 'n', 'doc' => 'Print the name of the packaged file.')
-        ),
-        'doc' => '[descfile] [descfile2]
-Creates a PEAR package from its description file (usually called
-package.xml).  If a second packagefile is passed in, then
-the packager will check to make sure that one is a package.xml
-version 1.0, and the other is a package.xml version 2.0.  The
-package.xml version 1.0 will be saved as "package.xml" in the archive,
-and the other as "package2.xml" in the archive"
-'
-    ),
-    'package-dependencies' => array(
-        'summary' => 'Show package dependencies',
-        'function' => 'doPackageDependencies',
-        'shortcut' => 'pd',
-        'options' => array(),
-        'doc' => '<package-file> or <package.xml> or <install-package-name>
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.'
-    ),
-    'convert' => array(
-        'summary' => 'Convert old magento PEAR package to new format',
-        'function' => 'doConvert',
-        'shortcut' => 'conv',
-        'options' => array(),
-        'doc' => ''
-    )
-);
diff --git a/lib/internal/Magento/Framework/Connect/Command/Registry.php b/lib/internal/Magento/Framework/Connect/Command/Registry.php
deleted file mode 100644
index 1fb6442ab0e5b81a9fd08bcb46b45ab6e164603f..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Registry.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Registry extends \Magento\Framework\Connect\Command
-{
-    /**
-     * List-installed callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doList($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $ftpObj) = $packager->getRemoteCache($ftp);
-            } else {
-                $cache = $this->getSconfig();
-            }
-            if (!empty($params[0])) {
-                $chanName = $conf->chanName($params[0]);
-                $data = $cache->getInstalledPackages($chanName);
-            } else {
-                $data = $cache->getInstalledPackages();
-            }
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->ui()->output(
-                array($command => array('data' => $data, 'channel-title' => "Installed package for channel '%s' :"))
-            );
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * list-files callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doFileList($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-        try {
-            $channel = false;
-            if (count($params) < 2) {
-                throw new \Exception("Argument count should be = 2");
-            }
-            $channel = $params[0];
-            $package = $params[1];
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $confif = $this->config();
-            }
-            if (!$cache->hasPackage($channel, $package)) {
-                return $this->ui()->output("No package found: {$channel}/{$package}");
-            }
-
-            $p = $cache->getPackageObject($channel, $package);
-            $contents = $p->getContents();
-            if ($ftp) {
-                $ftpObj->close();
-            }
-            if (!count($contents)) {
-                return $this->ui()->output("No contents for package {$package}");
-            }
-            $title = "Contents of '{$package}': ";
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-
-            $this->ui()->output(array($command => array('data' => $contents, 'title' => $title)));
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Installed package info
-     * info command callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doInfo($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-
-        try {
-            $channel = false;
-            if (count($params) < 2) {
-                throw new \Exception("Argument count should be = 2");
-            }
-            $channel = $params[0];
-            $package = $params[1];
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $ftpObj) = $packager->getRemoteCache($ftp);
-            } else {
-                $cache = $this->getSconfig();
-            }
-
-            if (!$cache->isChannel($channel)) {
-                throw new \Exception("'{$channel}' is not a valid installed channel name/uri");
-            }
-            $channelUri = $cache->chanUrl($channel);
-            $rest = $this->rest();
-            $rest->setChannel($channelUri);
-            $releases = $rest->getReleases($package);
-            if (false === $releases) {
-                throw new \Exception("No information found about {$channel}/{$package}");
-            }
-            $data = array($command => array('releases' => $releases));
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Registry_Header.php b/lib/internal/Magento/Framework/Connect/Command/Registry_Header.php
deleted file mode 100644
index efd0a20ff7dd0c4e41c7ace8993459b9ab212b19..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Registry_Header.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'list-installed' => array(
-        'summary' => 'List Installed Packages In The Default Channel',
-        'function' => 'doList',
-        'shortcut' => 'l',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'list installed packages from this channel',
-                'arg' => 'CHAN'
-            ),
-            'allchannels' => array('shortopt' => 'a', 'doc' => 'list installed packages from all channels')
-        ),
-        'doc' => '<package>
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir}).  With a parameter, it
-lists the files in a package.
-'
-    ),
-    'list-files' => array(
-        'summary' => 'List Files In Installed Package',
-        'function' => 'doFileList',
-        'shortcut' => 'fl',
-        'options' => array(),
-        'doc' => '<package>
-List the files in an installed package.
-'
-    ),
-    'info' => array(
-        'summary' => 'Display information about a package',
-        'function' => 'doInfo',
-        'shortcut' => 'in',
-        'options' => array(),
-        'doc' => '<package>
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.'
-    )
-);
diff --git a/lib/internal/Magento/Framework/Connect/Command/Remote.php b/lib/internal/Magento/Framework/Connect/Command/Remote.php
deleted file mode 100644
index 12c3cd60f6f553a6e45122892f69b1b203ec088b..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Remote.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Command;
-
-final class Remote extends \Magento\Framework\Connect\Command
-{
-    /**
-     * List-upgrades callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doListUpgrades($command, $options, $params)
-    {
-
-        $this->cleanupParams($params);
-        try {
-            $packager = new \Magento\Framework\Connect\Packager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            if (!empty($params[0])) {
-                $channels = $params[0];
-                $cache->getChannel($channels);
-            } else {
-                $channels = $cache->getChannelNames();
-            }
-            $ups = $packager->getUpgradesList($channels, $cache, $config);
-
-            if (count($ups)) {
-                $data = array($command => array('data' => $ups));
-            } else {
-                $data = "No upgrades available";
-            }
-            $this->ui()->output($data);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * List available
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doListAvailable($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-
-        try {
-            $packager = new \Magento\Framework\Connect\Packager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            if (!empty($params[0])) {
-                $channels = array($params[0]);
-                $cache->getChannel($channels[0]);
-            } else {
-                $channels = $cache->getChannelNames();
-            }
-
-
-
-            $packs = array();
-            foreach ($channels as $channel) {
-                try {
-                    $chan = $cache->getChannel($channel);
-                    $uri = $cache->chanUrl($channel);
-
-                    $rest = $this->rest();
-                    $rest->setChannel($uri);
-
-                    $packages = $rest->getPackages();
-                    if (!count($packages)) {
-                        $this->ui()->output("Channel '{$channel}' has no packages");
-                        continue;
-                    }
-                    $packs[$channel]['title'] = "Packages for channel '" . $channel . "':";
-                    foreach ($packages as $p) {
-                        $packageName = $p['n'];
-                        $releases = array();
-                        foreach ($p['r'] as $k => $r) {
-                            $releases[$r] = $rest->shortStateToLong($k);
-                        }
-                        $packs[$channel]['packages'][$packageName]['releases'] = $releases;
-                    }
-                } catch (\Exception $e) {
-                    $this->doError($command, $e->getMessage());
-                }
-            }
-            $dataOut = array();
-            $dataOut[$command] = array('data' => $packs);
-            $this->ui()->output($dataOut);
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Download command callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doDownload($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        //$this->splitPackageArgs($params);
-        try {
-            if (count($params) < 2) {
-                throw new \Exception("Arguments should be: channel Package");
-            }
-
-            $channel = $params[0];
-            $package = $params[1];
-
-            $packager = $this->getPackager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
-            } else {
-                $cache = $this->getSconfig();
-                $config = $this->config();
-            }
-
-            $chan = $cache->getChannel($channel);
-            $uri = $cache->chanUrl($channel);
-
-            $rest = $this->rest();
-            $rest->setChannel($uri);
-            $c = $rest->getReleases($package);
-            if (!count($c)) {
-                throw new \Exception("No releases found for package");
-            }
-            $version = $cache->detectVersionFromRestArray($c);
-            $dir = $config->getChannelCacheDir($channel);
-            $file = $dir . '/' . $package . "-" . $version . ".tgz";
-            $rest->downloadPackageFileOfRelease($package, $version, $file);
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-            $this->ui()->output("Saved to: " . $file);
-        } catch (\Exception $e) {
-            if ($ftp) {
-                @unlink($config->getFilename());
-                @unlink($cache->getFilename());
-            }
-            $this->doError($command, $e->getMessage());
-        }
-    }
-
-    /**
-     * Clear cache command callback
-     *
-     * @param string $command
-     * @param array $options
-     * @param string[] $params
-     * @return void
-     */
-    public function doClearCache($command, $options, $params)
-    {
-        $this->cleanupParams($params);
-        try {
-            $packager = new \Magento\Framework\Connect\Packager();
-            $ftp = empty($options['ftp']) ? false : $options['ftp'];
-            if ($ftp) {
-                list($cache, $ftpObj) = $packager->getRemoteCache($ftp);
-                $cache->clear();
-                $packager->writeToRemoteCache($cache, $ftpObj);
-            } else {
-                $cache = $this->getSconfig();
-                $cache->clear();
-            }
-        } catch (\Exception $e) {
-            $this->doError($command, $e->getMessage());
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Command/Remote_Header.php b/lib/internal/Magento/Framework/Connect/Command/Remote_Header.php
deleted file mode 100644
index 418fd5eb254d6694ddb40d5a5a323960b638beb9..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Command/Remote_Header.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-$commands = array(
-    'list-upgrades' => array(
-        'summary' => 'List Available Upgrades',
-        'function' => 'doListUpgrades',
-        'shortcut' => 'lu',
-        'options' => array(
-            'channelinfo' => array('shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure')
-        ),
-        'doc' => '[preferred_state]
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.)
-or the state passed as the second parameter.'
-    ),
-    'list-available' => array(
-        'summary' => 'List Available Packages',
-        'function' => 'doListAvailable',
-        'shortcut' => 'la',
-        'options' => array(
-            'channel' => array(
-                'shortopt' => 'c',
-                'doc' => 'specify a channel other than the default channel',
-                'arg' => 'CHAN'
-            ),
-            'channelinfo' => array('shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure')
-        ),
-        'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.'
-    ),
-    'download' => array(
-        'summary' => 'Download Package',
-        'function' => 'doDownload',
-        'shortcut' => 'd',
-        'options' => array('nocompress' => array('shortopt' => 'Z', 'doc' => 'download an uncompressed (.tar) file')),
-        'doc' => '<package>...
-Download package tarballs.  The files will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.'
-    ),
-    'clear-cache' => array(
-        'summary' => 'Clear Web Services Cache',
-        'function' => 'doClearCache',
-        'shortcut' => 'cc',
-        'options' => array(),
-        'doc' => '
-Clear the XML-RPC/REST cache.  See also the cache_ttl configuration
-parameter.
-'
-    )
-);
diff --git a/lib/internal/Magento/Framework/Connect/Config.php b/lib/internal/Magento/Framework/Connect/Config.php
deleted file mode 100644
index 40804ee0428065e7bc2024cf3d4f7da324456413..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Config.php
+++ /dev/null
@@ -1,377 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-class Config implements \Iterator
-{
-    const HEADER = "::ConnectConfig::v::1.0::";
-
-    const DEFAULT_DOWNLOADER_PATH = "downloader";
-
-    const DEFAULT_CACHE_PATH = ".cache";
-
-    /**
-     * @var string
-     */
-    protected $_configFile;
-
-    /**
-     * @var array
-     */
-    protected $properties = array();
-
-    /**
-     * @return void
-     */
-    protected function initProperties()
-    {
-        $this->properties = array(
-            'php_ini' => array(
-                'type' => 'file',
-                'value' => '',
-                'prompt' => 'location of php.ini',
-                'doc' => "It's a location of PHP.ini to use blah",
-                'possible' => '/path/php.ini'
-            ),
-            'protocol' => array(
-                'type' => 'set',
-                'value' => 'http',
-                'prompt' => 'preffered protocol',
-                'doc' => 'preffered protocol',
-                'rules' => array('http', 'ftp')
-            ),
-            'preferred_state' => array(
-                'type' => 'set',
-                'value' => 'stable',
-                'prompt' => 'preferred package state',
-                'doc' => 'preferred package state',
-                'rules' => array('beta', 'alpha', 'stable', 'devel')
-            ),
-            'global_dir_mode' => array(
-                'type' => 'octal',
-                'value' => 0777,
-                'prompt' => 'directory creation mode',
-                'doc' => 'directory creation mode',
-                'possible' => '0777, 0666 etc.'
-            ),
-            'global_file_mode' => array(
-                'type' => 'octal',
-                'value' => 0666,
-                'prompt' => 'file creation mode',
-                'doc' => 'file creation mode',
-                'possible' => '0777, 0666 etc.'
-            ),
-            'downloader_path' => array(
-                'type' => 'dir',
-                'value' => 'downloader',
-                'prompt' => 'relative path, location of magento downloader',
-                'doc' => "relative path, location of magento downloader",
-                'possible' => 'path'
-            ),
-            'magento_root' => array(
-                'type' => 'dir',
-                'value' => '',
-                'prompt' => 'location of magento root dir',
-                'doc' => "Location of magento",
-                'possible' => '/path'
-            ),
-            'root_channel' => array(
-                'type' => 'string',
-                'value' => 'core',
-                'prompt' => '',
-                'doc' => "",
-                'possible' => ''
-            )
-        );
-    }
-
-    /**
-     * @return string
-     */
-    public function getDownloaderPath()
-    {
-        return $this->magento_root . '/' . $this->downloader_path;
-    }
-
-    /**
-     * @return string
-     */
-    public function getPackagesCacheDir()
-    {
-        return $this->getDownloaderPath() . '/' . self::DEFAULT_CACHE_PATH;
-    }
-
-    /**
-     * @param string $channel
-     * @return string
-     */
-    public function getChannelCacheDir($channel)
-    {
-        $channel = trim($channel, "\\/");
-        return $this->getPackagesCacheDir() . '/' . $channel;
-    }
-
-    /**
-     * @param string $configFile
-     */
-    public function __construct($configFile = "connect.cfg")
-    {
-        $this->initProperties();
-        $this->_configFile = $configFile;
-        $this->load();
-    }
-
-    /**
-     * @return string
-     */
-    public function getFilename()
-    {
-        return $this->_configFile;
-    }
-
-    /**
-     * @return void
-     */
-    public function load()
-    {
-        /**
-         * Trick: open in append mode to read,
-         * place pointer to begin
-         * create if not exists
-         */
-        $f = fopen($this->_configFile, "a+");
-        fseek($f, 0, SEEK_SET);
-        $size = filesize($this->_configFile);
-        if (!$size) {
-            $this->store();
-            return;
-        }
-
-        $headerLen = strlen(self::HEADER);
-        $contents = fread($f, $headerLen);
-
-        if (self::HEADER != $contents) {
-            $this->store();
-            return;
-        }
-
-        $size -= $headerLen;
-        $contents = fread($f, $size);
-
-        $data = @unserialize($contents);
-        if ($data === unserialize(false)) {
-            $this->store();
-            return;
-        }
-        foreach ($data as $k => $v) {
-            $this->{$k} = $v;
-        }
-        fclose($f);
-    }
-
-    /**
-     * @return void
-     */
-    public function store()
-    {
-        $data = serialize($this->toArray());
-        $f = @fopen($this->_configFile, "w+");
-        @fwrite($f, self::HEADER);
-        @fwrite($f, $data);
-        @fclose($f);
-    }
-
-    /**
-     * @param string $key
-     * @param mixed $val
-     * @return bool
-     */
-    public function validate($key, $val)
-    {
-        $rules = $this->extractField($key, 'rules');
-        if (null === $rules) {
-            return true;
-        } elseif (is_array($rules)) {
-            return in_array($val, $rules);
-        }
-        return false;
-    }
-
-    /**
-     * @param string $key
-     * @return null|string
-     */
-    public function possible($key)
-    {
-        $data = $this->getKey($key);
-        if (!$data) {
-            return null;
-        }
-        if ('set' == $data['type']) {
-            return implode("|", $data['rules']);
-        }
-        if (!empty($data['possible'])) {
-            return $data['possible'];
-        }
-        return "<" . $data['type'] . ">";
-    }
-
-    /**
-     * @param string $key
-     * @return null|string
-     */
-    public function type($key)
-    {
-        return $this->extractField($key, 'type');
-    }
-
-    /**
-     * @param string $key
-     * @return null|string
-     */
-    public function doc($key)
-    {
-        return $this->extractField($key, 'doc');
-    }
-
-    /**
-     * @param string $key
-     * @param string $field
-     * @return null|string
-     */
-    public function extractField($key, $field)
-    {
-        if (!isset($this->properties[$key][$field])) {
-            return null;
-        }
-        return $this->properties[$key][$field];
-    }
-
-    /**
-     * @param string $fld
-     * @return bool
-     */
-    public function hasKey($fld)
-    {
-        return isset($this->properties[$fld]);
-    }
-
-    /**
-     * @param string $fld
-     * @return null|bool
-     */
-    public function getKey($fld)
-    {
-        if ($this->hasKey($fld)) {
-            return $this->properties[$fld];
-        }
-        return null;
-    }
-
-    /**
-     * @return void
-     */
-    public function rewind()
-    {
-        reset($this->properties);
-    }
-
-    /**
-     * @return bool
-     */
-    public function valid()
-    {
-        return current($this->properties) !== false;
-    }
-
-    /**
-     * @return string
-     */
-    public function key()
-    {
-        return key($this->properties);
-    }
-
-    /**
-     * @return array
-     */
-    public function current()
-    {
-        return current($this->properties);
-    }
-
-    /**
-     * @return void
-     */
-    public function next()
-    {
-        next($this->properties);
-    }
-
-    /**
-     * @param string $var
-     * @return null|string
-     */
-    public function __get($var)
-    {
-        if (isset($this->properties[$var]['value'])) {
-            return $this->properties[$var]['value'];
-        }
-        return null;
-    }
-
-    /**
-     * @param string $var
-     * @param string $value
-     * @return void
-     */
-    public function __set($var, $value)
-    {
-        if (is_string($value)) {
-            $value = trim($value);
-        }
-        if (isset($this->properties[$var])) {
-            if ($value === null) {
-                $value = '';
-            }
-            if ($this->properties[$var]['value'] !== $value) {
-                $this->properties[$var]['value'] = $value;
-                $this->store();
-            }
-        }
-    }
-
-    /**
-     * @param bool $withRules
-     * @return array
-     */
-    public function toArray($withRules = false)
-    {
-        $out = array();
-        foreach ($this as $k => $v) {
-            $out[$k] = $withRules ? $v : $v['value'];
-        }
-        return $out;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Converter.php b/lib/internal/Magento/Framework/Connect/Converter.php
deleted file mode 100644
index a843ab1c467ad96fcaeda4ac6babd3899d1065eb..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Converter.php
+++ /dev/null
@@ -1,357 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-use Magento\Framework\Archive;
-
-/**
- * Class for convertiong old magento PEAR packages to new one
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-final class Converter
-{
-    /**
-     * @var Archive
-     */
-    protected $_archiver;
-
-    /**
-     *
-     * @return Archive
-     */
-    public function arc()
-    {
-        if (!$this->_archiver) {
-            $this->_archiver = new Archive();
-        }
-        return $this->_archiver;
-    }
-
-    /**
-     * @return Package
-     */
-    public function newPackage()
-    {
-        return new \Magento\Framework\Connect\Package();
-    }
-
-    /**
-     *
-     * @return Pear_Package_Parser_v2
-     */
-    public function oldPackageReader()
-    {
-        return new Pear_Package_Parser_v2();
-    }
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * @param string $channel
-     * @return string|string[]
-     */
-    public function convertChannelName($channel)
-    {
-        return str_replace("connect.magentocommerce.com/", "", $channel);
-    }
-
-    /**
-     * Convert package dependencies - urls - by ref
-     *
-     * @param array $oldDeps  ref to array
-     * @return array
-     */
-    public function convertPackageDependencies($oldDeps)
-    {
-        $out = array();
-        if (empty($oldDeps['required']['package'])) {
-            return $out;
-        }
-        $deps = $oldDeps['required']['package'];
-        if (!isset($deps[0])) {
-            $deps = array($deps);
-        }
-        for ($i = 0,$c = count($deps); $i < $c; $i++) {
-            $deps[$i]['min_version'] = isset($deps[$i]['min']) ? $deps[$i]['min'] : false;
-            $deps[$i]['max_version'] = isset($deps[$i]['max']) ? $deps[$i]['max'] : false;
-            $deps[$i]['channel'] = $this->convertChannelName($deps[$i]['channel']);
-            $out[] = $deps[$i];
-        }
-
-        return $out;
-    }
-
-    /**
-     * @param array $oldLicense
-     * @return array|int|float|bool|string
-     */
-    public function convertLicense($oldLicense)
-    {
-        if (is_scalar($oldLicense)) {
-            return $oldLicense;
-        }
-        return array($oldLicense['_content'], $oldLicense['attribs']['uri']);
-    }
-
-    /**
-     * @param array $maintainers
-     * @return array
-     */
-    public function convertMaintainers($maintainers)
-    {
-        if (!is_array($maintainers) || !count($maintainers)) {
-            return array();
-        }
-        $out = array();
-        foreach ($maintainers as $row) {
-            $out[] = array('name' => $row['name'], 'email' => $row['email'], 'user' => 'auto-converted');
-        }
-        return $out;
-    }
-
-    /**
-     * @var array
-     */
-    protected $fileMap = array();
-
-    /**
-     * Convert pear package object to magento object
-     *
-     * @param Pear_Package_V2 $pearObject
-     * @return \Magento\Framework\Connect\Package
-     * @throws \Exception
-     */
-    public function convertPackageObject($pearObject)
-    {
-        $data = array();
-        $mageObject = $this->newPackage();
-
-
-
-        $map = array(
-            'name' => null,
-            'version' => array('getterArgs' => array('release')),
-            'package_deps' => array(
-                'getter' => 'getDependencies',
-                'converter' => 'convertPackageDependencies',
-                'setter' => 'setDependencyPackages'
-            ),
-            'stability' => array('getter' => 'getState', 'getterArgs' => array('release')),
-            'license' => array('getterArgs' => array(true), 'converter' => 'convertLicense', 'noArrayWrap' => true),
-            'summary' => null,
-            'description' => null,
-            'notes' => null,
-            'date' => null,
-            'time' => null,
-            'authors' => array('converter' => 'convertMaintainers', 'getter' => 'getMaintainers'),
-            'channel' => array('converter' => 'convertChannelName')
-        );
-        foreach ($map as $field => $rules) {
-
-            if (empty($rules)) {
-                $rules = array('setter' => '', 'getter' => '');
-            }
-
-            if (empty($rules['getter'])) {
-                $rules['getter'] = 'get' . ucfirst($field);
-            }
-
-            $useSetter = empty($rules['noSetter']);
-            $useGetter = empty($rules['noGetter']);
-
-
-            if (empty($rules['setter'])) {
-                $rules['setter'] = 'set' . ucfirst($field);
-            }
-            if (empty($rules['getterArgs'])) {
-                $rules['getterArgs'] = array();
-            } elseif (!is_array($rules['getterArgs'])) {
-                throw new \Exception("Invalid 'getterArgs' for '{$field}', should be array");
-            }
-
-            if ($useGetter
-                && (!method_exists($pearObject, $rules['getter'])
-                    || !is_callable([$pearObject, $rules['getter']])
-                )
-            ) {
-                $mName = get_class($pearObject) . "::" . $rules['getter'];
-                throw new \Exception('No getter method exists: ' . $mName);
-            }
-
-            if ($useSetter
-                && (!method_exists($mageObject, $rules['setter'])
-                    || !is_callable([$mageObject, $rules['setter']])
-                )
-            ) {
-                $mName = get_class($mageObject) . "::" . $rules['setter'];
-                throw new \Exception('No setter method exists: ' . $mName);
-            }
-
-            $useConverter = !empty($rules['converter']);
-
-            if ($useConverter && !method_exists($this, $rules['converter'])) {
-                $mName = get_class($this) . "::" . $rules['converter'];
-                throw new \Exception('No converter method exists: ' . $mName);
-            }
-
-            if ($useGetter) {
-                $getData = call_user_func_array(array($pearObject, $rules['getter']), $rules['getterArgs']);
-            } else {
-                $getData = array();
-            }
-
-            if ($useConverter) {
-                $args = array();
-                if (!$useGetter && !$useSetter) {
-                    $args = array($pearObject, $mageObject);
-                } elseif (!$useSetter) {
-                    $args = array($mageObject, $getData);
-                } else {
-                    $args = array($getData);
-                }
-                $getData = call_user_func_array(array($this, $rules['converter']), $args);
-            }
-
-            $noWrap = !empty($rules['noArrayWrap']);
-            if ($useSetter) {
-                $setData = call_user_func_array(
-                    array($mageObject, $rules['setter']),
-                    $noWrap ? $getData : array($getData)
-                );
-            }
-        }
-        return $mageObject;
-    }
-
-    /**
-     * Convert PEAR package to Magento package
-     *
-     * @param string $sourceFile Path to PEAR .tgz
-     * @param bool|false|string $destFile Path to newly-created Magento .tgz, false to specify auto
-     * @throws \Exception
-     * @return string
-     */
-    public function convertPearToMage($sourceFile, $destFile = false)
-    {
-        try {
-            if (!file_exists($sourceFile)) {
-                throw new \Exception("File doesn't exist: {$sourceFile}");
-            }
-            $arc = $this->arc();
-            $tempDir = "tmp-" . basename($sourceFile) . uniqid();
-            $outDir = "out-" . basename($sourceFile) . uniqid();
-            $outDir = rtrim($outDir, "\\/");
-            \Magento\Framework\System\Dirs::mkdirStrict($outDir);
-            \Magento\Framework\System\Dirs::mkdirStrict($tempDir);
-
-            $result = $arc->unpack($sourceFile, $tempDir);
-            if (!$result) {
-                throw new \Exception("'{$sourceFile}' was not unpacked");
-            }
-
-            $result = rtrim($result, "\\/");
-            $packageXml = $result . '/package.xml';
-            if (!file_exists($packageXml)) {
-                throw new \Exception("No package.xml found inside '{$sourceFile}'");
-            }
-
-            $reader = $this->oldPackageReader();
-            $data = file_get_contents($packageXml);
-
-            $pearObject = $reader->parsePackage($data, $packageXml);
-            $mageObject = $this->convertPackageObject($pearObject);
-            if (!$mageObject->validate()) {
-                throw new \Exception("Package validation failed.\n" . implode("\n", $mageObject->getErrors()));
-            }
-
-            /**
-             * Calculate destination file if false
-             */
-            if (false === $destFile) {
-                $pathinfo = pathinfo($sourceFile);
-                $destFile = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-converted';
-                if (isset($pathinfo['extension'])) {
-                    $destFile .= "." . $pathinfo['extension'];
-                }
-            }
-
-            $target = new \Magento\Framework\Connect\Package\Target("target.xml");
-            $targets = $target->getTargets();
-            $mageObject->setTarget($target);
-            $validRoles = array_keys($targets);
-            $data = $pearObject->getFilelist();
-            $pathSource = dirname(
-                $pearObject->getPackageFile()
-            ) . '/' . $pearObject->getName() . "-" . $pearObject->getVersion();
-
-            $filesToDo = array();
-            foreach ($data as $file => $row) {
-                $name = $row['name'];
-                $role = $row['role'];
-                if (!in_array($role, $validRoles)) {
-                    $role = 'mage';
-                }
-                $baseName = ltrim($targets[$role], "\\/.");
-                $baseName = rtrim($baseName, "\\/");
-                $sourceFile = $pathSource . '/' . $name;
-                $targetFile = $outDir . '/' . $baseName . '/' . $name;
-                if (file_exists($sourceFile)) {
-                    \Magento\Framework\System\Dirs::mkdirStrict(dirname($targetFile));
-                    $copy = @copy($sourceFile, $targetFile);
-                    if (false === $copy) {
-                        throw new \Exception("Cannot copy '{$sourceFile}' to '{$targetFile}'");
-                    }
-                }
-                $filesToDo[] = array('name' => $name, 'role' => $role);
-            }
-            $cwd = getcwd();
-            @chdir($outDir);
-            foreach ($filesToDo as $fileToDo) {
-                $mageObject->addContent($fileToDo['name'], $fileToDo['role']);
-            }
-            $mageObject->save(getcwd());
-            @chdir($cwd);
-            $filename = $outDir . '/' . $mageObject->getReleaseFilename() . '.tgz';
-            if (@file_exists($destFile)) {
-                @unlink($destFile);
-            }
-            \Magento\Framework\System\Dirs::mkdirStrict(dirname($destFile));
-            $copy = @copy($filename, $destFile);
-            if (false === $copy) {
-                throw new \Exception("Cannot copy '{$filename}' to '{$destFile}'");
-            }
-            \Magento\Framework\System\Dirs::rm($tempDir);
-            \Magento\Framework\System\Dirs::rm($outDir);
-        } catch (\Exception $e) {
-            throw $e;
-        }
-        return $destFile;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Frontend.php b/lib/internal/Magento/Framework/Connect/Frontend.php
deleted file mode 100644
index ddcf254aef24201a54d201a8a931daae36d9e186..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Frontend.php
+++ /dev/null
@@ -1,264 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-class Frontend
-{
-    /**
-     * Silent flag. If set no output is produced to view.
-     * Should be used in derived classes.
-     *
-     * @var bool
-     */
-    protected $_silent = false;
-
-    /**
-     * Capture mode. If set command output should be collected
-     * by derived class implementation
-     *
-     * @var bool
-     */
-    protected $_capture = false;
-
-    /**
-     * Push/pop variable for capture
-     *
-     * @var array
-     */
-    protected $_captureSaved = array();
-
-    /**
-     * Push/pop variable for silent
-     *
-     * @var array
-     */
-    protected $_silentSaved = array();
-
-    /**
-     * Errors list
-     *
-     * @var array
-     */
-    protected $_errors = array();
-
-    /**
-     * Add error to errors list
-     *
-     * @param mixed $data
-     * @return void
-     */
-    public function addError($data)
-    {
-        $this->_errors[] = $data;
-    }
-
-    /**
-     * Get errors, clear errors list with first param
-     *
-     * @param bool $clear
-     * @return array
-     */
-    public function getErrors($clear = true)
-    {
-        if (!$clear) {
-            return $this->_errors;
-        }
-        $out = $this->_errors;
-        $this->clearErrors();
-        return $out;
-    }
-
-    /**
-     * Clear errors array
-     *
-     * @return void
-     */
-    public function clearErrors()
-    {
-        $this->_errors = array();
-    }
-
-    /**
-     * Are there any errors?
-     *
-     * @return bool
-     */
-    public function hasErrors()
-    {
-        return count($this->_errors) != 0;
-    }
-
-    /**
-     * Error processing
-     *
-     * @param string $command
-     * @param string $message
-     * @return void
-     */
-    public function doError($command, $message)
-    {
-        $this->addError(array($command, $message));
-    }
-
-    /**
-     * Save capture state
-     *
-     * @return $this
-     */
-    public function pushCapture()
-    {
-        $this->_captureSaved[] = $this->_capture;
-        return $this;
-    }
-
-    /**
-     * Restore capture state
-     *
-     * @return $this
-     */
-    public function popCapture()
-    {
-        $this->_capture = array_pop($this->_captureSaved);
-        return $this;
-    }
-
-    /**
-     * Set capture mode
-     *
-     * @param bool $arg true by default
-     * @return $this
-     */
-    public function setCapture($arg = true)
-    {
-        $this->_capture = $arg;
-        return $this;
-    }
-
-    /**
-     * Getter for capture mode
-     *
-     * @return bool
-     */
-    public function isCapture()
-    {
-        return $this->_capture;
-    }
-
-    /**
-     * Log stub
-     *
-     * @param string $msg
-     * @return void
-     */
-    public function log($msg)
-    {
-    }
-
-    /**
-     * Ouptut method
-     *
-     * @param array $data
-     * @return void
-     */
-    public function output($data)
-    {
-    }
-
-    /**
-     * Get instance of derived class
-     *
-     * @param string $class CLI for example will produce \Magento\Framework\Connect\Frontend\CLI
-     * @return object
-     */
-    public static function getInstance($class)
-    {
-        $class = __CLASS__ . "_" . $class;
-        return new $class();
-    }
-
-    /**
-     * Get output if capture mode set
-     * Clear prevoius if needed
-     *
-     * @param bool $clearPrevious
-     * @return mixed
-     */
-    public function getOutput($clearPrevious = true)
-    {
-    }
-
-    /**
-     * Save silent mode
-     *
-     * @return $this
-     */
-    public function pushSilent()
-    {
-        $this->_silentSaved[] = $this->_silent;
-        return $this;
-    }
-
-    /**
-     * Restore silent mode
-     *
-     * @return $this
-     */
-    public function popSilent()
-    {
-        $this->_silent = array_pop($this->_silentSaved);
-        return $this;
-    }
-
-    /**
-     * Set silent mode
-     *
-     * @param bool $value
-     * @return $this
-     */
-    public function setSilent($value = true)
-    {
-        $this->_silent = (bool)$value;
-        return $this;
-    }
-
-    /**
-     * Is silent mode?
-     *
-     * @return bool
-     */
-    public function isSilent()
-    {
-        return (bool)$this->_silent;
-    }
-
-    /**
-     * Method for ask client about rewrite all files.
-     *
-     * @param string $string
-     * @return void
-     */
-    public function confirm($string)
-    {
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Frontend/CLI.php b/lib/internal/Magento/Framework/Connect/Frontend/CLI.php
deleted file mode 100644
index 025537705d0cfe600ac01b2320299c2ada97836d..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Frontend/CLI.php
+++ /dev/null
@@ -1,459 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Frontend;
-
-/**
- * CLI Frontend implementation
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class CLI extends \Magento\Framework\Connect\Frontend
-{
-    /**
-     * Collected output
-     *
-     * @var array
-     */
-    protected $_output = array();
-
-    /**
-     * Output error
-     *
-     * @param string $command
-     * @param string $message
-     * @return void
-     */
-    public function doError($command, $message)
-    {
-        parent::doError($command, $message);
-        $this->writeln("Error: ");
-        $this->writeln("{$command}: {$message}");
-    }
-
-    /**
-     * Output config help
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputConfigHelp($data)
-    {
-        foreach ($data['data'] as $k => $v) {
-            if (is_scalar($v)) {
-                $this->writeln($v);
-            } elseif (is_array($v)) {
-                $this->writeln(implode(": ", $v));
-            }
-        }
-    }
-
-    /**
-     * Output info
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputRemoteInfo($data)
-    {
-        if (!is_array($data['releases'])) {
-            return;
-        }
-        foreach ($data['releases'] as $r) {
-            $this->writeln(implode(" ", $r));
-        }
-    }
-
-    /**
-     * @param string $type
-     * @return string
-     */
-    public function detectMethodByType($type)
-    {
-        $defaultMethod = "output";
-        $methodMap = array(
-            'list-upgrades' => 'outputUpgrades',
-            'list-available' => 'outputChannelsPackages',
-            'list-installed' => 'writeInstalledList',
-            'package-dependencies' => 'outputPackageDeps',
-            'list-files' => 'outputPackageContents',
-            'config-help' => 'outputConfigHelp',
-            'info' => 'outputRemoteInfo',
-            'config-show' => 'outputConfig',
-            'install' => 'outputInstallResult',
-            'install-file' => 'outputInstallResult',
-            'upgrade' => 'outputInstallResult',
-            'upgrade-all' => 'outputInstallResult',
-            'uninstall' => 'outputDeleted',
-            'list-channels' => 'outputListChannels'
-        );
-        if (isset($methodMap[$type])) {
-            return $methodMap[$type];
-        }
-        return $defaultMethod;
-    }
-
-    /**
-     * @param array $data
-     * @return void
-     */
-    public function outputDeleted($data)
-    {
-        if (!count($data['data'])) {
-            return;
-        }
-        $this->writeln($data['title']);
-        foreach ($data['data'] as $row) {
-            $this->writeln("{$row['0']}/{$row['1']}");
-        }
-    }
-
-    /**
-     * @param array $data
-     * @return void
-     */
-    public function outputListChannels($data)
-    {
-        $this->writeln($data['title']);
-
-        $channels =& $data['data'][\Magento\Framework\Connect\Singleconfig::K_CHAN];
-        foreach ($channels as $name => $v) {
-            $this->writeln("{$name}: {$v[\Magento\Framework\Connect\Singleconfig::K_URI]}");
-        }
-        $aliases =& $data['data'][\Magento\Framework\Connect\Singleconfig::K_CHAN_ALIAS];
-        if (count($aliases)) {
-            $this->writeln();
-            $this->writeln($data['title_aliases']);
-            foreach ($aliases as $k => $v) {
-                $this->writeln("{$k} => {$v}");
-            }
-        }
-    }
-
-    /**
-     * Output install result
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputInstallResult($data)
-    {
-        if (isset($data['title'])) {
-            $title = trim($data['title']) . " ";
-        } else {
-            $title = '';
-        }
-        foreach ($data['assoc'] as $row) {
-            $this->printf("%s%s/%s %s\n", $title, $row['channel'], $row['name'], $row['version']);
-        }
-    }
-
-    /**
-     * Ouptut package contents
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputPackageContents($data)
-    {
-        $this->writeln($data['title']);
-        foreach ($data['data'] as $file) {
-            $this->writeln($file);
-        }
-    }
-
-    /**
-     * Output package dependencies
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputPackageDeps($data)
-    {
-        $title = $data['title'];
-        $this->writeln($title);
-        foreach ($data['data'] as $package) {
-            $this->printf(
-                "%-20s %-20s %-20s %-20s\n",
-                $package['channel'],
-                $package['name'],
-                $package['min'],
-                $package['max']
-            );
-        }
-    }
-
-    /**
-     * Ouptut channel packages
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputChannelsPackages($data)
-    {
-        foreach ($data['data'] as $channelInfo) {
-            $title =& $channelInfo['title'];
-            $packages =& $channelInfo['packages'];
-            $this->writeln($title);
-            foreach ($packages as $name => $package) {
-                $releases =& $package['releases'];
-                $tmp = array();
-                foreach ($releases as $ver => $state) {
-                    $tmp[] = "{$ver} {$state}";
-                }
-                $tmp = implode(',', $tmp);
-                $this->writeln($name . ": " . $tmp);
-            }
-        }
-    }
-
-    /**
-     * Make output
-     *
-     * @param array $data
-     * @return void
-     */
-    public function output($data)
-    {
-        $capture = $this->isCapture();
-        if ($capture) {
-            $this->_output[] = $data;
-            return;
-        }
-
-        if (is_array($data)) {
-            foreach ($data as $type => $params) {
-                $method = $this->detectMethodByType($type);
-                if ($method) {
-                    $this->{$method}($params);
-                } else {
-                    $this->writeln(__METHOD__ . " handler not found for {$type}");
-                }
-            }
-        } else {
-            $this->writeln($data);
-        }
-    }
-
-    /**
-     * Detailed package info
-     *
-     * @param \Magento\Framework\Connect\Package $package
-     * @return void
-     */
-    public function outputPackage($package)
-    {
-        $fields = array(
-            'Name' => 'name',
-            'Version' => 'version',
-            'Stability' => 'stability',
-            'Description' => 'description',
-            'Date' => 'date',
-            'Authors' => 'authors'
-        );
-
-        foreach ($fields as $title => $fld) {
-            $method = "get" . ucfirst($fld);
-            $data = $package->{$method}();
-            if (empty($data)) {
-                continue;
-            }
-            $this->write($title . ": ");
-            if (is_array($data)) {
-                $this->write(print_r($data, true));
-            } else {
-                $this->write($data);
-            }
-            $this->writeln('');
-        }
-    }
-
-    /**
-     * Write channels list
-     *
-     * @param array $data
-     * @return void
-     */
-    public function writeChannelsList($data)
-    {
-        $this->writeln("Channels available: ");
-        $this->writeln("===================");
-        $out = $data['byName'];
-        ksort($out);
-        foreach ($out as $k => $v) {
-            $this->printf("%-20s %-20s\n", $k, $v);
-        }
-    }
-
-    /**
-     * Write installed list
-     *
-     * @param array $data
-     * @return void
-     */
-    public function writeInstalledList($data)
-    {
-        $totalCount = 0;
-        foreach ($data['data'] as $channel => $packages) {
-            $title = sprintf($data['channel-title'], $channel);
-            $c = count($packages);
-            $totalCount += $c;
-            if (!$c) {
-                continue;
-            }
-            $this->writeln($title);
-            foreach ($packages as $name => $row) {
-                $this->printf("%-20s %-20s\n", $name, $row['version'] . " " . $row['stability']);
-            }
-        }
-        if ($totalCount === 0) {
-            $this->writeln("No installed packages");
-        }
-    }
-
-    /**
-     * Output commands list
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputCommandList($data)
-    {
-        $this->writeln("Connect commands available:");
-        $this->writeln("===========================");
-        foreach ($data as $k => $v) {
-            $this->printf("%-20s %-20s\n", $k, $v['summary']);
-        }
-    }
-
-    /**
-     * Output config
-     * @param array $data
-     * @return void
-     */
-    public function outputConfig($data)
-    {
-        foreach ($data['data'] as $name => $row) {
-            $value = $row['value'] === '' ? "<not set>" : strval($row['value']);
-            $this->printf("%-30s %-20s %-20s\n", $row['prompt'], $name, $value);
-        }
-    }
-
-    /**
-     * Output config variable
-     *
-     * @param string $key
-     * @param string $value
-     * @return void
-     */
-    public function outputConfigVariable($key, $value)
-    {
-        if ($value === '') {
-            $value = '<not set>';
-        }
-        $this->writeln("Config variable '{$key}': {$value}");
-    }
-
-    /**
-     * Write data and "\n" afterwards
-     *
-     * @param string $data
-     * @return void
-     */
-    public function writeln($data = '')
-    {
-        $this->write($data . "\n");
-    }
-
-    /**
-     * Get output, clear if needed
-     *
-     * @param bool $clearPrevious optional, true by default
-     * @return array
-     */
-    public function getOutput($clearPrevious = true)
-    {
-        $out = $this->_output;
-        if ($clearPrevious) {
-            $this->_output = array();
-        }
-        return $out;
-    }
-
-    /**
-     * Write data to console
-     *
-     * @param string $data
-     * @return void
-     */
-    public function write($data)
-    {
-        if ($this->isSilent()) {
-            return;
-        }
-        echo $data;
-    }
-
-    /**
-     * Output printf-stlye formatted string and args
-     *
-     * @return void
-     */
-    public function printf()
-    {
-        $args = func_get_args();
-        $this->write(call_user_func_array('sprintf', $args));
-    }
-
-    /**
-     * Readline from console
-     *
-     * @return string
-     */
-    public function readln()
-    {
-        $out = "";
-        $key = fgetc(STDIN);
-        while ($key != "\n") {
-            $out .= $key;
-            $key = fread(STDIN, 1);
-        }
-        return $out;
-    }
-
-    /**
-     * Output upgrades
-     *
-     * @param array $data
-     * @return void
-     */
-    public function outputUpgrades($data)
-    {
-        foreach ($data['data'] as $chan => $packages) {
-            $this->writeln("Updates for " . $chan . ": ");
-            foreach ($packages as $name => $data) {
-                $this->writeln("  {$name}: {$data['from']} => {$data['to']}");
-            }
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Loader.php b/lib/internal/Magento/Framework/Connect/Loader.php
deleted file mode 100644
index b28e077f25f5399f03cabbd41184d0518eb24873..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Loader.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class for loader which using in the Rest
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect;
-
-class Loader
-{
-    /**
-     * Factory for HTTP client
-     * @param string/false $protocol  'curl'/'socket' or false for auto-detect
-     * @return \Magento\Framework\HTTP\Client|\Magento\Framework\Connect\Loader\Ftp
-     */
-    public static function getInstance($protocol = '')
-    {
-        if ($protocol == 'ftp') {
-            return new \Magento\Framework\Connect\Loader\Ftp();
-        } else {
-            return \Magento\Framework\HTTP\Client::getInstance();
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Loader/Ftp.php b/lib/internal/Magento/Framework/Connect/Loader/Ftp.php
deleted file mode 100644
index f63e5c35e9d1ee06629213410a92ba09e9c0e954..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Loader/Ftp.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Loader;
-
-use Magento\Framework\Connect\Ftp as ConnectFtp;
-
-/**
- * Class for ftp loader which using in the Rest
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Ftp
-{
-    const TEMPORARY_DIR = 'var/package/tmp';
-
-    const FTP_USER = 'magconnect';
-
-    const FTP_PASS = '4SyTUxPts0o2';
-
-    /**
-     * Object of Ftp
-     *
-     * @var ConnectFtp
-     */
-    protected $_ftp = null;
-
-    /**
-     * Response body
-     * @var string
-     */
-    protected $_responseBody = '';
-
-    /**
-     * Response status
-     * @var int
-     */
-    protected $_responseStatus = 0;
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $this->_ftp = new ConnectFtp();
-    }
-
-    /**
-     * @return ConnectFtp
-     */
-    public function getFtp()
-    {
-        return $this->_ftp;
-    }
-
-    /**
-     * Retrieve file from URI
-     *
-     * @param string $uri
-     * @return bool
-     */
-    public function get($uri)
-    {
-        $remoteFile = basename($uri);
-        $uri = dirname($uri);
-        $uri = str_replace('http://', '', $uri);
-        $uri = str_replace('ftp://', '', $uri);
-        $uri = self::FTP_USER . ":" . self::FTP_PASS . "@" . $uri;
-        $this->getFtp()->connect("ftp://" . $uri);
-        $this->getFtp()->pasv(true);
-        $localFile = self::TEMPORARY_DIR . '/' . time() . '.xml';
-
-        if ($this->getFtp()->get($localFile, $remoteFile)) {
-            $this->_responseBody = file_get_contents($localFile);
-            $this->_responseStatus = 200;
-        }
-        @unlink($localFile);
-        $this->getFtp()->close();
-        return $out;
-    }
-
-    /**
-     * Get response status code
-     *
-     * @return string
-     */
-    public function getStatus()
-    {
-        return $this->_responseStatus;
-    }
-
-    /**
-     * TODO: put your comment there...
-     *
-     * @return string
-     */
-    public function getBody()
-    {
-        return $this->_responseBody;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Package.php b/lib/internal/Magento/Framework/Connect/Package.php
deleted file mode 100644
index 9ced857a64ed1e94affbc3c2d37a3724ad2e2081..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Package.php
+++ /dev/null
@@ -1,1529 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-use Magento\Framework\Connect\Package\Target;
-
-/**
- * Class to work with Magento Connect packages
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Package
-{
-    /*
-     * Current version of magento connect package format
-     */
-    const PACKAGE_VERSION_2X = '2';
-
-    /*
-     * Previous version of magento connect package format
-     */
-    const PACKAGE_VERSION_1X = '1';
-
-    /**
-     * Contain \SimpleXMLElement for composing document.
-     *
-     * @var \SimpleXMLElement
-     */
-    protected $_packageXml;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_authors;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_contents;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_hashContents;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_compatible;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_dependencyPhpExtensions;
-
-    /**
-     * Internal cache
-     *
-     * @var array
-     */
-    protected $_dependencyPackages;
-
-    /**
-     * A helper object that can read from a package archive
-     *
-     * @var \Magento\Framework\Connect\Package\Reader
-     */
-    protected $_reader;
-
-    /**
-     * A helper object that can create and write to a package archive
-     *
-     * @var \Magento\Framework\Connect\Package\Writer
-     */
-    protected $_writer;
-
-    /**
-     * Validator object
-     *
-     * @var \Magento\Framework\Connect\Validator
-     */
-    protected $_validator = null;
-
-    /**
-     * Validation errors
-     *
-     * @var array
-     */
-    protected $_validationErrors = array();
-
-    /**
-     * Object with target
-     *
-     * @var Target
-     */
-    protected $_target = null;
-
-    /**
-     * General purpose Magento util
-     *
-     * @var \Magento\Framework\Util
-     */
-    protected $_util = null;
-
-    /**
-     * Creates a package object (empty, or from existing archive, or from package definition xml)
-     *
-     * @param null|string|resource $source
-     * @param \Magento\Framework\Util|null $util
-     * @throws \Magento\Framework\Exception
-     */
-    public function __construct($source = null, \Magento\Framework\Util $util = null)
-    {
-        $this->_util = $util ? $util : new \Magento\Framework\Util();
-        libxml_use_internal_errors(true);
-
-        if (is_string($source)) {
-            // check what's in the string (a package definition or a package filename)
-            if (0 === strpos($source, "<?xml")) {
-                // package definition xml
-                $this->_init($source);
-            } elseif (is_file($source) && is_readable($source)) {
-                // package archive filename
-                $this->_loadFile($source);
-            } else {
-                throw new \Magento\Framework\Exception('Invalid package source');
-            }
-        } elseif (is_resource($source)) {
-            $this->_loadResource($source);
-        } elseif (is_null($source)) {
-            $this->_init();
-        } else {
-            throw new \Magento\Framework\Exception('Invalid package source');
-        }
-    }
-
-    /**
-     * Initializes an empty package object
-     *
-     * @param null|string $definition optional package definition xml
-     * @return $this
-     */
-    protected function _init($definition = null)
-    {
-
-        if (!is_null($definition)) {
-            $this->_packageXml = simplexml_load_string($definition);
-        } else {
-            $packageXmlStub = <<<END
-<?xml version="1.0"?>
-<package>
-    <name />
-    <version />
-    <stability />
-    <license />
-    <channel />
-    <extends />
-    <summary />
-    <description />
-    <notes />
-    <authors />
-    <date />
-    <time />
-    <contents />
-    <compatible />
-    <dependencies />
-</package>
-END;
-            $this->_packageXml = simplexml_load_string($packageXmlStub);
-        }
-        return $this;
-    }
-
-    /**
-     * Loads a package from specified file
-     *
-     * @param string $filename
-     * @return $this
-     */
-    protected function _loadFile($filename = '')
-    {
-        if (is_null($this->_reader)) {
-            $this->_reader = new \Magento\Framework\Connect\Package\Reader($filename);
-        }
-        $content = $this->_reader->load();
-        $this->_packageXml = simplexml_load_string($content);
-        return $this;
-    }
-
-    /**
-     * Creates a package and saves it
-     *
-     * @param string $path
-     * @return $this
-     */
-    public function save($path)
-    {
-        $this->validate();
-        $path = rtrim($path, "\\/") . '/';
-        $this->_savePackage($path);
-        return $this;
-    }
-
-    /**
-     * Creates a package that is compatible with the previous version of Magento Connect Manager and saves it
-     *
-     * @param string $path
-     * @return $this
-     */
-    public function saveV1x($path)
-    {
-        $this->validate();
-        $path = rtrim($path, "\\/") . '/';
-        $this->_savePackageV1x($path);
-        return $this;
-    }
-
-    /**
-     * Creates a package archive and saves it to specified path
-     *
-     * @param string $path
-     * @return $this
-     */
-    protected function _savePackage($path)
-    {
-        $fileName = $this->getReleaseFilename();
-        if (is_null($this->_writer)) {
-            $this->_writer = new \Magento\Framework\Connect\Package\Writer($this->getContents(), $path . $fileName);
-        }
-        $this->_writer->composePackage()->addPackageXml($this->getPackageXml())->archivePackage();
-        return $this;
-    }
-
-    /**
-     * Creates a package archive and saves it to specified path
-     * Package is compatible with the previous version of magento Connect Manager
-     *
-     * @param string $path
-     * @return $this
-     */
-    protected function _savePackageV1x($path)
-    {
-        $fileName = $this->getReleaseFilename();
-        $writer = new \Magento\Framework\Connect\Package\Writer($this->getContents(), $path . $fileName);
-        $writer->composePackageV1x(
-            $this->getContentsV1x()
-        )->addPackageXml(
-            $this->_getPackageXmlV1x()
-        )->archivePackage();
-        return $this;
-    }
-
-    /**
-     * Generate package xml that is compatible with first version of Magento Connect Manager
-     * Function uses already generated package xml to import data
-     *
-     * @return string
-     */
-    protected function _getPackageXmlV1x()
-    {
-        $newPackageXml = $this->_packageXml;
-        $packageXmlV1xStub = <<<END
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.9.1"
-version="2.0"
-xmlns="http://pear.php.net/dtd/package-2.0"
-xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd" />
-END;
-        $packageXmlV1x = simplexml_load_string($packageXmlV1xStub);
-        // Note: The previous version of MCM requires precise node order in package.xml file
-        $packageXmlV1x->addChild('name', (string)$newPackageXml->name);
-        $packageXmlV1x->addChild('channel', $this->_convertChannelToV1x((string)$newPackageXml->channel));
-        $packageXmlV1x->addChild('summary', (string)$newPackageXml->summary);
-        $packageXmlV1x->addChild('description', (string)$newPackageXml->description);
-        // Import authors
-        foreach ($newPackageXml->authors->author as $author) {
-            $leadNode = $packageXmlV1x->addChild('lead');
-            $leadNode->addChild('name', (string)$author->name);
-            $leadNode->addChild('user', (string)$author->user);
-            $leadNode->addChild('email', (string)$author->email);
-            $leadNode->addChild('active', 'yes');
-        }
-        // Import date and time
-        $packageXmlV1x->addChild('date', (string)$newPackageXml->date);
-        $packageXmlV1x->addChild('time', (string)$newPackageXml->time);
-        // Import version
-        $versionNode = $packageXmlV1x->addChild('version');
-        $versionNode->addChild('release', (string)$newPackageXml->version);
-        $versionNode->addChild('api', (string)$newPackageXml->version);
-        // Import stability
-        $stabilityNode = $packageXmlV1x->addChild('stability');
-        $stabilityNode->addChild('release', (string)$newPackageXml->stability);
-        $stabilityNode->addChild('api', (string)$newPackageXml->stability);
-        // Import license
-        $licenseNode = $packageXmlV1x->addChild('license', (string)$newPackageXml->license);
-        if ($newPackageXml->license['uri']) {
-            $licenseNode->addAttribute('uri', (string)$newPackageXml->license['uri']);
-        }
-        $packageXmlV1x->addChild('notes', (string)$newPackageXml->notes);
-        // Import content
-        $conentsRootDirNode = $packageXmlV1x->addChild('contents')->addChild('dir');
-        $conentsRootDirNode->addAttribute('name', '/');
-        foreach ($newPackageXml->contents->target as $target) {
-            $role = (string)$target['name'];
-            $this->_mergeContentsToV1x($conentsRootDirNode, $target, $role);
-        }
-        // Import dependencies
-        $requiredDependenciesNode = $packageXmlV1x->addChild('dependencies')->addChild('required');
-        $requiredDependenciesPhpNode = $requiredDependenciesNode->addChild('php');
-        $requiredDependenciesPhpNode->addChild('min', (string)$newPackageXml->dependencies->required->php->min);
-        $requiredDependenciesPhpNode->addChild('max', (string)$newPackageXml->dependencies->required->php->max);
-        $requiredDependenciesNode->addChild('pearinstaller')->addChild('min', '1.6.2');
-        // Handle packages
-        foreach ($newPackageXml->dependencies->required->package as $package) {
-            $packageNode = $requiredDependenciesNode->addChild('package');
-            $packageNode->addChild('name', (string)$package->name);
-            // Convert channel to previous version format
-            $channel = (string)$package->channel;
-            $channel = $this->_convertChannelToV1x($channel);
-            $packageNode->addChild('channel', $channel);
-            $minVersion = (string)$package->min;
-            if ($minVersion) {
-                $packageNode->addChild('min', $minVersion);
-            }
-            $maxVersion = (string)$package->max;
-            if ($maxVersion) {
-                $packageNode->addChild('max', $maxVersion);
-            }
-        }
-        // Handle extensions
-        foreach ($newPackageXml->dependencies->required->extension as $extension) {
-            $extensionNode = $requiredDependenciesNode->addChild('extension');
-            $extensionNode->addChild('name', (string)$extension->name);
-            $minVersion = (string)$extension->min;
-            if ($minVersion) {
-                $extensionNode->addChild('min', $minVersion);
-            }
-            $maxVersion = (string)$extension->max;
-            if ($maxVersion) {
-                $extensionNode->addChild('max', $maxVersion);
-            }
-        }
-        $packageXmlV1x->addChild('phprelease');
-
-        return $packageXmlV1x->asXML();
-    }
-
-    /**
-     * Merge contents of source element into destination element
-     * Function converts <file/> and <dir/> nodes into format that is compatible
-     * with previous version of Magento Connect Manager
-     *
-     * @param \SimpleXMLElement $destination
-     * @param \SimpleXMLElement $source
-     * @param string $role
-     * @return $this
-     */
-    protected function _mergeContentsToV1x($destination, $source, $role)
-    {
-        foreach ($source->children() as $child) {
-            if ($child->getName() == 'dir') {
-                $newDestination = $destination;
-                if ($child['name'] != '.') {
-                    $directoryElement = $destination->addChild('dir');
-                    $directoryElement->addAttribute('name', $child['name']);
-                    $newDestination = $directoryElement;
-                }
-                $this->_mergeContentsToV1x($newDestination, $child, $role);
-            } elseif ($child->getName() == 'file') {
-                $fileElement = $destination->addChild('file');
-                $fileElement->addAttribute('name', $child['name']);
-                $fileElement->addAttribute('md5sum', $child['hash']);
-                $fileElement->addAttribute('role', $role);
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Retrieve Target object
-     *
-     * @return Target
-     */
-    protected function getTarget()
-    {
-        if (!$this->_target instanceof Target) {
-            $this->_target = new Target();
-        }
-        return $this->_target;
-    }
-
-    /**
-     * @param Target $arg
-     * @return void
-     */
-    public function setTarget($arg)
-    {
-        if ($arg instanceof Target) {
-            $this->_target = $arg;
-        }
-    }
-
-    /* Mutators */
-
-    /**
-     * Puts value to name
-     *
-     * @param string $name
-     * @return $this
-     */
-    public function setName($name)
-    {
-        $this->_packageXml->name = $name;
-        return $this;
-    }
-
-    /**
-     * Puts value to <channel />
-     *
-     * @param string $channel
-     * @return $this
-     */
-    public function setChannel($channel)
-    {
-        $this->_packageXml->channel = $channel;
-        return $this;
-    }
-
-    /**
-     * Puts value to <summary />
-     *
-     * @param string $summary
-     * @return $this
-     */
-    public function setSummary($summary)
-    {
-        $this->_packageXml->summary = $summary;
-        return $this;
-    }
-
-    /**
-     * Puts value to <description />
-     *
-     * @param string $description
-     * @return $this
-     */
-    public function setDescription($description)
-    {
-        $this->_packageXml->description = $description;
-        return $this;
-    }
-
-    /**
-     * Puts value to <authors />
-     *
-     * The format of the authors array is
-     * array(
-     *     array('name'=>'Name1', 'user'=>'User1', 'email'=>'email1@email.com'),
-     *     array('name'=>'Name2', 'user'=>'User2', 'email'=>'email2@email.com'),
-     * );
-     *
-     * @param array $authors
-     * @return $this
-     */
-    public function setAuthors($authors)
-    {
-        $this->_authors = $authors;
-        foreach ($authors as $_author) {
-            $this->addAuthor($_author['name'], $_author['user'], $_author['email']);
-        }
-        return $this;
-    }
-
-    /**
-     * Add author to <authors/>
-     *
-     * @param string $name
-     * @param string $user
-     * @param string $email
-     * @return $this
-     */
-    public function addAuthor($name = null, $user = null, $email = null)
-    {
-        $this->_authors[] = array('name' => $name, 'user' => $user, 'email' => $email);
-        $author = $this->_packageXml->authors->addChild('author');
-        $author->addChild('name', $name);
-        $author->addChild('user', $user);
-        $author->addChild('email', $email);
-        return $this;
-    }
-
-    /**
-     * Puts value to <date/>. Format should be Y-M-D.
-     *
-     * @param string $date
-     * @return $this
-     */
-    public function setDate($date)
-    {
-        $this->_packageXml->date = $date;
-        return $this;
-    }
-
-    /**
-     * Puts value to <time />. Format should be H:i:s.
-     *
-     * @param string $time
-     * @return $this
-     */
-    public function setTime($time)
-    {
-        $this->_packageXml->time = $time;
-        return $this;
-    }
-
-    /**
-     * Puts value to <version/>. Format should be X.Y.Z.
-     *
-     * @param string $version
-     * @return $this
-     */
-    public function setVersion($version)
-    {
-        $this->_packageXml->version = $version;
-        return $this;
-    }
-
-    /**
-     * Puts value to <stability/>. It can be alpha, beta, devel and stable.
-     *
-     * @param string $stability
-     * @return $this
-     */
-    public function setStability($stability)
-    {
-        $this->_packageXml->stability = $stability;
-        return $this;
-    }
-
-    /**
-     * Puts value to <license/>, also method can used for set attribute URI.
-     *
-     * @param string $license
-     * @param string $uri
-     * @return $this
-     */
-    public function setLicense($license, $uri = null)
-    {
-        $this->_packageXml->license = $license;
-        if ($uri) {
-            $this->_packageXml->license['uri'] = $uri;
-        }
-        return $this;
-    }
-
-    /**
-     * Puts value to <notes/>.
-     *
-     * @param string $notes
-     * @return $this
-     */
-    public function setNotes($notes)
-    {
-        $this->_packageXml->notes = $notes;
-        return $this;
-    }
-
-    /**
-     * Retrieve \SimpleXMLElement node by xpath. If it absent, create new.
-     * For comparing nodes method uses attribute "name" in each nodes.
-     * If attribute "name" is same for both nodes, nodes are same.
-     *
-     * @param string $tag
-     * @param \SimpleXMLElement $parent
-     * @param string $name
-     * @return \SimpleXMLElement
-     */
-    protected function _getNode($tag, $parent, $name = '')
-    {
-        $found = false;
-        foreach ($parent->xpath($tag) as $_node) {
-            if ($_node['name'] == $name) {
-                $node = $_node;
-                $found = true;
-                break;
-            }
-        }
-        if (!$found) {
-            $node = $parent->addChild($tag);
-            if ($name) {
-                $node->addAttribute('name', $name);
-            }
-        }
-        return $node;
-    }
-
-    /**
-     * Add directory or file to <contents />.
-     *
-     * @param string $path Path to directory or file
-     * @param string $targetName Target name.
-     * @return $this
-     */
-    public function addContent($path, $targetName)
-    {
-        $found = false;
-        $parent = $this->_getNode('target', $this->_packageXml->contents, $targetName);
-        $source = str_replace('\\', '/', $path);
-        $directories = explode('/', dirname($source));
-        foreach ($directories as $directory) {
-            $parent = $this->_getNode('dir', $parent, $directory);
-        }
-        $fileName = basename($source);
-        if ($fileName != '') {
-            $fileNode = $parent->addChild('file');
-            $fileNode->addAttribute('name', $fileName);
-            $targetDir = $this->getTarget()->getTargetUri($targetName);
-            $hash = md5_file($targetDir . '/' . $path);
-            $fileNode->addAttribute('hash', $hash);
-        }
-        return $this;
-    }
-
-    /**
-     * Add directory recursively (with subdirectory and file).
-     * Exclude and Include can be add using Regular Expression.
-     *
-     * @param string $targetName Target name
-     * @param string $path Path to directory
-     * @param string $exclude Exclude
-     * @param string $include Include
-     * @return $this
-     */
-    public function addContentDir($targetName, $path, $exclude = null, $include = null)
-    {
-        $targetDir = $this->getTarget()->getTargetUri($targetName);
-        $targetDirLen = strlen($targetDir . '/');
-        //get all subdirectories and files.
-        $entries = @glob($targetDir . '/' . $path . '/' . "{,.}*", GLOB_BRACE);
-        if (!empty($entries)) {
-            foreach ($entries as $entry) {
-                $filePath = substr($entry, $targetDirLen);
-                // TODO: Check directory before includes/excludes
-                if (is_dir($entry)) {
-                    $baseName = basename($entry);
-                    if (in_array($baseName, array('.', '..', '.svn'))) {
-                        continue;
-                    }
-                    //for subdirectory call method recursively
-                    $this->addContentDir($targetName, $filePath, $exclude, $include);
-                    continue;
-                }
-                if (!empty($include) && !preg_match($include, $filePath)) {
-                    continue;
-                }
-                if (!empty($exclude) && preg_match($exclude, $filePath)) {
-                    continue;
-                }
-
-                if (is_file($entry)) {
-                    $this->addContent($filePath, $targetName);
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Add value to <compatible />.
-     *
-     * @param string $packageName
-     * @param string $channel
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @return $this
-     */
-    public function addCompatible($packageName, $channel, $minVersion, $maxVersion)
-    {
-        $package = $this->_packageXml->compatible->addChild('package');
-        $package->addChild('name', $packageName);
-        $package->addChild('channel', $channel);
-        $package->addChild('min', $minVersion);
-        $package->addChild('max', $maxVersion);
-        return $this;
-    }
-
-    /**
-     * Set dependency from php version.
-     *
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @return $this
-     */
-    public function setDependencyPhpVersion($minVersion, $maxVersion)
-    {
-        $parent = $this->_packageXml->dependencies;
-        $parent = $this->_getNode('required', $parent);
-        $parent = $this->_getNode('php', $parent);
-        $parent->addChild('min', $minVersion);
-        $parent->addChild('max', $maxVersion);
-        return $this;
-    }
-
-    /**
-     * Check PHP version restriction
-     * @return true|string
-     */
-    public function checkPhpVersion()
-    {
-        $min = $this->getDependencyPhpVersionMin();
-        $max = $this->getDependencyPhpVersionMax();
-
-        $minOk = $min ? version_compare(PHP_VERSION, $min, ">=") : true;
-        $maxOk = $max ? version_compare($this->_util->getTrimmedPhpVersion(), $max, "<=") : true;
-
-        if (!$minOk || !$maxOk) {
-            $err = "requires PHP version ";
-            if ($min && $max) {
-                $err .= " >= {$min} and <= {$max} ";
-            } elseif ($min) {
-                $err .= " >= {$min} ";
-            } elseif ($max) {
-                $err .= " <= {$max} ";
-            }
-            $err .= " current is: " . PHP_VERSION;
-            return $err;
-        }
-        return true;
-    }
-
-    /**
-     * Check PHP extensions availability
-     * @throws \Exception On failure
-     * @return true|array
-     */
-    public function checkPhpDependencies()
-    {
-        $errors = array();
-        foreach ($this->getDependencyPhpExtensions() as $dep) {
-            if (!extension_loaded($dep['name'])) {
-                $errors[] = $dep;
-            }
-        }
-        if (count($errors)) {
-            return $errors;
-        }
-        return true;
-    }
-
-    /**
-     * Set dependency from php extensions.
-     *
-     * The $extension has next view:
-     * array('curl', 'mysql')
-     *
-     * @param array|string $extensions
-     * @return $this
-     */
-    public function setDependencyPhpExtensions($extensions)
-    {
-        foreach ($extensions as $_extension) {
-            $this->addDependencyExtension($_extension['name'], $_extension['min_version'], $_extension['max_version']);
-        }
-        return $this;
-    }
-
-    /**
-     * Set dependency from another packages.
-     *
-     * The $packages should contain:
-     * array(
-     *     array('name'=>'test1', 'channel'=>'test1', 'min_version'=>'0.0.1', 'max_version'=>'0.1.0'),
-     *     array('name'=>'test2', 'channel'=>'test2', 'min_version'=>'0.0.1', 'max_version'=>'0.1.0'),
-     * )
-     *
-     * @param array $packages
-     * @param bool $clear
-     * @return $this
-     */
-    public function setDependencyPackages($packages, $clear = false)
-    {
-        if ($clear) {
-            unset($this->_packageXml->dependencies->required->package);
-        }
-
-        foreach ($packages as $_package) {
-
-            $filesArrayCondition = isset($_package['files']) && is_array($_package['files']);
-            $filesArray = $filesArrayCondition ? $_package['files'] : array();
-
-            $this->addDependencyPackage(
-                $_package['name'],
-                $_package['channel'],
-                $_package['min_version'],
-                $_package['max_version'],
-                $filesArray
-            );
-        }
-        return $this;
-    }
-
-    /**
-     * Add package to dependency packages.
-     *
-     * @param string $name
-     * @param string $channel
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @param array $files
-     * @return $this
-     */
-    public function addDependencyPackage($name, $channel, $minVersion, $maxVersion, $files = array())
-    {
-        $parent = $this->_packageXml->dependencies;
-        $parent = $this->_getNode('required', $parent);
-        $parent = $parent->addChild('package');
-        $parent->addChild('name', $name);
-        $parent->addChild('channel', $channel);
-        $parent->addChild('min', $minVersion);
-        $parent->addChild('max', $maxVersion);
-        if (count($files)) {
-            $parent = $parent->addChild('files');
-            foreach ($files as $row) {
-                if (!empty($row['target']) && !empty($row['path'])) {
-                    $node = $parent->addChild("file");
-                    $node["target"] = $row['target'];
-                    $node["path"] = $row['path'];
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Add package to dependency extension.
-     *
-     * @param string $name
-     * @param string $minVersion
-     * @param string $maxVersion
-     * @return $this
-     */
-    public function addDependencyExtension($name, $minVersion, $maxVersion)
-    {
-        $parent = $this->_packageXml->dependencies;
-        $parent = $this->_getNode('required', $parent);
-        $parent = $parent->addChild('extension');
-        $parent->addChild('name', $name);
-        $parent->addChild('min', $minVersion);
-        $parent->addChild('max', $maxVersion);
-        return $this;
-    }
-
-    /* Accessors */
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getName()
-    {
-        return (string)$this->_packageXml->name;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getChannel()
-    {
-        return (string)$this->_packageXml->channel;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getSummary()
-    {
-        return (string)$this->_packageXml->summary;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDescription()
-    {
-        return (string)$this->_packageXml->description;
-    }
-
-    /**
-     * Get list of authors in associative array.
-     *
-     * @return array
-     */
-    public function getAuthors()
-    {
-        if (is_array($this->_authors)) {
-            return $this->_authors;
-        }
-        $this->_authors = array();
-        if (!isset($this->_packageXml->authors->author)) {
-            return array();
-        }
-        foreach ($this->_packageXml->authors->author as $_author) {
-            $this->_authors[] = array(
-                'name' => (string)$_author->name,
-                'user' => (string)$_author->user,
-                'email' => (string)$_author->email
-            );
-        }
-        return $this->_authors;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDate()
-    {
-        return (string)$this->_packageXml->date;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getTime()
-    {
-        return (string)$this->_packageXml->time;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getVersion()
-    {
-        return (string)$this->_packageXml->version;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getStability()
-    {
-        return (string)$this->_packageXml->stability;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getLicense()
-    {
-        return (string)$this->_packageXml->license;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getLicenseUri()
-    {
-        return (string)$this->_packageXml->license['uri'];
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getNotes()
-    {
-        return (string)$this->_packageXml->notes;
-    }
-
-    /**
-     * Create list of all files from package.xml
-     *
-     * @return array
-     */
-    public function getContents()
-    {
-        if (is_array($this->_contents)) {
-            return $this->_contents;
-        }
-        $this->_contents = array();
-        if (!isset($this->_packageXml->contents->target)) {
-            return $this->_contents;
-        }
-        foreach ($this->_packageXml->contents->target as $target) {
-            $targetUri = $this->getTarget()->getTargetUri($target['name']);
-            $this->_getList($target, $targetUri);
-        }
-        return $this->_contents;
-    }
-
-    /**
-     * Create list of all files from package.xml compatible with previous version of Magento Connect Manager
-     *
-     * @return array
-     */
-    public function getContentsV1x()
-    {
-        $currentContents = $this->_contents;
-        $this->_contents = array();
-
-        if (!isset($this->_packageXml->contents->target)) {
-            return $this->_contents;
-        }
-        foreach ($this->_packageXml->contents->target as $target) {
-            $this->_getList($target, '');
-        }
-        $contents = $this->_contents;
-
-        $this->_contents = $currentContents;
-        return $contents;
-    }
-
-    /**
-     * Helper for getContents(). Create recursively list.
-     *
-     * @param \SimpleXMLElement $parent
-     * @param string $path
-     * @return void
-     */
-    protected function _getList($parent, $path)
-    {
-        if (count($parent) == 0) {
-            $this->_contents[] = $path;
-        } else {
-            foreach ($parent as $_content) {
-                $this->_getList($_content, ($path ? $path . '/' : '') . $_content['name']);
-            }
-        }
-    }
-
-    /**
-     * Create list of all files from package.xml with hash
-     *
-     * @return array
-     */
-    public function getHashContents()
-    {
-        if (is_array($this->_hashContents)) {
-            return $this->_hashContents;
-        }
-        $this->_hashContents = array();
-        if (!isset($this->_packageXml->contents->target)) {
-            return $this->_hashContents;
-        }
-        foreach ($this->_packageXml->contents->target as $target) {
-            $targetUri = $this->getTarget()->getTargetUri($target['name']);
-            $this->_getHashList($target, $targetUri);
-        }
-        return $this->_hashContents;
-    }
-
-    /**
-     * Helper for getHashContents(). Create recursively list.
-     *
-     * @param \SimpleXMLElement $parent
-     * @param string $path
-     * @param string $hash
-     * @return void
-     */
-    protected function _getHashList($parent, $path, $hash = '')
-    {
-        if (count($parent) == 0) {
-            $this->_hashContents[$path] = $hash;
-        } else {
-            foreach ($parent as $_content) {
-                $contentHash = '';
-                if (isset($_content['hash'])) {
-                    $contentHash = (string)$_content['hash'];
-                }
-                $this->_getHashList($_content, ($path ? $path . '/' : '') . $_content['name'], $contentHash);
-            }
-        }
-    }
-
-    /**
-     * Get compatible packages.
-     *
-     * @return array
-     */
-    public function getCompatible()
-    {
-        if (is_array($this->_compatible)) {
-            return $this->_compatible;
-        }
-        $this->_compatible = array();
-        if (!isset($this->_packageXml->compatible->package)) {
-            return array();
-        }
-        foreach ($this->_packageXml->compatible->package as $_package) {
-            $this->_compatible[] = array(
-                'name' => (string)$_package->name,
-                'channel' => (string)$_package->channel,
-                'min' => (string)$_package->min,
-                'max' => (string)$_package->max
-            );
-        }
-        return $this->_compatible;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDependencyPhpVersionMin()
-    {
-        if (!isset($this->_packageXml->dependencies->required->php->min)) {
-            return false;
-        }
-        return (string)$this->_packageXml->dependencies->required->php->min;
-    }
-
-    /**
-     * Getter
-     *
-     * @return string
-     */
-    public function getDependencyPhpVersionMax()
-    {
-        if (!isset($this->_packageXml->dependencies->required->php->max)) {
-            return false;
-        }
-        return (string)$this->_packageXml->dependencies->required->php->max;
-    }
-
-    /**
-     * Get list of php extensions.
-     *
-     * @return array
-     */
-    public function getDependencyPhpExtensions()
-    {
-        if (is_array($this->_dependencyPhpExtensions)) {
-            return $this->_dependencyPhpExtensions;
-        }
-        $this->_dependencyPhpExtensions = array();
-        foreach ($this->_packageXml->dependencies->required->extension as $_package) {
-            $this->_dependencyPhpExtensions[] = array(
-                'name' => (string)$_package->name,
-                'min' => (string)$_package->min,
-                'max' => (string)$_package->max
-            );
-        }
-        return $this->_dependencyPhpExtensions;
-    }
-
-    /**
-     * Get list of dependency packages.
-     *
-     * @return array
-     */
-    public function getDependencyPackages()
-    {
-        $this->_dependencyPackages = array();
-        foreach ($this->_packageXml->dependencies->required->package as $_package) {
-            $add = array(
-                'name' => (string)$_package->name,
-                'channel' => (string)$_package->channel,
-                'min' => (string)$_package->min,
-                'max' => (string)$_package->max
-            );
-            if (isset($_package->files)) {
-                $add['files'] = array();
-                foreach ($_package->files as $node) {
-                    if (isset($node->file)) {
-
-                        $add['files'][] = array(
-                            'target' => (string)$node->file['target'],
-                            'path' => (string)$node->file['path']
-                        );
-                    }
-                }
-            }
-            $this->_dependencyPackages[] = $add;
-        }
-        return $this->_dependencyPackages;
-    }
-
-    /**
-     * Get string with XML content.
-     *
-     * @return string
-     */
-    public function getPackageXml()
-    {
-        return $this->_packageXml->asXml();
-    }
-
-    /**
-     * Validator instance (single)
-     *
-     *  @return \Magento\Framework\Connect\Validator
-     */
-    protected function validator()
-    {
-        if (is_null($this->_validator)) {
-            $this->_validator = new \Magento\Framework\Connect\Validator();
-        }
-        return $this->_validator;
-    }
-
-    /**
-     * Get validation error strings
-     *
-     * @return array
-     */
-    public function getErrors()
-    {
-        return $this->_validationErrors;
-    }
-
-    /**
-     * Setter for validation errors
-     *
-     * @param array $errors
-     * @return void
-     */
-    protected function setErrors(array $errors)
-    {
-        $this->_validationErrors = $errors;
-    }
-
-    /**
-     * Check validation result.
-     * Returns true if package data is invalid.
-     *
-     * @return bool
-     */
-    public function hasErrors()
-    {
-        return count($this->_validationErrors) != 0;
-    }
-
-    /**
-     * Validate package. Errors can be
-     * retrieved by calling getErrors();
-     *
-     * @return bool
-     * @throws \Magento\Framework\Exception
-     */
-    public function validate()
-    {
-        $v = $this->validator();
-
-        /**
-         * Validation map
-         *
-         * Format:
-         *
-         * 'key' =>  array(
-         *    'method' => this class method name to call, string, required
-         *    'method_args' => optional args for 'method' call, array, optional
-         *    'v_method' => validator method to call, string, required
-         *    'error' => custom error string when validation fails, optional
-         *               if not set, error string fprmatted as "Invalid '$key' specified"
-         *    'v_error_method' => validator method - when called returned error string
-         *                        prepared by validator, optional,
-         *                        if not set => see 'error'
-         *    'optional' => optional value, if it's empty validation result ignored
-         *
-         */
-        $validateMap = array(
-            'name' => array(
-                'method' => 'getName',
-                'v_method' => 'validatePackageName',
-                'error' => "Invalid package name, allowed: [a-zA-Z0-9_-] chars"
-            ),
-            'version' => array(
-                'method' => 'getVersion',
-                'v_method' => 'validateVersion',
-                'error' => "Invalid version, should be like: x.x.x"
-            ),
-            'stability' => array(
-                'method' => 'getStability',
-                'v_method' => 'validateStability',
-                'error' => "Invalid stability"
-            ),
-            'date' => array(
-                'method' => 'getDate',
-                'v_method' => 'validateDate',
-                'error' => "Invalid date, should be YYYY-DD-MM"
-            ),
-            'license_uri' => array(
-                'method' => 'getLicenseUri',
-                'v_method' => 'validateLicenseUrl',
-                'error' => "Invalid license URL"
-            ),
-            'channel' => array(
-                'method' => 'getChannel',
-                'v_method' => 'validateChannelNameOrUri',
-                'error' => "Invalid channel URL"
-            ),
-            'authors' => array(
-                'method' => 'getAuthors',
-                'v_method' => 'validateAuthors',
-                'v_error_method' => 'getErrors'
-            ),
-            'php_min' => array(
-                'method' => 'getDependencyPhpVersionMin',
-                'v_method' => 'validateVersion',
-                'error' => 'PHP minimum version invalid',
-                'optional' => true
-            ),
-            'php_max' => array(
-                'method' => 'getDependencyPhpVersionMax',
-                'v_method' => 'validateVersion',
-                'error' => 'PHP maximum version invalid',
-                'optional' => true
-            ),
-            'compatible' => array(
-                'method' => 'getCompatible',
-                'v_method' => 'validateCompatible',
-                'v_error_method' => 'getErrors'
-            )
-        );
-
-        $errors = array();
-        /**
-         * Iterate validation map
-         */
-        foreach ($validateMap as $name => $data) {
-
-            /**
-             * Check mandatory rules fields
-             */
-            if (!isset($data['method'], $data['v_method'])) {
-                throw new \Magento\Framework\Exception("Invalid rules specified!");
-            }
-
-            $method = $data['method'];
-            $validatorMethod = $data['v_method'];
-
-            /**
-             * If $optional === false, value is mandatory
-             */
-            $optional = isset($data['optional']) ? (bool)$data['optional'] : false;
-
-            /**
-             * Check for method availability, package
-             */
-            if (!method_exists($this, $method)) {
-                throw new \Magento\Framework\Exception("Invalid method specified for Package : {$method}");
-            }
-
-            /**
-             * Check for method availability, validator
-             */
-            if (!method_exists($v, $validatorMethod) || !is_callable([$v, $validatorMethod])) {
-                throw new \Magento\Framework\Exception("Invalid method specified for Validator : {$validatorMethod}");
-            }
-
-            /**
-             * If    $data['error'] => get error string from $data['error']
-             * Else  concatenate "Invalid '{$name}' specified"
-             */
-            $errorString = isset($data['error']) ? $data['error'] : "Invalid '{$name}' specified";
-
-            /**
-             * Additional method args check
-             * array() by default
-             */
-            $methodArgs = isset($data['method_args']) ? $data['method_args'] : array();
-
-            /**
-             * Call package method
-             */
-            $out = @call_user_func_array(array($this, $method), $methodArgs);
-
-            /**
-             * Skip if result is empty and value is optional
-             */
-            if (empty($out) && $optional) {
-                continue;
-            }
-
-            /**
-             * Additional validator arguments, merged with array($out)
-             */
-            $validatorArgs = isset($data['v_args']) ? array_merge(array($out), $data['v_args']) : array($out);
-
-            /**
-             * Get validation result
-             */
-            $result = call_user_func_array(array($v, $validatorMethod), $validatorArgs);
-
-            /**
-             * Skip if validation success
-             */
-            if ($result) {
-                continue;
-            }
-
-            /**
-             * From where to get error string?
-             * If    validator callback method specified, call it to get errors array
-             * Else  get it from $errorString - local error string
-             */
-            $validatorFetchErrorsMethod = isset($data['v_error_method']) ? $data['v_error_method'] : false;
-            if (false !== $validatorFetchErrorsMethod) {
-                $errorString = call_user_func_array(array($v, $validatorFetchErrorsMethod), array());
-            }
-
-            /**
-             * If   errors is array => merge
-             * Else append
-             */
-            if (is_array($errorString)) {
-                $errors = array_merge($errors, $errorString);
-            } else {
-                $errors[] = $errorString;
-            }
-        }
-        /**
-         * Set local errors
-         */
-        $this->setErrors($errors);
-        /**
-         * Return true if there's no errors :)
-         */
-        return !$this->hasErrors();
-    }
-
-    /**
-     * Return package release filename w/o extension
-     * @return string
-     */
-    public function getReleaseFilename()
-    {
-        return $this->getName() . "-" . $this->getVersion();
-    }
-
-    /**
-     * Return release filepath w/o extension
-     * @return string
-     */
-    public function getRelaseDirFilename()
-    {
-        return $this->getName() . '/' . $this->getVersion() . '/' . $this->getReleaseFilename();
-    }
-
-    /**
-     * Clear dependencies
-     *
-     * @return $this
-     */
-    public function clearDependencies()
-    {
-        $this->_packageXml->dependencies = null;
-        return $this;
-    }
-
-    /**
-     * Clear contents
-     *
-     * @return $this
-     */
-    public function clearContents()
-    {
-        $this->_packageXml->contents = null;
-        return $this;
-    }
-
-    /**
-     * Convert package channel in order for it to be compatible with previous version of Magento Connect Manager
-     *
-     * @param string $channel
-     * @return string
-     */
-    protected function _convertChannelToV1x($channel)
-    {
-        $channelMap = array('community' => 'connect.magentocommerce.com/community');
-        if (isset($channelMap[$channel])) {
-            $channel = $channelMap[$channel];
-        }
-        return $channel;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Package/Hotfix.php b/lib/internal/Magento/Framework/Connect/Package/Hotfix.php
deleted file mode 100644
index 5efce20fa1d0ae72be5d45782e5cdbeabee4beea..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Package/Hotfix.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Package;
-
-/**
- * Class to work with Magento Connect Hotfix
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Hotfix extends \Magento\Framework\Connect\Package
-{
-    /**
-     * Initializes an empty package object
-     *
-     * @param null|string $definition optional package definition xml
-     * @return $this
-     */
-    protected function _init($definition = null)
-    {
-
-        if (!is_null($definition)) {
-            $this->_packageXml = simplexml_load_string($definition);
-        } else {
-            $packageXmlStub = <<<END
-<?xml version="1.0"?>
-<package>
-    <name />
-    <version />
-    <stability />
-    <license />
-    <channel />
-    <extends />
-    <summary />
-    <description />
-    <notes />
-    <authors />
-    <date />
-    <time />
-    <replace />
-    <compatible />
-    <dependencies />
-</package>
-END;
-            $this->_packageXml = simplexml_load_string($packageXmlStub);
-        }
-        return $this;
-    }
-
-    /**
-     * Add content to node <replace/>
-     *
-     * @param string $path
-     * @param string $targetName
-     * @return $this
-     */
-    public function addReplace($path, $targetName)
-    {
-        $found = false;
-        $parent = $this->_getNode('target', $this->_packageXml->replace, $targetName);
-        $path = str_replace('\\', '/', $path);
-        $directories = explode('/', dirname($path));
-        foreach ($directories as $directory) {
-            $parent = $this->_getNode('dir', $parent, $directory);
-        }
-        $fileName = basename($path);
-        if ($fileName != '') {
-            $fileNode = $parent->addChild('file');
-            $fileNode->addAttribute('name', $fileName);
-        }
-        return $this;
-    }
-
-    /**
-     * Add directory recursively (with subdirectory and file).
-     * Exclude and Include can be add using Regular Expression.
-     *
-     * @param string $targetName Target name
-     * @param string $targetDir Path for target name
-     * @param string $path Path to directory
-     * @param string $exclude Exclude
-     * @param string $include Include
-     * @return $this
-     */
-    public function addReplaceDir($targetName, $targetDir, $path, $exclude = null, $include = null)
-    {
-        $targetDirLen = strlen($targetDir);
-        //get all subdirectories and files.
-        $entries = @glob($targetDir . $path . '/*');
-        if (!empty($entries)) {
-            foreach ($entries as $entry) {
-                $filePath = substr($entry, $targetDirLen);
-                if (!empty($include) && !preg_match($include, $filePath)) {
-                    continue;
-                }
-                if (!empty($ignore) && preg_match($exclude, $filePath)) {
-                    continue;
-                }
-                if (is_dir($entry)) {
-                    $baseName = basename($entry);
-                    if ('.' === $baseName || '..' === $baseName) {
-                        continue;
-                    }
-                    //for subdirectory call method recursively
-                    $this->addReplaceDir($targetName, $targetDir, $filePath, $exclude, $include);
-                } elseif (is_file($entry)) {
-                    $this->addReplace($filePath, $targetName);
-                }
-            }
-        }
-        return $this;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Package/Reader.php b/lib/internal/Magento/Framework/Connect/Package/Reader.php
deleted file mode 100644
index 6b22c215a96805e896e9836d8c9ed166a79cbca7..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Package/Reader.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Package;
-
-/**
- * Class to get package.xml from different places.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Reader
-{
-    /**
-     * Name of package file
-     */
-    const DEFAULT_NAME_PACKAGE = 'package.xml';
-
-    /**
-     * Temporary dir for extract DEFAULT_NAME_PACKAGE.
-     */
-    const PATH_TO_TEMPORARY_DIRECTORY = 'var/package/tmp/';
-
-    /**
-     * Current path to file.
-     *
-     * @var string
-     */
-    protected $_file = '';
-
-    /**
-     * Archivator is used for extract DEFAULT_NAME_PACKAGE.
-     *
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archivator = null;
-
-    /**
-     * Constructor initializes $_file.
-     *
-     * @param string $file
-     */
-    public function __construct($file = '')
-    {
-        if ($file) {
-            $this->_file = $file;
-        } else {
-            $this->_file = self::DEFAULT_NAME_PACKAGE;
-        }
-        return $this;
-    }
-
-    /**
-     * Retrieve archivator.
-     *
-     * @return \Magento\Framework\Archive
-     */
-    protected function _getArchivator()
-    {
-        if (is_null($this->_archivator)) {
-            $this->_archivator = new \Magento\Framework\Archive();
-        }
-        return $this->_archivator;
-    }
-
-    /**
-     * Open file directly or from archive and return his content.
-     *
-     * @return string Content of file $file
-     * @throws \Exception
-     */
-    public function load()
-    {
-        if (!is_file($this->_file) || !is_readable($this->_file)) {
-            throw new \Exception('Invalid package file specified.');
-        }
-        if ($this->_getArchivator()->isArchive($this->_file)) {
-            @mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true);
-            $this->_file = $this->_getArchivator()->extract(
-                self::DEFAULT_NAME_PACKAGE,
-                $this->_file,
-                self::PATH_TO_TEMPORARY_DIRECTORY
-            );
-        }
-        $xmlContent = $this->_readFile();
-        return $xmlContent;
-    }
-
-    /**
-     * Read content file.
-     *
-     * @return string Content of file $file
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _readFile()
-    {
-        $handle = fopen($this->_file, 'r');
-        try {
-            $data = $this->_loadResource($handle);
-        } catch (\Magento\Framework\Exception $e) {
-            fclose($handle);
-            throw $e;
-        }
-        fclose($handle);
-        return $data;
-    }
-
-    /**
-     * Loads a package from specified resource
-     *
-     * @param resource &$resource only file resources are supported at the moment
-     * @return \Magento\Framework\Connect\Package
-     * @throws \Magento\Framework\Exception
-     */
-    protected function _loadResource(&$resource)
-    {
-        $data = '';
-        //var_dump("====", $res, get_resource_type($resource));
-        if ('stream' === get_resource_type($resource)) {
-            while (!feof($resource)) {
-                $data .= fread($resource, 10240);
-            }
-        } else {
-            throw new \Magento\Framework\Exception('Unsupported resource type');
-        }
-        return $data;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Package/Target.php b/lib/internal/Magento/Framework/Connect/Package/Target.php
deleted file mode 100644
index b2927a795290deb772ae4e933f5180b224ef486e..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Package/Target.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Class to get targets and their basepath from target.xml.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect\Package;
-
-class Target
-{
-    /**
-     * Object contains all contents from target.xml.
-     *
-     * @var array
-     */
-    protected $_targetMap = null;
-
-    /**
-     * Cache for targets.
-     *
-     * @var array
-     */
-    protected $_targets;
-
-    /**
-     * Retrieve content from target.xml.
-     *
-     * @return \SimpleXMLElement
-     */
-    protected function _getTargetMap()
-    {
-        if (is_null($this->_targetMap)) {
-            $this->_targetMap = array();
-            $this->_targetMap[] = array('name' => "magecore", 'label' => "Magento module file", 'uri' => "./app/code");
-            $this->_targetMap[] = array(
-                'name' => "magedesign",
-                'label' => "Magento User Interface (layouts, templates)",
-                'uri' => "./app/design"
-            );
-            $this->_targetMap[] = array(
-                'name' => "mageetc",
-                'label' => "Magento Global Configuration",
-                'uri' => "./app/etc"
-            );
-            $this->_targetMap[] = array('name' => "magelib", 'label' => "Magento PHP Library file", 'uri' => "./lib/internal");
-            $this->_targetMap[] = array(
-                'name' => "magelocale",
-                'label' => "Magento Locale language file",
-                'uri' => "./app/locale"
-            );
-            $this->_targetMap[] = array('name' => "magemedia", 'label' => "Magento Media library", 'uri' => "./media");
-            $this->_targetMap[] = array(
-                'name' => "mageskin",
-                'label' => "Magento Theme Skin (Images, CSS, JS)",
-                'uri' => "./skin"
-            );
-            $this->_targetMap[] = array(
-                'name' => "mageweb",
-                'label' => "Magento Other web accessible file",
-                'uri' => "."
-            );
-            $this->_targetMap[] = array('name' => "magetest", 'label' => "Magento PHPUnit test", 'uri' => "./tests");
-            $this->_targetMap[] = array('name' => "mage", 'label' => "Magento other", 'uri' => ".");
-        }
-        return $this->_targetMap;
-    }
-
-    /**
-     * Retrieve targets as associative array from target.xml.
-     *
-     * @return array
-     */
-    public function getTargets()
-    {
-        if (!is_array($this->_targets)) {
-            $this->_targets = array();
-            if ($this->_getTargetMap()) {
-                foreach ($this->_getTargetMap() as $_target) {
-                    $this->_targets[$_target['name']] = (string)$_target['uri'];
-                }
-            }
-        }
-        return $this->_targets;
-    }
-
-    /**
-     * Retrieve tragets with label for select options.
-     *
-     * @return array
-     */
-    public function getLabelTargets()
-    {
-        $targets = array();
-        foreach ($this->_getTargetMap() as $_target) {
-            $targets[$_target['name']] = $_target['label'];
-        }
-        return $targets;
-    }
-
-    /**
-     * Get uri by target's name.
-     *
-     * @param string $name
-     * @return string
-     */
-    public function getTargetUri($name)
-    {
-        foreach ($this->getTargets() as $_name => $_uri) {
-            if ($name == $_name) {
-                return $_uri;
-            }
-        }
-        return '';
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Package/VO.php b/lib/internal/Magento/Framework/Connect/Package/VO.php
deleted file mode 100644
index 513afd4414ede1853ba206139d5e7d85428ed403..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Package/VO.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Package;
-
-class VO implements \Iterator
-{
-    /**
-     * @var array
-     */
-    protected $properties = array(
-        'name' => '',
-        'package_type_vesrion' => '',
-        'cahnnel' => '',
-        'extends' => '',
-        'summary' => '',
-        'description' => '',
-        'authors' => '',
-        'date' => '',
-        'time' => '',
-        'version' => '',
-        'stability' => 'dev',
-        'license' => '',
-        'license_uri' => '',
-        'contents' => '',
-        'compatible' => '',
-        'hotfix' => ''
-    );
-
-    /**
-     * @return void
-     */
-    public function rewind()
-    {
-        reset($this->properties);
-    }
-
-    /**
-     * @return bool
-     */
-    public function valid()
-    {
-        return current($this->properties) !== false;
-    }
-
-    /**
-     * @return string
-     */
-    public function key()
-    {
-        return key($this->properties);
-    }
-
-    /**
-     * @return string
-     */
-    public function current()
-    {
-        return current($this->properties);
-    }
-
-    /**
-     * @return void
-     */
-    public function next()
-    {
-        next($this->properties);
-    }
-
-    /**
-     * @param string $var
-     * @return null|string
-     */
-    public function __get($var)
-    {
-        if (isset($this->properties[$var])) {
-            return $this->properties[$var];
-        }
-        return null;
-    }
-
-    /**
-     * @param string $var
-     * @param null|string $value
-     * @return void
-     */
-    public function __set($var, $value)
-    {
-        if (is_string($value)) {
-            $value = trim($value);
-        }
-        if (isset($this->properties[$var])) {
-            if ($value === null) {
-                $value = '';
-            }
-            $this->properties[$var] = $value;
-        }
-    }
-
-    /**
-     * @return array
-     */
-    public function toArray()
-    {
-        return $this->properties;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Package/Writer.php b/lib/internal/Magento/Framework/Connect/Package/Writer.php
deleted file mode 100644
index 1dd5f05335ea26bff72f9db77367d6b957e5afd9..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Package/Writer.php
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Package;
-
-/**
- * Class to create archive.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Writer
-{
-    /**
-     * Name of package configuration file
-     */
-    const DEFAULT_NAME_PACKAGE_CONFIG = 'package.xml';
-
-    /**
-     * Temporary dir for extract DEFAULT_NAME_PACKAGE.
-     */
-    const PATH_TO_TEMPORARY_DIRECTORY = 'var/package/tmp/';
-
-    /**
-     * Files are used in package.
-     *
-     * @var array
-     */
-    protected $_files = array();
-
-    /**
-     * Archivator is used for extract DEFAULT_NAME_PACKAGE.
-     *
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archivator = null;
-
-    /**
-     * Name of package with extension. Extension should be only one.
-     * "package.tar.gz" is not ability, only "package.tgz".
-     *
-     * @var string
-     */
-    protected $_namePackage = 'package';
-
-    /**
-     * Temporary directory where package is situated.
-     *
-     * @var string
-     */
-    protected $_temporaryPackageDir = '';
-
-    /**
-     * Path to archive with package.
-     *
-     * @var string
-     */
-    protected $_pathToArchive = '';
-
-    /**
-     * Constructor initializes $_file.
-     *
-     * @param array $files
-     * @param string $namePackage
-     */
-    public function __construct($files, $namePackage = '')
-    {
-        $this->_files = $files;
-        $this->_namePackage = $namePackage;
-        return $this;
-    }
-
-    /**
-     * Retrieve archivator.
-     *
-     * @return \Magento\Framework\Archive
-     */
-    protected function _getArchivator()
-    {
-        if (is_null($this->_archivator)) {
-            $this->_archivator = new \Magento\Framework\Archive();
-        }
-        return $this->_archivator;
-    }
-
-    /**
-     * Create dir in PATH_TO_TEMPORARY_DIRECTORY and move all files
-     * to this dir.
-     *
-     * @return $this
-     */
-    public function composePackage()
-    {
-        @mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true);
-        $root = self::PATH_TO_TEMPORARY_DIRECTORY . basename($this->_namePackage);
-        @mkdir($root, 0777, true);
-        foreach ($this->_files as $file) {
-
-            if (is_dir($file) || is_file($file)) {
-                $fileName = basename($file);
-                $filePath = dirname($file);
-                @mkdir($root . '/' . $filePath, 0777, true);
-                if (is_file($file)) {
-                    copy($file, $root . '/' . $filePath . '/' . $fileName);
-                } else {
-                    @mkdir($root . '/' . $filePath . $fileName, 0777);
-                }
-            }
-        }
-        $this->_temporaryPackageDir = $root;
-        return $this;
-    }
-
-    /**
-     * Create dir in PATH_TO_TEMPORARY_DIRECTORY and move all files
-     * to this dir.
-     * This dir has a structure compatible with previous version of Magento Connact Manager
-     *
-     * @param array $destinationFiles
-     * @return $this
-     */
-    public function composePackageV1x(array $destinationFiles)
-    {
-        @mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true);
-        $root = self::PATH_TO_TEMPORARY_DIRECTORY . basename($this->_namePackage);
-        @mkdir($root, 0777, true);
-        $packageFilesDir = $root . '/' . basename($this->_namePackage);
-        @mkdir($packageFilesDir, 0777, true);
-        foreach ($this->_files as $index => $file) {
-            $destinationFile = $destinationFiles[$index];
-            if (is_dir($file) || is_file($file)) {
-                $fileName = basename($destinationFile);
-                $filePath = dirname($destinationFile);
-                @mkdir($packageFilesDir . '/' . $filePath, 0777, true);
-                if (is_file($file)) {
-                    copy($file, $packageFilesDir . '/' . $filePath . '/' . $fileName);
-                } else {
-                    @mkdir($packageFilesDir . '/' . $filePath . $fileName, 0777);
-                }
-            }
-        }
-        $this->_temporaryPackageDir = $root;
-        return $this;
-    }
-
-    /**
-     * Add package.xml to temporary package directory.
-     *
-     * @param mixed $content
-     * @return $this
-     */
-    public function addPackageXml($content)
-    {
-        file_put_contents($this->_temporaryPackageDir . '/' . self::DEFAULT_NAME_PACKAGE_CONFIG, $content);
-        return $this;
-    }
-
-    /**
-     * Archives package.
-     *
-     * @return $this
-     */
-    public function archivePackage()
-    {
-        $this->_pathToArchive = $this->_getArchivator()->pack(
-            $this->_temporaryPackageDir,
-            $this->_namePackage . '.tgz',
-            true
-        );
-
-        //delete temporary dir
-        \Magento\Framework\System\Dirs::rm(array("-r", $this->_temporaryPackageDir));
-        return $this;
-    }
-
-    /**
-     * Getter for pathToArchive
-     *
-     * @return string
-     */
-    public function getPathToArchive()
-    {
-        return $this->_pathToArchive;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Packager.php b/lib/internal/Magento/Framework/Connect/Packager.php
deleted file mode 100644
index bba1cc61359e2cc0cd735d7f696a9bacbde69117..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Packager.php
+++ /dev/null
@@ -1,724 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-use Magento\Framework\HTTP\IClient;
-
-/**
- * Class to manipulate with packages
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Packager
-{
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     *
-     * @var \Magento\Framework\Archive
-     */
-    protected $_archiver = null;
-
-    /**
-     * @var IClient
-     */
-    protected $_http = null;
-
-    /**
-     *
-     * @return \Magento\Framework\Archive
-     */
-    public function getArchiver()
-    {
-        if (is_null($this->_archiver)) {
-            $this->_archiver = new \Magento\Framework\Archive();
-        }
-        return $this->_archiver;
-    }
-
-    /**
-     * @return IClient
-     */
-    public function getDownloader()
-    {
-        if (is_null($this->_http)) {
-            $this->_http = \Magento\Framework\HTTP\Client::getInstance();
-        }
-        return $this->_http;
-    }
-
-    /**
-     * @param string $ftpString
-     * @return \Magento\Framework\Object[]
-     */
-    public function getRemoteConf($ftpString)
-    {
-        $ftpObj = new Ftp();
-        $ftpObj->connect($ftpString);
-        $cfgFile = "connect.cfg";
-        $cacheFile = "cache.cfg";
-
-
-        $wd = $ftpObj->getcwd();
-
-        $remoteConfigExists = $ftpObj->fileExists($cfgFile);
-        $tempConfigFile = uniqid($cfgFile . "_temp");
-        if (!$remoteConfigExists) {
-            $remoteCfg = new Config($tempConfigFile);
-            $remoteCfg->store();
-            $ftpObj->upload($cfgFile, $tempConfigFile);
-        } else {
-            $ftpObj->get($tempConfigFile, $cfgFile);
-            $remoteCfg = new Config($tempConfigFile);
-        }
-
-        $ftpObj->chdir($wd);
-
-        $remoteCacheExists = $ftpObj->fileExists($cacheFile);
-        $tempCacheFile = uniqid($cacheFile . "_temp");
-
-        if (!$remoteCacheExists) {
-            $remoteCache = new Singleconfig($tempCacheFile);
-            $remoteCache->clear();
-            $ftpObj->upload($cacheFile, $tempCacheFile);
-        } else {
-            $ftpObj->get($tempCacheFile, $cacheFile);
-            $remoteCache = new Singleconfig($tempCacheFile);
-        }
-        $ftpObj->chdir($wd);
-        return array($remoteCache, $remoteCfg, $ftpObj);
-    }
-
-    /**
-     * @param string $ftpString
-     * @return \Magento\Framework\Object[]
-     */
-    public function getRemoteCache($ftpString)
-    {
-
-        $ftpObj = new Ftp();
-        $ftpObj->connect($ftpString);
-        $remoteConfigExists = $ftpObj->fileExists("cache.cfg");
-        if (!$remoteConfigExists) {
-            $configFile = uniqid("temp_cachecfg_");
-            $remoteCfg = new Singleconfig($configFile);
-            $remoteCfg->clear();
-            $ftpObj->upload("cache.cfg", $configFile);
-        } else {
-            $configFile = uniqid("temp_cachecfg_");
-            $ftpObj->get($configFile, "cache.cfg");
-            $remoteCfg = new Singleconfig($configFile);
-        }
-        return array($remoteCfg, $ftpObj);
-    }
-
-    /**
-     * @param string $ftpString
-     * @return \Magento\Framework\Object[]
-     */
-    public function getRemoteConfig($ftpString)
-    {
-        $ftpObj = new Ftp();
-        $ftpObj->connect($ftpString);
-        $cfgFile = "connect.cfg";
-
-        $wd = $ftpObj->getcwd();
-        $remoteConfigExists = $ftpObj->fileExists($cfgFile);
-        $tempConfigFile = uniqid($cfgFile . "_temp");
-        if (!$remoteConfigExists) {
-            $remoteCfg = new Config($tempConfigFile);
-            $remoteCfg->store();
-            $ftpObj->upload($cfgFile, $tempConfigFile);
-        } else {
-            $ftpObj->get($tempConfigFile, $cfgFile);
-            $remoteCfg = new Config($tempConfigFile);
-        }
-        $ftpObj->chdir($wd);
-        return array($remoteCfg, $ftpObj);
-    }
-
-    /**
-     * @param Singleconfig $cache
-     * @param Ftp $ftpObj
-     * @return void
-     */
-    public function writeToRemoteCache($cache, $ftpObj)
-    {
-        $wd = $ftpObj->getcwd();
-        $ftpObj->upload("cache.cfg", $cache->getFilename());
-        @unlink($cache->getFilename());
-        $ftpObj->chdir($wd);
-    }
-
-    /**
-     * @param Singleconfig $cache
-     * @param Ftp $ftpObj
-     * @return void
-     */
-    public function writeToRemoteConfig($cache, $ftpObj)
-    {
-        $wd = $ftpObj->getcwd();
-        $ftpObj->upload("connect.cfg", $cache->getFilename());
-        @unlink($cache->getFilename());
-        $ftpObj->chdir($wd);
-    }
-
-    /**
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param Singleconfig $cacheObj
-     * @param Config $configObj
-     * @return void
-     */
-    public function processUninstallPackage($chanName, $package, $cacheObj, $configObj)
-    {
-        $package = $cacheObj->getPackageObject($chanName, $package);
-        $contents = $package->getContents();
-
-        $targetPath = rtrim($configObj->magento_root, "\\/");
-        foreach ($contents as $file) {
-            $fileName = basename($file);
-            $filePath = dirname($file);
-            $dest = $targetPath . '/' . $filePath . '/' . $fileName;
-            if (@file_exists($dest)) {
-                //var_dump($dest);
-                @unlink($dest);
-            }
-        }
-    }
-
-    /**
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param Singleconfig $cacheObj
-     * @param Ftp $ftp
-     * @return void
-     */
-    public function processUninstallPackageFtp($chanName, $package, $cacheObj, $ftp)
-    {
-        $ftpDir = $ftp->getcwd();
-        $package = $cacheObj->getPackageObject($chanName, $package);
-        $contents = $package->getContents();
-        foreach ($contents as $file) {
-            $res = $ftp->delete($file);
-        }
-        $ftp->chdir($ftpDir);
-    }
-
-    /**
-     * @param string $str
-     * @return string
-     */
-    protected function convertFtpPath($str)
-    {
-        return str_replace("\\", "/", $str);
-    }
-
-    /**
-     *
-     * @param string $package
-     * @param string $file
-     * @param Config $configObj
-     * @param Ftp $ftp
-     * @return void
-     */
-    public function processInstallPackageFtp($package, $file, $configObj, $ftp)
-    {
-        $ftpDir = $ftp->getcwd();
-        $contents = $package->getContents();
-        $arc = $this->getArchiver();
-        $target = dirname($file) . '/' . $package->getReleaseFilename();
-        @mkdir($target, 0777, true);
-        $mode = $configObj->global_dir_mode;
-        $tar = $arc->unpack($file, $target);
-        $modeFile = $configObj->global_file_mode;
-        $modeDir = $configObj->global_dir_mode;
-        foreach ($contents as $file) {
-            $fileName = basename($file);
-            $filePath = $this->convertFtpPath(dirname($file));
-            $source = $tar . '/' . $file;
-            if (file_exists($source) && is_file($source)) {
-                $args = array(ltrim($file, "/"), $source);
-                if ($modeDir) {
-                    $args[] = $modeDir;
-                }
-                call_user_func_array(array($ftp, 'upload'), $args);
-            }
-        }
-        $ftp->chdir($ftpDir);
-        \Magento\Framework\System\Dirs::rm(array("-r", $target));
-    }
-
-    /**
-     * Package installation to FS
-     * @param \Magento\Framework\Connect\Package $package
-     * @param string $file
-     * @param Config $configObj
-     * @return void
-     * @throws \Exception
-     */
-    public function processInstallPackage($package, $file, $configObj)
-    {
-        $contents = $package->getContents();
-        $arc = $this->getArchiver();
-        $target = dirname($file) . '/' . $package->getReleaseFilename();
-        @mkdir($target, 0777, true);
-        $mode = $configObj->global_dir_mode;
-        $tar = $arc->unpack($file, $target);
-        $modeFile = $configObj->global_file_mode;
-        $modeDir = $configObj->global_dir_mode;
-        foreach ($contents as $file) {
-            $fileName = basename($file);
-            $filePath = dirname($file);
-            $source = $tar . '/' . $file;
-            $targetPath = rtrim($configObj->magento_root, "\\/");
-            @mkdir($targetPath . '/' . $filePath, $modeDir, true);
-            $dest = $targetPath . '/' . $filePath . '/' . $fileName;
-            if (is_file($source)) {
-                @copy($source, $dest);
-                if ($modeFile) {
-                    @chmod($dest, $modeFile);
-                }
-            } else {
-                @mkdir($dest, $modeDir);
-            }
-        }
-        \Magento\Framework\System\Dirs::rm(array("-r", $target));
-    }
-
-    /**
-     * Get local modified files
-     * @param string $chanName
-     * @param string $package
-     * @param Singleconfig $cacheObj
-     * @param Config $configObj
-     * @return string[]
-     */
-    public function getLocalModifiedFiles($chanName, $package, $cacheObj, $configObj)
-    {
-        $p = $cacheObj->getPackageObject($chanName, $package);
-        $hashContents = $p->getHashContents();
-        $listModified = array();
-        foreach ($hashContents as $file => $hash) {
-            if (md5_file($configObj->magento_root . '/' . $file) !== $hash) {
-                $listModified[] = $file;
-            }
-        }
-        return $listModified;
-    }
-
-    /**
-     * Get remote modified files
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param Singleconfig $cacheObj
-     * @param Ftp $ftp
-     * @return string[]
-     */
-    public function getRemoteModifiedFiles($chanName, $package, $cacheObj, $ftp)
-    {
-        $p = $cacheObj->getPackageObject($chanName, $package);
-        $hashContents = $p->getHashContents();
-        $listModified = array();
-        foreach ($hashContents as $file => $hash) {
-            $localFile = uniqid("temp_remote_");
-            if (!$ftp->fileExists($file)) {
-                continue;
-            }
-            $ftp->get($localFile, $file);
-            if (file_exists($localFile) && md5_file($localFile) !== $hash) {
-                $listModified[] = $file;
-            }
-            @unlink($localFile);
-        }
-        return $listModified;
-    }
-
-    /**
-     * Get upgrades list
-     *
-     * @param string/array $channels
-     * @param Singleconfig $cacheObject
-     * @param Config $configObj
-     * @param \Magento\Framework\Connect\Rest $restObj optional
-     * @param bool $checkConflicts
-     * @return array
-     */
-    public function getUpgradesList($channels, $cacheObject, $configObj, $restObj = null, $checkConflicts = false)
-    {
-        if (is_scalar($channels)) {
-            $channels = array($channels);
-        }
-
-        if (!$restObj) {
-            $restObj = new \Magento\Framework\Connect\Rest();
-        }
-
-        $updates = array();
-        foreach ($channels as $chan) {
-
-            if (!$cacheObject->isChannel($chan)) {
-                continue;
-            }
-            $chanName = $cacheObject->chanName($chan);
-            $localPackages = $cacheObject->getInstalledPackages($chanName);
-            $localPackages = $localPackages[$chanName];
-
-            if (!count($localPackages)) {
-                continue;
-            }
-
-            $channel = $cacheObject->getChannel($chan);
-            $uri = $channel[Singleconfig::K_URI];
-            $restObj->setChannel($uri);
-            $remotePackages = $restObj->getPackagesHashed();
-
-            /**
-             * Iterate packages of channel $chan
-             */
-            $state = $configObj->preferred_state ? $configObj->preferred_state : "devel";
-
-            foreach ($localPackages as $localName => $localData) {
-                if (!isset($remotePackages[$localName])) {
-                    continue;
-                }
-                $package = $remotePackages[$localName];
-                $neededToUpgrade = false;
-                $remoteVersion = $localVersion = trim($localData[Singleconfig::K_VER]);
-                foreach ($package as $version => $s) {
-
-                    if ($cacheObject->compareStabilities($s, $state) < 0) {
-                        continue;
-                    }
-
-                    if (version_compare($version, $localVersion, ">")) {
-                        $neededToUpgrade = true;
-                        $remoteVersion = $version;
-                    }
-
-                    if ($checkConflicts) {
-                        $conflicts = $cacheObject->hasConflicts($chanName, $localName, $remoteVersion);
-                        if (false !== $conflicts) {
-                            $neededToUpgrade = false;
-                        }
-                    }
-                }
-                if (!$neededToUpgrade) {
-                    continue;
-                }
-                if (!isset($updates[$chanName])) {
-                    $updates[$chanName] = array();
-                }
-                $updates[$chanName][$localName] = array("from" => $localVersion, "to" => $remoteVersion);
-            }
-        }
-        return $updates;
-    }
-
-    /**
-     * Get uninstall list
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param Singleconfig $cache
-     * @param Config $config
-     * @param bool $withDepsRecursive
-     * @return array|void
-     */
-    public function getUninstallList($chanName, $package, $cache, $config, $withDepsRecursive = true)
-    {
-        static $level = 0;
-        static $hash = array();
-
-        $chanName = $cache->chanName($chanName);
-        $keyOuter = $chanName . "/" . $package;
-        $level++;
-
-        try {
-            $chanName = $cache->chanName($chanName);
-            if (!$cache->hasPackage($chanName, $package)) {
-                $level--;
-                if ($level == 0) {
-                    $hash = array();
-                    return array('list' => array());
-                }
-                return;
-            }
-            $dependencies = $cache->getPackageDependencies($chanName, $package);
-            $data = $cache->getPackage($chanName, $package);
-            $version = $data['version'];
-            $keyOuter = $chanName . "/" . $package;
-
-            //print "Processing outer: {$keyOuter} \n";
-            $hash[$keyOuter] = array(
-                'name' => $package,
-                'channel' => $chanName,
-                'version' => $version,
-                'packages' => $dependencies
-            );
-
-            if ($withDepsRecursive) {
-                $flds = array('name', 'channel', 'min', 'max');
-                $fldsCount = count($flds);
-                foreach ($dependencies as $row) {
-                    foreach ($flds as $key) {
-                        $varName = "p" . ucfirst($key);
-                        ${$varName} = $row[$key];
-                    }
-                    $method = __FUNCTION__;
-                    $keyInner = $pChannel . "/" . $pName;
-                    if (!isset($hash[$keyInner])) {
-                        $this->{$method}($pChannel, $pName, $cache, $config, $withDepsRecursive, false);
-                    }
-                }
-            }
-        } catch (\Exception $e) {
-        }
-
-        $level--;
-        if (0 === $level) {
-            $out = $this->processDepsHash($hash);
-            $hash = array();
-            return array('list' => $out);
-        }
-    }
-
-    /**
-     * Get dependencies list/install order info
-     *
-     * @param string $chanName
-     * @param string $package
-     * @param Singleconfig $cache
-     * @param Config $config
-     * @param string|false $versionMax
-     * @param string|false $versionMin
-     * @param bool $withDepsRecursive
-     * @param bool $forceRemote
-     * @return array|void
-     * @throws \Exception
-     */
-    public function getDependenciesList(
-        $chanName,
-        $package,
-        $cache,
-        $config,
-        $versionMax = false,
-        $versionMin = false,
-        $withDepsRecursive = true,
-        $forceRemote = false
-    ) {
-        static $level = 0;
-        static $_depsHash = array();
-        static $_deps = array();
-        static $_failed = array();
-
-        $level++;
-
-        try {
-            $chanName = $cache->chanName($chanName);
-
-            $rest = new \Magento\Framework\Connect\Rest($config->protocol);
-            $rest->setChannel($cache->chanUrl($chanName));
-            $releases = $rest->getReleases($package);
-            if (!$releases || !count($releases)) {
-                throw new \Exception("No releases for: '{$package}', skipping");
-            }
-            $state = $config->preffered_state ? $confg->preffered_state : 'devel';
-            $version = $cache->detectVersionFromRestArray($releases, $versionMin, $versionMax, $state);
-            if (!$version) {
-                throw new \Exception("Version for '{$package}' was not detected");
-            }
-            $packageInfo = $rest->getPackageReleaseInfo($package, $version);
-            if (false === $packageInfo) {
-                throw new \Exception("Package release '{$package}' not found on server");
-            }
-            unset($rest);
-            $dependencies = $packageInfo->getDependencyPackages();
-            $keyOuter = $chanName . "/" . $package;
-
-            //print "Processing outer: {$keyOuter} \n";
-            $_depsHash[$keyOuter] = array(
-                'name' => $package,
-                'channel' => $chanName,
-                'downloaded_version' => $version,
-                'min' => $versionMin,
-                'max' => $versionMax,
-                'packages' => $dependencies
-            );
-
-            if ($withDepsRecursive) {
-                $flds = array('name', 'channel', 'min', 'max');
-                $fldsCount = count($flds);
-                foreach ($dependencies as $row) {
-                    foreach ($flds as $key) {
-                        $varName = "p" . ucfirst($key);
-                        ${$varName} = $row[$key];
-                    }
-                    $method = __FUNCTION__;
-                    $keyInner = $pChannel . "/" . $pName;
-                    if (!isset($_depsHash[$keyInner])) {
-                        $_deps[] = $row;
-                        $this->{$method}(
-                            $pChannel,
-                            $pName,
-                            $cache,
-                            $config,
-                            $pMax,
-                            $pMin,
-                            $withDepsRecursive,
-                            $forceRemote,
-                            false
-                        );
-                    } else {
-                        $downloaded = $_depsHash[$keyInner]['downloaded_version'];
-                        $hasMin = $_depsHash[$keyInner]['min'];
-                        $hasMax = $_depsHash[$keyInner]['max'];
-                        if ($pMin === $hasMin && $pMax === $hasMax) {
-                            //var_dump("Equal requirements, skipping");
-                            continue;
-                        }
-
-                        if ($cache->versionInRange($downloaded, $pMin, $pMax)) {
-                            //var_dump("Downloaded package matches new range too");
-                            continue;
-                        }
-
-                        $names = array("pMin", "pMax", "hasMin", "hasMax");
-                        for ($i = 0,$c = count($names); $i < $c; $i++) {
-                            if (!isset(${$names[$i]})) {
-                                continue;
-                            }
-                            if (false !== ${$names[$i]}) {
-                                continue;
-                            }
-                            ${$names[$i]} = $i % 2 == 0 ? "0" : "999999999";
-                        }
-
-                        if (!$cache->hasVersionRangeIntersect($pMin, $pMax, $hasMin, $hasMax)) {
-                            $reason = "Detected {$pName} conflict of versions: {$hasMin}-{$hasMax} and {$pMin}-{$pMax}";
-                            unset($_depsHash[$keyInner]);
-                            $_failed[] = array(
-                                'name' => $pName,
-                                'channel' => $pChannel,
-                                'max' => $pMax,
-                                'min' => $pMin,
-                                'reason' => $reason
-                            );
-                            continue;
-                        }
-                        $newMaxIsLess = version_compare($pMax, $hasMax, "<");
-                        $newMinIsGreater = version_compare($pMin, $hasMin, ">");
-                        $forceMax = $newMaxIsLess ? $pMax : $hasMax;
-                        $forceMin = $newMinIsGreater ? $pMin : $hasMin;
-                        //var_dump("Trying to process {$pName} : max {$forceMax} - min {$forceMin}");
-                        $this->{$method}(
-                            $pChannel,
-                            $pName,
-                            $cache,
-                            $config,
-                            $forceMax,
-                            $forceMin,
-                            $withDepsRecursive,
-                            $forceRemote
-                        );
-                    }
-                }
-            }
-        } catch (\Exception $e) {
-            $_failed[] = array(
-                'name' => $package,
-                'channel' => $chanName,
-                'max' => $versionMax,
-                'min' => $versionMin,
-                'reason' => $e->getMessage()
-            );
-        }
-
-        $level--;
-        if ($level == 0) {
-            $out = $this->processDepsHash($_depsHash);
-            $deps = $_deps;
-            $failed = $_failed;
-            $_depsHash = array();
-            $_deps = array();
-            $_failed = array();
-            return array('deps' => $deps, 'result' => $out, 'failed' => $failed);
-        }
-    }
-
-    /**
-     * Process dependencies hash
-     * Makes topological sorting and gives operation order list
-     *
-     * @param array &$depsHash
-     * @param bool $sortReverse
-     * @return array
-     */
-    protected function processDepsHash(&$depsHash, $sortReverse = true)
-    {
-        $nodes = array();
-        $graph = new \Magento\Framework\Connect\Structures\Graph();
-
-        foreach ($depsHash as $key => $data) {
-            $packages = $data['packages'];
-            $node = new \Magento\Framework\Connect\Structures\Node();
-            $nodes[$key] =& $node;
-            unset($data['packages']);
-            $node->setData($data);
-            $graph->addNode($node);
-            unset($node);
-        }
-
-        if (count($nodes) > 1) {
-            foreach ($depsHash as $key => $data) {
-                $packages = $data['packages'];
-                foreach ($packages as $pdata) {
-                    $pName = $pdata['channel'] . "/" . $pdata['name'];
-                    if (isset($nodes[$key], $nodes[$pName])) {
-                        $nodes[$key]->connectTo($nodes[$pName]);
-                    }
-                }
-            }
-        }
-        $result = $graph->topologicalSort();
-        $sortReverse ? krsort($result) : ksort($result);
-        $out = array();
-        $total = 0;
-        foreach ($result as $order => $nodes) {
-            foreach ($nodes as $n) {
-                $out[] = $n->getData();
-            }
-        }
-        unset($graph, $nodes);
-        return $out;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Rest.php b/lib/internal/Magento/Framework/Connect/Rest.php
deleted file mode 100644
index afd5cb048640a245863394ba9a301b137182a221..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Rest.php
+++ /dev/null
@@ -1,381 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-use Magento\Framework\Connect\Channel\VO;
-
-/**
- * Class to work with remote REST interface
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Rest
-{
-    const CHANNELS_XML = "channels.xml";
-
-    const CHANNEL_XML = "channel.xml";
-
-    const PACKAGES_XML = "packages.xml";
-
-    const RELEASES_XML = "releases.xml";
-
-    const PACKAGE_XML = "package.xml";
-
-    const EXT = "tgz";
-
-    /**
-     * HTTP Loader
-     * @var \Magento\Framework\HTTP\IClient
-     */
-    protected $_loader = null;
-
-    /**
-     * XML parser
-     * @var \Magento\Framework\Xml\Parser
-     */
-    protected $_parser = null;
-
-    /**
-     * Channel URI
-     * @var string
-     */
-    protected $_chanUri = '';
-
-    /**
-     * Protocol HTTP or FTP
-     *
-     * @var string http or ftp
-     */
-    protected $_protocol = '';
-
-    /**
-     * Constructor
-     *
-     * @param string $protocol
-     */
-    public function __construct($protocol = "http")
-    {
-        switch ($protocol) {
-            case 'http':
-            default:
-                $this->_protocol = 'http';
-                break;
-            case 'ftp':
-                $this->_protocol = 'ftp';
-                break;
-        }
-    }
-
-    /**
-     * Set channel info
-     *
-     * @param string $uri
-     * @return void
-     */
-    public function setChannel($uri)
-    {
-        $this->_chanUri = $uri;
-    }
-
-    /**
-     * Get HTTP loader
-     * @return \Magento\Framework\Connect\Loader
-     */
-    protected function getLoader()
-    {
-        if (is_null($this->_loader)) {
-            $this->_loader = \Magento\Framework\Connect\Loader::getInstance($this->_protocol);
-        }
-        return $this->_loader;
-    }
-
-    /**
-     * Get parser
-     *
-     * @return \Magento\Framework\Xml\Parser
-     */
-    protected function getParser()
-    {
-        if (is_null($this->_parser)) {
-            $this->_parser = new \Magento\Framework\Xml\Parser();
-        }
-        return $this->_parser;
-    }
-
-    /**
-     * Load URI response
-     * @param string $uriSuffix
-     * @return false|string
-     */
-    protected function loadChannelUri($uriSuffix)
-    {
-        $url = $this->_chanUri . "/" . $uriSuffix;
-        //print $url."\n";
-        $this->getLoader()->get($url);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        return $this->getLoader()->getBody();
-    }
-
-    /**
-     * Get channels list of URI
-     *
-     * @return VO
-     * @throws \Exception
-     */
-    public function getChannelInfo()
-    {
-        $out = $this->loadChannelUri(self::CHANNEL_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            throw new \Exception("Invalid server response for {$this->_chanUri}");
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-
-        // TODO: add channel validator
-        $vo = new VO();
-        $vo->fromArray($out['channel']);
-        if (!$vo->validate()) {
-            throw new \Exception("Invalid channel.xml file");
-        }
-        return $vo;
-    }
-
-    /**
-     * Get packages list of channel
-     *
-     * @return array|false
-     */
-    public function getPackages()
-    {
-        $out = $this->loadChannelUri(self::PACKAGES_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-
-
-        if (!isset($out['data']['p'])) {
-            return array();
-        }
-        if (isset($out['data']['p'][0])) {
-            return $out['data']['p'];
-        }
-        if (is_array($out['data']['p'])) {
-            return array($out['data']['p']);
-        }
-        return array();
-    }
-
-    /**
-     * @return array|false
-     */
-    public function getPackagesHashed()
-    {
-        $out = $this->loadChannelUri(self::PACKAGES_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-
-        $return = array();
-        if (!isset($out['data']['p'])) {
-            return $return;
-        }
-        if (isset($out['data']['p'][0])) {
-            $return = $out['data']['p'];
-        }
-        if (is_array($out['data']['p'])) {
-            $return = array($out['data']['p']);
-        }
-        $c = count($return);
-        if ($c) {
-            $output = array();
-            for ($i = 0,$c = count($return[0]); $i < $c; $i++) {
-                $element = $return[0][$i];
-                $output[$element['n']] = $element['r'];
-            }
-            $return = $output;
-        }
-
-        $out = array();
-        foreach ($return as $name => $package) {
-            $stabilities = array_map(array($this, 'shortStateToLong'), array_keys($package));
-            $versions = array_map('trim', array_values($package));
-            $package = array_combine($versions, $stabilities);
-            ksort($package);
-            $out[$name] = $package;
-        }
-        return $out;
-    }
-
-    /**
-     * Stub
-     * @param string $n
-     * @return string
-     */
-    public function escapePackageName($n)
-    {
-        return $n;
-    }
-
-    /**
-     * Get releases list of package on current channel
-     * @param string $package package name
-     * @return false|array
-     */
-    public function getReleases($package)
-    {
-        $out = $this->loadChannelUri($this->escapePackageName($package) . "/" . self::RELEASES_XML);
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            return false;
-        }
-        $parser = $this->getParser();
-        $out = $parser->loadXML($out)->xmlToArray();
-        if (!isset($out['releases']['r'])) {
-            return array();
-        }
-        $src = $out['releases']['r'];
-        if (!array_key_exists(0, $src)) {
-            return array($src);
-        }
-        $this->sortReleases($src);
-        return $src;
-    }
-
-    /**
-     * Sort releases
-     * @param array &$releases
-     * @return void
-     */
-    public function sortReleases(array &$releases)
-    {
-        usort($releases, array($this, 'sortReleasesCallback'));
-        $releases = array_reverse($releases);
-    }
-
-    /**
-     * Sort releases callback
-     * @param string $a
-     * @param string $b
-     * @return int
-     */
-    protected function sortReleasesCallback($a, $b)
-    {
-        return version_compare($a['v'], $b['v']);
-    }
-
-    /**
-     * Get package info (package.xml)
-     *
-     * @param string $package
-     * @return \Magento\Framework\Connect\Package
-     */
-    public function getPackageInfo($package)
-    {
-        $out = $this->loadChannelUri($this->escapePackageName($package) . "/" . self::PACKAGE_XML);
-        if (false === $out) {
-            return false;
-        }
-        return new \Magento\Framework\Connect\Package($out);
-    }
-
-    /**
-     *
-     * @param string $package
-     * @param string $version
-     * @return \Magento\Framework\Connect\Package
-     */
-    public function getPackageReleaseInfo($package, $version)
-    {
-        $out = $this->loadChannelUri($this->escapePackageName($package) . "/" . $version . "/" . self::PACKAGE_XML);
-        if (false === $out) {
-            return false;
-        }
-        return new \Magento\Framework\Connect\Package($out);
-    }
-
-    /**
-     * Get package archive file of release
-     *
-     * @param string $package package name
-     * @param string $version version
-     * @param string $targetFile
-     * @return true|void
-     * @throws \Exception
-     */
-    public function downloadPackageFileOfRelease($package, $version, $targetFile)
-    {
-        $package = $this->escapePackageName($package);
-        $version = $this->escapePackageName($version);
-
-
-        if (file_exists($targetFile)) {
-            $chksum = $this->loadChannelUri($package . "/" . $version . "/checksum");
-            $statusCode = $this->getLoader()->getStatus();
-            if ($statusCode == 200) {
-                if (md5_file($targetFile) == $chksum) {
-                    return true;
-                }
-            }
-        }
-
-
-        $out = $this->loadChannelUri($package . "/" . $version . "/" . $package . "-" . $version . "." . self::EXT);
-
-        $statusCode = $this->getLoader()->getStatus();
-        if ($statusCode != 200) {
-            throw new \Exception("Package not found: {$package} {$version}");
-        }
-        $dir = dirname($targetFile);
-        @mkdir($dir, 0777, true);
-        $result = @file_put_contents($targetFile, $out);
-        if (false === $result) {
-            throw new \Exception("Cannot write to file {$targetFile}");
-        }
-        return true;
-    }
-
-    /**
-     * @var array
-     */
-    protected $states = array('b' => 'beta', 'd' => 'dev', 's' => 'stable', 'a' => 'alpha');
-
-    /**
-     * @param string $s
-     * @return string
-     */
-    public function shortStateToLong($s)
-    {
-        return isset($this->states[$s]) ? $this->states[$s] : 'dev';
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Singleconfig.php b/lib/internal/Magento/Framework/Connect/Singleconfig.php
deleted file mode 100644
index 416fa36a5500fc520659eec8b87c05a143c2c325..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Singleconfig.php
+++ /dev/null
@@ -1,946 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to manipulate with channel/package cache file
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Singleconfig
-{
-    /**
-     * Cache data
-     * @var array
-     */
-    protected $_data = array();
-
-    /**
-     * Filename
-     * @var string
-     */
-    protected $_readFilename = false;
-
-    /**
-     *
-     * @var bool
-     */
-    protected $_debug = false;
-
-    /**
-     *
-     * @var Validator
-     */
-    protected $_validator;
-
-    /**
-     * Internal keys constants
-     */
-    const K_CHAN = 'channels_by_name';
-
-    const K_CHAN_URI = 'channels_by_uri';
-
-    const K_CHAN_ALIAS = 'channel_aliases';
-
-    const K_PACK = 'packages';
-
-    const K_URI = 'uri';
-
-    const K_CHAN_DATA = 'channel_data';
-
-    const K_NAME = 'name';
-
-    const K_VER = 'version';
-
-    const K_STATE = 'stability';
-
-    const K_XML = 'xml';
-
-    const K_DEPS = 'deps';
-
-    const K_PACK_DEPS = 'pack_deps';
-
-    const K_CONFIG = 'config';
-
-    /**
-     * @param string $str
-     * @return string|false
-     */
-    public function getValidUri($str)
-    {
-        $data = parse_url($str);
-        if (isset($data['path'])) {
-            return $data['path'];
-        }
-        return false;
-    }
-
-    /**
-     * @return string
-     */
-    public function getFilename()
-    {
-        return $this->_readFilename;
-    }
-
-    /**
-     * @param string $uri
-     * @return string
-     */
-    public function formatUri($uri)
-    {
-        $uri = rtrim($uri, "/");
-        $uri = str_replace("http://", '', $uri);
-        $uri = str_replace("ftp://", '', $uri);
-        return $uri;
-    }
-
-    /**
-     * Get data
-     * @return array
-     */
-    public function getData()
-    {
-        return $this->_data;
-    }
-
-    /**
-     * Constructor
-     * @param string $file
-     */
-    public function __construct($file = "cache.cfg")
-    {
-        $this->setEmptyConfig();
-        if ($file) {
-            $this->_readFilename = $file;
-            $this->load();
-        }
-    }
-
-    /**
-     * Load cache from file
-     *
-     * @param string|false $file
-     * @return void
-     */
-    public function load($file = false)
-    {
-        if (false === $file) {
-            $file = $this->_readFilename;
-        }
-        if (false === $file) {
-            return;
-        }
-
-        if (!file_exists($file)) {
-            $this->save($file);
-            return;
-        }
-
-        if (!is_readable($file)) {
-            return $this->doError("File is not readable: '{$file}'");
-        }
-
-        $this->_readFilename = $file;
-
-        $data = @file_get_contents($file);
-        if (false === $data) {
-            return $this->doError("Cannot get file contents: '{$file}'");
-        }
-
-        if (!$this->_debug) {
-            $data = @gzuncompress($data);
-            if (false === $data) {
-                return $this->doError("Cannot unpack gzipped data in file contents: '{$file}'");
-            }
-        }
-        $data = @unserialize($data);
-        if (unserialize(false) === $data) {
-            return $this->doError("Cannot unserialize data in file contents: '{$file}'");
-        }
-
-
-        $validData = true;
-        foreach (array_keys($this->_data) as $k) {
-            if (!isset($data[$k])) {
-                $validData = false;
-            } else {
-                $this->_data[$k] = $data[$k];
-            }
-        }
-        if ($validData) {
-            $this->_data = $data;
-        } else {
-            $this->save();
-        }
-    }
-
-    /**
-     * Save contents
-     *
-     * @param string|false $file
-     * @return void
-     */
-    public function save($file = false)
-    {
-        if (false === $file) {
-            $file = $this->_readFilename;
-        }
-        if (false === $file) {
-            return;
-        }
-        $data = @serialize($this->_data);
-        if (!$this->_debug) {
-            $data = @gzcompress($data);
-        }
-        $res = @file_put_contents($file, $data);
-        if (!$res) {
-            $this->doError("Cannot save: '{$file}'");
-        }
-    }
-
-    /**
-     * Set empty config skeleton
-     * @return void
-     */
-    public function setEmptyConfig()
-    {
-        $this->_data = array(self::K_CHAN => array(), self::K_CHAN_URI => array(), self::K_CHAN_ALIAS => array());
-    }
-
-    /**
-     * @param string $chanName
-     * @return bool
-     */
-    public function isChannel($chanName)
-    {
-        if ($this->isChannelName($chanName)) {
-            return true;
-        }
-        if ($this->isChannelUri($chanName)) {
-            return true;
-        }
-        if ($this->isChannelAlias($chanName)) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Get channel
-     * @param string $chanName
-     * @return array|void
-     */
-    public function getChannel($chanName)
-    {
-        if ($this->isChannelAlias($chanName)) {
-            $chanName = $this->getChannelNameByAlias($chanName);
-        } elseif ($this->isChannelUri($chanName)) {
-            $chanName = $this->getChannelUriRecord($chanName);
-        }
-        if ($this->isChannelName($chanName)) {
-            return $this->_data[self::K_CHAN][$chanName];
-        }
-    }
-
-    /**
-     * Is channel name?
-     * @param string $chanName
-     * @return bool
-     */
-    public function isChannelName($chanName)
-    {
-        return isset($this->_data[self::K_CHAN][$chanName]);
-    }
-
-    /**
-     * Is channel alias?
-     * @param string $chanName
-     * @return bool
-     */
-    public function isChannelAlias($chanName)
-    {
-        return isset($this->_data[self::K_CHAN_ALIAS][$chanName]);
-    }
-
-    /**
-     * Is channel uri?
-     * @param string $uri
-     * @return bool
-     */
-    public function isChannelUri($uri)
-    {
-        $uri = $this->formatUri($uri);
-        return isset($this->_data[self::K_CHAN_URI][$uri]);
-    }
-
-    /**
-     * Unset channel uri record
-     * @param string $uri
-     * @return void
-     */
-    protected function unsetChannelUriRecord($uri)
-    {
-        $uri = $this->formatUri($uri);
-        unset($this->_data[self::K_CHAN_URI][$uri]);
-    }
-
-    /**
-     * Set channel uri record: uri maps to channel record
-     * @param string $chanName
-     * @param string $uri
-     * @return void
-     */
-    protected function setChannelUriRecord($chanName, $uri)
-    {
-        $uri = $this->formatUri($uri);
-        $this->_data[self::K_CHAN_URI][$uri] = $chanName;
-    }
-
-    /**
-     * Get channel name by uri record
-     * @param string $uri
-     * @return string
-     */
-    protected function getChannelUriRecord($uri)
-    {
-        $uri = $this->formatUri($uri);
-        return $this->_data[self::K_CHAN_URI][$uri];
-    }
-
-    /**
-     * Unset channel record
-     * @param string $chanName
-     * @return void
-     */
-    protected function unsetChannelRecord($chanName)
-    {
-        unset($this->_data[self::K_CHAN][$chanName]);
-    }
-
-    /**
-     * Get channel record
-     * @param string $chanName
-     * @return array
-     */
-    protected function getChannelRecord($chanName)
-    {
-        return $this->_data[self::K_CHAN][$chanName];
-    }
-
-    /**
-     * Set channel record
-     * @param string $chanName
-     * @param string $uri
-     * @param array $data
-     * @param array $packages
-     * @return void
-     */
-    protected function setChannelRecord($chanName, $uri, $data, $packages = array())
-    {
-        $this->_data[self::K_CHAN][$chanName] = array(
-            self::K_NAME => $chanName,
-            self::K_URI => $uri,
-            self::K_CHAN_DATA => $data,
-            self::K_PACK => $packages
-        );
-    }
-
-    /**
-     * Set package record
-     * @param string $chanName
-     * @param string $packageName
-     * @param array $data
-     * @param string $oneField
-     * @return void
-     */
-    protected function setPackageRecord($chanName, $packageName, $data, $oneField = null)
-    {
-        if (null === $oneField) {
-            $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName] = $data;
-        } else {
-            $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName][$oneField] = $data;
-        }
-    }
-
-    /**
-     * Unset package record
-     * @param string $chanName
-     * @param string $packageName
-     * @return void
-     */
-    protected function unsetPackageRecord($chanName, $packageName)
-    {
-        unset($this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName]);
-    }
-
-    /**
-     * Get package record
-     * @param string $chanName
-     * @param string $packageName
-     * @param string $field
-     * @return array
-     */
-    protected function fetchPackage($chanName, $packageName, $field = null)
-    {
-        if (null === $field) {
-            return $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName];
-        } else {
-            return $this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName][$field];
-        }
-    }
-
-    /**
-     * Has package record
-     * @param string $chanName
-     * @param string $packageName
-     * @return bool
-     */
-    protected function hasPackageRecord($chanName, $packageName)
-    {
-        return isset($this->_data[self::K_CHAN][$chanName][self::K_PACK][$packageName]);
-    }
-
-    /**
-     * Get channel name by alias
-     * @param string $alias
-     * @return array
-     */
-    protected function getChannelNameByAlias($alias)
-    {
-        return $this->_data[self::K_CHAN_ALIAS][$alias];
-    }
-
-    /**
-     * Set channel alias
-     * @param string $alias
-     * @param string $chanName
-     * @return void
-     */
-    protected function setChannelAlias($alias, $chanName)
-    {
-        $this->_data[self::K_CHAN_ALIAS][$alias] = $chanName;
-    }
-
-    /**
-     * Unset channel alias
-     * @param string $alias
-     * @return void
-     */
-    protected function unsetChannelAlias($alias)
-    {
-        unset($this->_data[self::K_CHAN_ALIAS][$alias]);
-    }
-
-    /**
-     * Clear all aliases of channel
-     * @param string $chanName channel name
-     * @return void
-     */
-    protected function clearAliases($chanName)
-    {
-        $keys = array_keys($this->_data[self::K_CHAN_ALIAS]);
-        foreach ($keys as $key) {
-            if ($this->_data[self::K_CHAN_ALIAS][$key] == $chanName) {
-                unset($this->_data[self::K_CHAN_ALIAS][$key]);
-            }
-        }
-    }
-
-    /**
-     * Add channel alias
-     * @param string $chanName
-     * @param string $alias
-     * @return void
-     */
-    public function addChannelAlias($chanName, $alias)
-    {
-        if ($this->isChannelName($alias)) {
-            return $this->doError("Alias '{$alias}' is existant channel name!");
-        }
-
-        if (!$this->isChannelName($chanName)) {
-            return $this->doError("Channel '{$chanName}' doesn't exist");
-        }
-        $this->setChannelAlias($alias, $chanName);
-        $this->save();
-    }
-
-    /**
-     * Add channel
-     * @param string $chanName
-     * @param string $uri
-     * @param array $data
-     * @return void
-     */
-    public function addChannel($chanName, $uri, $data = array())
-    {
-        if ($this->isChannelName($chanName)) {
-            return $this->doError("Channel '{$chanName}' already exist!");
-        }
-        if ($this->isChannelUri($uri)) {
-            return $this->doError("Channel with uri= '{$uri}' already exist!");
-        }
-        if ($this->isChannelAlias($chanName)) {
-            $this->unsetChannelAlias($chanName);
-        }
-        $uri = $this->formatUri($uri);
-        $this->setChannelRecord($chanName, $uri, $data);
-        $this->setChannelUriRecord($chanName, $uri);
-        $this->save();
-    }
-
-    /**
-     * Delete channel
-     * @param string $chanName
-     * @return void
-     */
-    public function deleteChannel($chanName)
-    {
-        if ($this->isChannelName($chanName)) {
-            $record = $this->getChannelRecord($chanName);
-            $this->unsetChannelUriRecord($record[self::K_URI]);
-            $this->unsetChannelRecord($chanName);
-            $this->clearAliases($chanName);
-        } elseif ($this->isChannelUri($chanName)) {
-            $uri = $chanName;
-            $chanName = $this->getChannelUriRecord($uri);
-            $this->unsetChannelUriRecord($uri);
-            $this->unsetChannelRecord($chanName);
-            $this->clearAliases($chanName);
-        } elseif ($this->isChannelAlias($chanName)) {
-            $this->unsetChannelAlias($chanName);
-        } else {
-            return $this->doError("'{$chanName}' was not found in aliases, channel names, channel uris");
-        }
-        $this->save();
-    }
-
-    /**
-     * Converts channel name, url or alias to channel name
-     * throws exception if not found
-     * @param string $chanName
-     * @return string|void
-     */
-    public function chanName($chanName)
-    {
-        $channelData = $this->getChannel($chanName);
-        if (!$channelData) {
-            return $this->doError("Channel '{$chanName}' doesn't exist");
-        }
-        return $channelData[self::K_NAME];
-    }
-
-    /**
-     * @param string $chan
-     * @return string|void
-     */
-    public function chanUrl($chan)
-    {
-        $channelData = $this->getChannel($chan);
-        if (!$channelData) {
-            return $this->doError("Channel '{$chan}' doesn't exist");
-        }
-        return $channelData[self::K_URI];
-    }
-
-    /**
-     * Add package
-     *
-     * @param Package $package
-     * @return void
-     */
-    public function addPackage($package)
-    {
-        $channel = $this->chanName($package->getChannel());
-        $name = $package->getName();
-        $record = array(
-            self::K_VER => $package->getVersion(),
-            self::K_STATE => $package->getStability(),
-            self::K_XML => $package->getPackageXml(),
-            self::K_NAME => $name,
-            self::K_DEPS => array(),
-            self::K_PACK_DEPS => array()
-        );
-        $this->setPackageRecord($channel, $name, $record);
-        $this->setPackageDependencies($channel, $name, $package->getDependencyPackages());
-        $this->save();
-    }
-
-    /**
-     * Delete package
-     * @param string $chanName
-     * @param string $package
-     * @return void
-     */
-    public function deletePackage($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        $this->unsetPackageRecord($chanName, $package);
-        $this->save();
-    }
-
-    /**
-     * Get package
-     * @param string $chanName
-     * @param string $package
-     * @return array|null
-     */
-    public function getPackage($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            return $this->fetchPackage($chanName, $package);
-        }
-        return null;
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $package
-     * @return Package
-     * @throws \Exception
-     */
-    public function getPackageObject($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            $data = $this->fetchPackage($chanName, $package);
-            return new Package($data[self::K_XML]);
-        }
-        throw new \Exception("Cannot get package: '{$package}'");
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $package
-     * @param string|false $versionMin
-     * @param string|false $versionMax
-     * @return bool
-     */
-    public function hasPackage($chanName, $package, $versionMin = false, $versionMax = false)
-    {
-        $chanName = $this->chanName($chanName);
-        $data = $this->getPackage($chanName, $package);
-        if (null === $data) {
-            return false;
-        }
-        $installedVersion = $data[self::K_VER];
-        return $this->versionInRange($installedVersion, $versionMin, $versionMax);
-    }
-
-    /**
-     * @param string $version
-     * @param string|false $versionMin
-     * @param string|false $versionMax
-     * @return bool
-     */
-    public function versionInRange($version, $versionMin = false, $versionMax = false)
-    {
-        if (false === $versionMin) {
-            $minOk = true;
-        } else {
-            $minOk = version_compare($version, $versionMin, ">=");
-        }
-        if (false === $versionMax) {
-            $maxOk = true;
-        } else {
-            $maxOk = version_compare($version, $versionMax, "<=");
-        }
-        return $minOk && $maxOk;
-    }
-
-    /**
-     * @param string $min1
-     * @param string $max1
-     * @param string $min2
-     * @param string $max2
-     * @return bool
-     */
-    public function hasVersionRangeIntersect($min1, $max1, $min2, $max2)
-    {
-        if (version_compare($min1, $min2, ">") && version_compare($max1, $max2, ">")) {
-            return false;
-        } elseif (version_compare($min1, $min2, "<") && version_compare($max1, $max2, "<")) {
-            return false;
-        } elseif (version_compare($min1, $min2, ">=") && version_compare($max1, $max2, "<=")) {
-            return true;
-        } elseif (version_compare($min1, $min2, "<=") && version_compare($max1, $max2, ">=")) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Clear contents to defaults and save
-     * @return void
-     */
-    public function clear()
-    {
-        $this->setEmptyConfig();
-        $this->save();
-    }
-
-    /**
-     * Output error - throw exception
-     * @param string $message
-     * @throws \Exception
-     * @return void
-     */
-    protected function doError($message)
-    {
-        throw new \Exception($message);
-    }
-
-    /**
-     * @param int $s1
-     * @param int $s2
-     * @return int
-     */
-    public function compareStabilities($s1, $s2)
-    {
-        if (!$this->_validator) {
-            $this->_validator = new Validator();
-        }
-        return $this->_validator->compareStabilities($s1, $s2);
-    }
-
-    /**
-     * @param array $restData
-     * @param string|false $argVersionMin
-     * @param string|false $argVersionMax
-     * @param string $preferredStability
-     * @return bool|string
-     */
-    public function detectVersionFromRestArray(
-        $restData,
-        $argVersionMin = false,
-        $argVersionMax = false,
-        $preferredStability = 'devel'
-    ) {
-        if (!is_array($restData)) {
-            return false;
-        }
-
-        foreach ($restData as $vData) {
-            $stability = trim($vData['s']);
-            $version = trim($vData['v']);
-            $goodStability = $this->compareStabilities($stability, $preferredStability) >= 0;
-            if ($goodStability && $this->versionInRange($version, $argVersionMin, $argVersionMax)) {
-                return $version;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $package
-     * @param array $data
-     * @return bool
-     */
-    public function setPackageDependencies($chanName, $package, $data)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            $this->setPackageRecord($chanName, $package, $data, self::K_PACK_DEPS);
-            $this->save();
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $package
-     * @return array|false
-     */
-    public function getPackageDependencies($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            return $this->fetchPackage($chanName, $package, self::K_PACK_DEPS);
-        }
-        return false;
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $package
-     * @param array $data
-     * @return bool
-     */
-    public function setDependencyInfo($chanName, $package, $data)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            $this->setPackageRecord($chanName, $package, $data, self::K_DEPS);
-            $this->save();
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $package
-     * @return array|false
-     */
-    public function getDependencyInfo($chanName, $package)
-    {
-        $chanName = $this->chanName($chanName);
-        if ($this->hasPackageRecord($chanName, $package)) {
-            return $this->fetchPackage($chanName, $package, self::K_DEPS);
-        }
-        return false;
-    }
-
-    /**
-     * @return array
-     */
-    public function getChannelNames()
-    {
-        return array_keys($this->_data[self::K_CHAN]);
-    }
-
-    /**
-     * @param string|false $channel
-     * @return array
-     */
-    public function getPackagesData($channel = false)
-    {
-        if (false == $channel) {
-            return $this->_data[self::K_CHAN];
-        }
-
-        if (!$this->isChannel($channel)) {
-            return array();
-        }
-        return $this->getChannel($channel);
-    }
-
-    /**
-     * @param array $deps
-     * @param string $chanName
-     * @param string $packageName
-     * @return bool
-     */
-    public function specifiedInDependencyList($deps, $chanName, $packageName)
-    {
-        foreach ($deps as $dep) {
-            if ($chanName == $dep['channel'] && $packageName == $dep['name']) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * @param string $chanName
-     * @param string $packageName
-     * @param array $excludeList
-     * @return array
-     */
-    public function requiredByOtherPackages($chanName, $packageName, $excludeList = array())
-    {
-        $out = array();
-        foreach ($this->_data[self::K_CHAN] as $channel => $data) {
-            foreach ($data[self::K_PACK] as $package) {
-                if ($this->specifiedInDependencyList($excludeList, $channel, $package['name'])) {
-                    continue;
-                }
-                $deps = $package[self::K_PACK_DEPS];
-                if ($this->specifiedInDependencyList($deps, $chanName, $packageName)) {
-                    $out[] = array(
-                        'channel' => $channel,
-                        'name' => $package['name'],
-                        'version' => $package['version']
-                    );
-                }
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * @param string|false $chanName
-     * @return array
-     */
-    public function getInstalledPackages($chanName = false)
-    {
-        if (false == $chanName) {
-            $data = $this->getChannelNames();
-        } elseif ($this->isChannel($chanName)) {
-            $tmp = $this->getChannel($chanName);
-            $data = array($tmp[self::K_NAME]);
-        }
-        $out = array();
-        foreach ($data as $chanName) {
-            $channel = $this->getChannel($chanName);
-            $out[$chanName] = array();
-            foreach ($channel[self::K_PACK] as $package => $data) {
-                $out[$chanName][$package] = array();
-                foreach (array(self::K_VER, self::K_STATE) as $k) {
-                    $out[$chanName][$package][$k] = $data[$k];
-                }
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * Check if package conflicts with installed packages
-     * Returns:
-     *    array with conflicts
-     *    false if no conflicts
-     *
-     * @param string $chanName
-     * @param string $packageName
-     * @param string $version
-     * @return array|false
-     */
-    public function hasConflicts($chanName, $packageName, $version)
-    {
-        $conflicts = array();
-        foreach ($this->_data[self::K_CHAN] as $channel => $data) {
-            foreach ($data[self::K_PACK] as $package) {
-                if ($channel != $chanName) {
-                    continue;
-                }
-                $deps = $package[self::K_PACK_DEPS];
-                foreach ($deps as $dep) {
-                    if ($dep['name'] != $packageName) {
-                        continue;
-                    }
-
-                    if (!$this->versionInRange($version, $dep['min'], $dep['max'])) {
-                        //var_dump($version, $dep['min'], $dep['max']);
-                        $conflicts[] = $channel . "/" . $package['name'] . " " . $package['version'];
-                    }
-                }
-            }
-        }
-        return count($conflicts) ? $conflicts : false;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Structures/Graph.php b/lib/internal/Magento/Framework/Connect/Structures/Graph.php
deleted file mode 100644
index fec07446600cc214ec4b5ca38a919d84f8cab57e..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Structures/Graph.php
+++ /dev/null
@@ -1,281 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Structures;
-
-use Magento\Framework\Connect\Structures\Node;
-
-class Graph
-{
-    /**
-     * @var Node[]
-     */
-    protected $_nodes = array();
-
-    /**
-     * @var bool
-     */
-    protected $_directed = false;
-
-    /**
-     * @var string
-     */
-    protected $_nodeClassName = 'Magento\Framework\Connect\Structures\Node';
-
-    const ACYCLIC_VISITED_KEY = 'acyclic-test-visited';
-
-    const SORT_VISITED_KEY = 'topological-sort-visited';
-
-    const SORT_LEVEL_KEY = 'topological-sort-level';
-
-    /**
-     * Constructor
-     *
-     * @param bool $directed directed graph?
-     */
-    public function __construct($directed = true)
-    {
-        $this->_directed = $directed;
-    }
-
-    /**
-     * Is graph directed?
-     *
-     * @return bool
-     */
-    public function isDirected()
-    {
-        return (bool)$this->_directed;
-    }
-
-    /**
-     * Add node to list
-     *
-     * @param Node &$newNode
-     * @return void
-     * @throws \Exception
-     */
-    public function addNode(&$newNode)
-    {
-        if (!$newNode instanceof $this->_nodeClassName) {
-            throw new \Exception(
-                __METHOD__ . " : invalid node class, should be instance of: " . $this->_nodeClassName
-            );
-        }
-        foreach ($this->_nodes as $key => $node) {
-            if ($newNode === $node) {
-                throw new \Exception(__METHOD__ . " : received duplicate object");
-            }
-        }
-        $this->_nodes[] =& $newNode;
-        $newNode->setGraph($this);
-    }
-
-    /**
-     * Remove a Node from the Graph
-     * @param  Node &$node
-     * @return void
-     */
-    public function removeNode(&$node)
-    {
-    }
-
-    /**
-     * Return set of nodes
-     *
-     * @return Node[]
-     */
-    public function &getNodes()
-    {
-        return $this->_nodes;
-    }
-
-    /**
-     * Is asyclic
-     *
-     * @return bool
-     */
-    public function isAcyclic()
-    {
-        if (!$this->isDirected()) {
-            return false;
-        }
-        return self::_isAcyclic($this);
-    }
-
-    /**
-     * This is a variant of Graph::inDegree which does
-     * not count nodes marked as visited.
-     *
-     * @param Node &$node
-     * @param string $metadataKey
-     * @return integer
-     */
-    protected static function _nonVisitedInDegree(&$node, $metadataKey)
-    {
-        $result = 0;
-        $graphNodes =& $node->getGraph()->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if (!$graphNodes[$key]->getMetadata($metadataKey) && $graphNodes[$key]->connectsTo($node)) {
-                $result++;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Is graph acyclic?
-     *
-     * @param Graph &$graph
-     * @return bool
-     */
-    protected static function _isAcyclic(&$graph)
-    {
-        // Mark every node as not visited
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        $refGenerator = array();
-        foreach ($nodeKeys as $key) {
-            $refGenerator[] = false;
-            $nodes[$key]->setMetadata(self::ACYCLIC_VISITED_KEY, $refGenerator[sizeof($refGenerator) - 1]);
-        }
-
-        // Iteratively peel off leaf nodes
-        do {
-            // Find out which nodes are leafs (excluding visited nodes)
-            $leafNodes = array();
-            foreach ($nodeKeys as $key) {
-                if (!$nodes[$key]->getMetadata(
-                    self::ACYCLIC_VISITED_KEY
-                ) && self::_nonVisitedInDegree(
-                    $nodes[$key],
-                    self::ACYCLIC_VISITED_KEY
-                ) == 0
-                ) {
-                    $leafNodes[] =& $nodes[$key];
-                }
-            }
-            // Mark leafs as visited
-            for ($i = sizeof($leafNodes) - 1; $i >= 0; $i--) {
-                $visited =& $leafNodes[$i]->getMetadata(self::ACYCLIC_VISITED_KEY);
-                $visited = true;
-                $leafNodes[$i]->setMetadata(self::ACYCLIC_VISITED_KEY, $visited);
-            }
-        } while (sizeof($leafNodes) > 0);
-
-
-        // If graph is a DAG, there should be no non-visited nodes.
-        // Let's try to prove otherwise
-        $result = true;
-        foreach ($nodeKeys as $key) {
-            if (!$nodes[$key]->getMetadata(self::ACYCLIC_VISITED_KEY)) {
-                $result = false;
-                break;
-            }
-        }
-
-        // Cleanup visited marks
-        foreach ($nodeKeys as $key) {
-            $nodes[$key]->unsetMetadata(self::ACYCLIC_VISITED_KEY);
-        }
-
-        return $result;
-    }
-
-    /**
-     * Sort returns the graph's nodes, sorted by topological order.
-     *
-     * The result is an array with
-     * as many entries as topological levels.
-     *
-     * Each entry in this array is an array of nodes within
-     * the given topological level.
-     *
-     * @return   array
-     */
-    public function topologicalSort()
-    {
-        // We only sort graphs
-        self::_topologicalSort($this);
-        $result = array();
-        // Fill out result array
-        $nodes =& $this->getNodes();
-        $nodeKeys = array_keys($nodes);
-        foreach ($nodeKeys as $key) {
-            $k = $nodes[$key]->getMetadata(self::SORT_LEVEL_KEY);
-            if (!array_key_exists($k, $result)) {
-                $result[$k] = array();
-            }
-            $result[$k][] =& $nodes[$key];
-            $nodes[$key]->unsetMetadata(self::SORT_LEVEL_KEY);
-        }
-        return $result;
-    }
-
-    /**
-     * @param Graph &$graph
-     * @return void
-     */
-    protected static function _topologicalSort(&$graph)
-    {
-        // Mark every node as not visited
-        $nodes =& $graph->getNodes();
-        $nodeKeys = array_keys($nodes);
-        $refGenerator = array();
-        foreach ($nodeKeys as $key) {
-            $refGenerator[] = false;
-            $nodes[$key]->setMetadata(self::SORT_VISITED_KEY, $refGenerator[sizeof($refGenerator) - 1]);
-        }
-
-        // Iteratively peel off leaf nodes
-        $topologicalLevel = 0;
-        do {
-            // Find out which nodes are leafs (excluding visited nodes)
-            $leafNodes = array();
-            foreach ($nodeKeys as $key) {
-                if (!$nodes[$key]->getMetadata(
-                    self::SORT_VISITED_KEY
-                ) && self::_nonVisitedInDegree(
-                    $nodes[$key],
-                    self::SORT_VISITED_KEY
-                ) == 0
-                ) {
-                    $leafNodes[] =& $nodes[$key];
-                }
-            }
-            // Mark leafs as visited
-            $refGenerator[] = $topologicalLevel;
-            for ($i = sizeof($leafNodes) - 1; $i >= 0; $i--) {
-                $visited =& $leafNodes[$i]->getMetadata(self::SORT_VISITED_KEY);
-                $visited = true;
-                $leafNodes[$i]->setMetadata(self::SORT_VISITED_KEY, $visited);
-                $leafNodes[$i]->setMetadata(self::SORT_LEVEL_KEY, $refGenerator[sizeof($refGenerator) - 1]);
-            }
-            $topologicalLevel++;
-        } while (sizeof($leafNodes) > 0);
-
-        foreach ($nodeKeys as $key) {
-            $nodes[$key]->unsetMetadata(self::SORT_VISITED_KEY);
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Structures/Node.php b/lib/internal/Magento/Framework/Connect/Structures/Node.php
deleted file mode 100644
index 7529cf44514805d8a1ebf3298d8915aff7805b4c..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Structures/Node.php
+++ /dev/null
@@ -1,275 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect\Structures;
-
-use Magento\Framework\Connect\Structures\Graph;
-
-class Node
-{
-    /**
-     * @var mixed
-     */
-    protected $_data = null;
-
-    /**
-     * @var array
-     */
-    protected $_metadata = array();
-
-    /**
-     * @var array
-     */
-    protected $_arcs = array();
-
-    /**
-     * @var Graph
-     */
-    protected $_graph = null;
-
-    /**
-     * Node graph getter
-     *
-     * @return Graph
-     */
-    public function &getGraph()
-    {
-        return $this->_graph;
-    }
-
-    /**
-     * Node graph setter.
-     * This method should not be called directly.
-     * Use Graph::addNode instead.
-     *
-     * @param Graph &$graph
-     * @return void
-     */
-    public function setGraph(&$graph)
-    {
-        $this->_graph =& $graph;
-    }
-
-    /**
-     * Node data getter.
-     *
-     * Each graph node can contain a reference to one variable. This is the getter for that reference.
-     *
-     * @return   mixed   Data stored in node
-     * @access   public
-     */
-    public function &getData()
-    {
-        return $this->_data;
-    }
-
-    /**
-     * Node data setter
-     *
-     * Each graph node can contain a reference to one variable. This is the setter for that reference.
-     *
-     * @param mixed $data Data to store in node
-     * @return void
-     */
-    public function setData($data)
-    {
-        $this->_data =& $data;
-    }
-
-    /**
-     * Test for existence of metadata under a given key.
-     *
-     * @param    string  $key Key to test
-     * @return   boolean
-     * @access   public
-     */
-    public function metadataKeyExists($key)
-    {
-        return array_key_exists($key, $this->_metadata);
-    }
-
-    /**
-     * Get node metadata
-     *
-     * @param    string  $key
-     * @param    boolean $nullIfNonexistent (defaults to false).
-     * @return   mixed
-     * @throws   \Exception
-     */
-    public function &getMetadata($key, $nullIfNonexistent = false)
-    {
-        if (array_key_exists($key, $this->_metadata)) {
-            return $this->_metadata[$key];
-        } elseif ($nullIfNonexistent) {
-            $a = null;
-            return $a;
-        } else {
-            throw new \Exception(__METHOD__ . " : requested key doesn't exist: {$key}");
-        }
-    }
-
-    /**
-     * Delete metadata by key
-     *
-     * @param string $key Key
-     * @return void
-     */
-    public function unsetMetadata($key)
-    {
-        if (array_key_exists($key, $this->_metadata)) {
-            unset($this->_metadata[$key]);
-        }
-    }
-
-    /**
-     * Node metadata setter
-     *
-     * Each graph node can contain multiple 'metadata' entries, each stored under a different key, as in an
-     * associative array or in a dictionary. This method stores data under the given key. If the key already exists,
-     * previously stored data is discarded.
-     *
-     * @param    string  $key
-     * @param    mixed   $data
-     * @return   void
-     */
-    public function setMetadata($key, $data)
-    {
-        $this->_metadata[$key] =& $data;
-    }
-
-    /**
-     * @param mixed &$destinationNode
-     * @return void
-     */
-    protected function _connectTo(&$destinationNode)
-    {
-        $this->_arcs[] =& $destinationNode;
-    }
-
-    /**
-     * Connect this node to another one.
-     * If the graph is not directed, the reverse arc, connecting $destinationNode to $this is also created.
-     * @param \Magento\Framework\Object &$destinationNode  Structures_Graph Node to connect to
-     * @return void
-     * @throws \Exception
-     */
-    public function connectTo(&$destinationNode)
-    {
-        $class = get_class($this);
-        if (!$destinationNode instanceof $class) {
-            throw new \Exception(__METHOD__ . " : argument should be instance of {$class}");
-        }
-
-        // Nodes must already be in graphs to be connected
-        if ($this->_graph == null) {
-            throw new \Exception(__METHOD__ . " : tried to connect to null graph");
-        }
-
-        if ($destinationNode->getGraph() == null) {
-            throw new \Exception(__METHOD__ . " : tried to connect to node that is not connected to any graph");
-        }
-
-        // Connect here
-        $this->_connectTo($destinationNode);
-        // If graph is undirected, connect back
-        if (!$this->_graph->isDirected()) {
-            $destinationNode->_connectTo($this);
-        }
-    }
-
-    /**
-     * Return nodes connected to this one.
-     * @return array
-     */
-    public function getNeighbours()
-    {
-        return $this->_arcs;
-    }
-
-    /**
-     * Test whether this node has an arc to the target node
-     * Returns true if the two nodes are connected
-     *
-     * @param Node &$target
-     * @return boolean
-     */
-    public function connectsTo(&$target)
-    {
-        $arcKeys = array_keys($this->_arcs);
-        foreach ($arcKeys as $key) {
-            $arc =& $this->_arcs[$key];
-            if ($target === $arc) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Calculate the in degree of the node.
-     *
-     * The indegree for a node is the number of arcs
-     * entering the node.
-     *
-     * For non directed graphs:
-     *  always outdegree = indegree.
-     *
-     * @return int
-     */
-    public function inDegree()
-    {
-        $result = 0;
-
-        if ($this->_graph == null) {
-            return $result;
-        }
-        if (!$this->_graph->isDirected()) {
-            return $this->outDegree();
-        }
-
-        $graphNodes =& $this->_graph->getNodes();
-        foreach (array_keys($graphNodes) as $key) {
-            if ($graphNodes[$key]->connectsTo($this)) {
-                $result++;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Calculate the out degree of the node.
-     *
-     * The outdegree for a node is the number of arcs exiting the node.
-     * For non directed graphs:
-     *  always outdegree = indegree.
-     *
-     * @return int
-     */
-    public function outDegree()
-    {
-        if ($this->_graph == null) {
-            return 0;
-        }
-        return count($this->_arcs);
-    }
-}
diff --git a/lib/internal/Magento/Framework/Connect/Validator.php b/lib/internal/Magento/Framework/Connect/Validator.php
deleted file mode 100644
index fe66c9bbea6edcd20db19b76d1769fa66a609090..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Connect/Validator.php
+++ /dev/null
@@ -1,392 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Connect;
-
-/**
- * Class to validate string resources
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-class Validator
-{
-    /**
-     * @var string[]
-     */
-    protected static $_stability = array(0 => 'devel', 1 => 'alpha', 2 => 'beta', 3 => 'stable');
-
-    /**
-     * @return string[]
-     */
-    public static function getStabilities()
-    {
-        return self::$_stability;
-    }
-
-    /**
-     * Compare stabilities.
-     *
-     * Returns:
-     * -1 if the first stability is lower than the second
-     *  0 if they are equal
-     *  1 if the second is lower.
-     *
-     * @param int $s1
-     * @param int $s2
-     * @return int|void
-     * @throws \Exception
-     */
-    public function compareStabilities($s1, $s2)
-    {
-        $list = $this->getStabilities();
-        $tmp = array_combine(array_values($list), array_keys($list));
-
-        if (!isset($tmp[$s1], $tmp[$s2])) {
-            throw new \Exception("Invalid stability in compareStabilities argument");
-        }
-
-        // 'stable' turns to 3
-        // 'devel' turns to 0
-        $s1 = $tmp[$s1];
-        $s2 = $tmp[$s2];
-        if ($s1 === $s2) {
-            return 0;
-        } elseif ($s1 > $s2) {
-            return 1;
-        } elseif ($s1 < $s2) {
-            return -1;
-        }
-    }
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * Validate max len of string
-     * @param string $str
-     * @param int $maxLen
-     * @return bool
-     */
-    public function validateMaxLen($str, $maxLen)
-    {
-        return strlen((string)$str) <= (int)$maxLen;
-    }
-
-    /**
-     * Validate channel name and url
-     *
-     * @param string $str
-     * @return bool
-     */
-    public function validateChannelNameOrUri($str)
-    {
-        return $this->validateUrl($str) || $this->validatePackageName($str);
-    }
-
-    /**
-     * Validate License url
-     *
-     * @param string $str
-     * @return boolean
-     */
-    public function validateLicenseUrl($str)
-    {
-        if ($str) {
-            return $this->validateUrl($str) || $this->validatePackageName($str);
-        }
-        return true;
-    }
-
-    /**
-     * Validate compatible data
-     * @param array $data
-     * @return bool
-     */
-    public function validateCompatible(array $data)
-    {
-        if (!count($data)) {
-            /**
-             * Allow empty
-             */
-            return true;
-        }
-        $count = 0;
-        foreach ($data as $k => $v) {
-            foreach (array('name', 'channel', 'min', 'max') as $fld) {
-                ${$fld} = trim($v[$fld]);
-            }
-            $count++;
-
-            $res = $this->validateUrl($channel) && strlen($channel);
-            if (!$res) {
-                $this->addError("Invalid or empty channel in compat. #{$count}");
-            }
-
-            $res = $this->validatePackageName($name) && strlen($name);
-            if (!$res) {
-                $this->addError("Invalid or empty name in compat. #{$count}");
-            }
-            $res1 = $this->validateVersion($min);
-            if (!$res1) {
-                $this->addError("Invalid or empty minVersion in compat. #{$count}");
-            }
-            $res2 = $this->validateVersion($max);
-            if (!$res2) {
-                $this->addError("Invalid or empty maxVersion in compat. #{$count}");
-            }
-            if ($res1 && $res2 && $this->versionLower($max, $min)) {
-                $this->addError("Max version is lower than min in compat #{$count}");
-            }
-        }
-        return !$this->hasErrors();
-    }
-
-    /**
-     * Validate authors of package
-     * @param array $authors
-     * @return bool
-     */
-    public function validateAuthors(array $authors)
-    {
-        if (!count($authors)) {
-            $this->addError('Empty authors section');
-            return false;
-        }
-        $count = 0;
-        foreach ($authors as $k => $v) {
-            $count++;
-            array_map('trim', $v);
-            $name = $v['name'];
-            $login = $v['user'];
-            $email = $v['email'];
-            $res = $this->validateMaxLen($name, 256) && strlen($name);
-            if (!$res) {
-                $this->addError("Invalid or empty name for author #{$count}");
-            }
-            $res = $this->validatePackageName($login) && strlen($login);
-            if (!$res) {
-                $this->addError("Invalid or empty login for author #{$count}");
-            }
-            $res = $this->validateEmail($email);
-            if (!$res) {
-                $this->addError("Invalid or empty email for author #{$count}");
-            }
-        }
-        return !$this->hasErrors();
-    }
-
-    /**
-     * Validator errors
-     * @var array
-     */
-    private $_errors = array();
-
-    /**
-     * Add error
-     * @param string $err
-     * @return void
-     */
-    private function addError($err)
-    {
-        $this->_errors[] = $err;
-    }
-
-    /**
-     * Set validator errors
-     * @param array $err
-     * @return void
-     */
-    private function setErrors(array $err)
-    {
-        $this->_errors = $err;
-    }
-
-    /**
-     * Clear validator errors
-     * @return void
-     */
-    private function clearErrors()
-    {
-        $this->_errors = array();
-    }
-
-    /**
-     * Check if there are validator errors set
-     * @return bool
-     */
-    public function hasErrors()
-    {
-        return count($this->_errors) != 0;
-    }
-
-    /**
-     * Get errors
-     * @param bool $clear if true after this call erros will be cleared
-     * @return array
-     */
-    public function getErrors($clear = true)
-    {
-        $out = $this->_errors;
-        if ($clear) {
-            $this->clearErrors();
-        }
-        return $out;
-    }
-
-    /**
-     * Validate URL
-     * @param string $str
-     * @return bool
-     */
-    public function validateUrl($str)
-    {
-        $regex = "@([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|" .
-            "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp)" .
-            "[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+)(:[0-9]*)?@i";
-        return preg_match($regex, $str);
-    }
-
-    /**
-     * Validates package stability
-     * @param string $str
-     * @return bool
-     */
-    public function validateStability($str)
-    {
-        return in_array(strval($str), self::$_stability);
-    }
-
-    /**
-     * Validate date format
-     * @param string $date
-     * @return bool
-     */
-    public function validateDate($date)
-    {
-        $subs = null;
-        $check1 = preg_match("/^([\d]{4})-([\d]{2})-([\d]{2})$/i", $date, $subs);
-        if (!$check1) {
-            return false;
-        }
-        return checkdate($subs[2], $subs[3], $subs[1]);
-    }
-
-    /**
-     * Validate email
-     * @param string $email
-     * @return bool
-     */
-    public function validateEmail($email)
-    {
-        return preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email);
-    }
-
-    /**
-     * Validate package name
-     * @param string $name
-     * @return bool
-     */
-    public function validatePackageName($name)
-    {
-        return preg_match("/^[a-zA-Z0-9_-]+$/i", $name);
-    }
-
-    /**
-     * Validate version number
-     * @param string $version
-     * @return bool
-     */
-    public function validateVersion($version)
-    {
-        return preg_match("/^[\d]+\.[\d]+\.[\d]+([[:alnum:]\.\-\_]+)?$/i", $version);
-    }
-
-    /**
-     * Check versions are equal
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionEqual($v1, $v2)
-    {
-        return version_compare($v1, $v2, "==");
-    }
-
-    /**
-     * Check version $v1 <= $v2
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionLowerEqual($v1, $v2)
-    {
-        return version_compare($v1, $v2, "le");
-    }
-
-    /**
-     * Check if version $v1 lower than $v2
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionLower($v1, $v2)
-    {
-        return version_compare($v1, $v2, "<");
-    }
-
-    /**
-     * Check version $v1 >= $v2
-     * @param string $v1
-     * @param string $v2
-     * @return bool
-     */
-    public function versionGreaterEqual($v1, $v2)
-    {
-        return version_compare($v1, $v2, "ge");
-    }
-
-    /**
-     * Generic regex validation
-     * @param string $str
-     * @param string $regex
-     * @return bool
-     */
-    public function validateRegex($str, $regex)
-    {
-        return preg_match($regex, $str);
-    }
-
-    /**
-     * Check if PHP extension loaded
-     * @param string $name Extension name
-     * @return bool
-     */
-    public function validatePhpExtension($name)
-    {
-        return extension_loaded($name);
-    }
-}
diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
index 82a19b402eba12832aa011b7a1e77777cd40b614..f5b64b944fdb104f82cf5a55b7705612a4321884 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
@@ -241,7 +241,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
 
     /**
      * @param Filesystem $filesystem
-     * @param String $string
+     * @param \Magento\Framework\Stdlib\String|String $string
      * @param DateTime $dateTime
      * @param array $config
      */
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editablemultiselect.php b/lib/internal/Magento/Framework/Data/Form/Element/Editablemultiselect.php
index b791b91c19776a70cd2428e5b098d7a57275a05b..b26501324dff031a5495d7e5b98761da311ba3b4 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/Editablemultiselect.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/Editablemultiselect.php
@@ -62,11 +62,10 @@ class Editablemultiselect extends \Magento\Framework\Data\Form\Element\Multisele
         $selectConfigJson = \Zend_Json::encode($selectConfig);
         $jsObjectName = $this->getJsObjectName();
         $html .= '<script type="text/javascript">' .
-            '/*<![CDATA[*/' .
-            '(function($) { $().ready(function () { ' .
+            'require(["jquery","jquery/ui"], function($) {'.
+            'setTimeout(function () { ' .
             "var {$jsObjectName} = new {$elementJsClass}({$selectConfigJson}); " .
-            "{$jsObjectName}.init(); }); })(jQuery);" .
-            '/*]]>*/' .
+            "{$jsObjectName}.init(); }); }, 1000);" .
             '</script>';
         return $html;
     }
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php
index 781f8a4c011729468f2922dae424418b19bb38c2..68040f1b67f9b5b9f0cc3a6e0a752f5d6f1c6bbe 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php
@@ -138,7 +138,8 @@ class Editor extends Textarea
                 $js .
                 '
                 <script type="text/javascript">
-                //<![CDATA[' .
+                //<![CDATA[
+                require(["jquery", "mage/translate", "mage/adminhtml/events", "mage/adminhtml/wysiwyg/tiny_mce/setup"], function(jQuery){' .
                 "\n" .
                 '(function($) {$.mage.translate.add(' .
                 \Zend_Json::encode(
@@ -186,6 +187,7 @@ class Editor extends Textarea
                 $jsSetupObject .
                 '));
                 //]]>
+                });
                 </script>';
 
             $html = $this->_wrapIntoContainer($html);
diff --git a/lib/internal/Magento/Framework/System/Args.php b/lib/internal/Magento/Framework/System/Args.php
deleted file mode 100644
index a24911f94812c6f630a542d033f55b54ffcf34fd..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/System/Args.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Command-line options parsing class.
- */
-namespace Magento\Framework\System;
-
-class Args
-{
-    /**
-     * @var array
-     */
-    public $flags;
-
-    /**
-     * @var array
-     */
-    public $filtered;
-
-    /**
-     * Get flags/named options
-     * @return array
-     */
-    public function getFlags()
-    {
-        return $this->flags;
-    }
-
-    /**
-     * Get filtered args
-     * @return array
-     */
-    public function getFiltered()
-    {
-        return $this->filtered;
-    }
-
-    /**
-     * Constructor
-     * Note: the array $argv, if false $GLOBALS['argv'] is taken
-     *
-     * @param bool $source
-     */
-    public function __construct($source = false)
-    {
-        $this->flags = array();
-        $this->filtered = array();
-
-        if (false === $source) {
-            $argv = $GLOBALS['argv'];
-            array_shift($argv);
-        }
-
-        for ($i = 0,$iCount = count($argv); $i < $iCount; $i++) {
-            $str = $argv[$i];
-
-            // --foo
-            if (strlen($str) > 2 && substr($str, 0, 2) == '--') {
-                $str = substr($str, 2);
-                $parts = explode('=', $str);
-                $this->flags[$parts[0]] = true;
-
-                // Does not have an =, so choose the next arg as its value
-                if (count($parts) == 1 && isset($argv[$i + 1]) && preg_match('/^--?.+/', $argv[$i + 1]) == 0) {
-                    $this->flags[$parts[0]] = $argv[$i + 1];
-                    $argv[$i + 1] = null;
-                } elseif (count($parts) == 2) {
-                    $this->flags[$parts[0]] = $parts[1];
-                }
-            } elseif (strlen($str) == 2 && $str[0] == '-') {
-                $this->flags[$str[1]] = true;
-                if (isset($argv[$i + 1]) && preg_match('/^--?.+/', $argv[$i + 1]) == 0) {
-                    $this->flags[$str[1]] = $argv[$i + 1];
-                    $argv[$i + 1] = null;
-                }
-            } elseif (!is_null($str)) {
-                $this->filtered[] = $str;
-            }
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/View/Element/Html/Date.php b/lib/internal/Magento/Framework/View/Element/Html/Date.php
index b6ed5c23c77a2a542d51ba6dae4727a6f3541871..aa0f083c9d65e5c9fc048e3558e2da2b3e6283f9 100644
--- a/lib/internal/Magento/Framework/View/Element/Html/Date.php
+++ b/lib/internal/Magento/Framework/View/Element/Html/Date.php
@@ -40,6 +40,7 @@ class Date extends \Magento\Framework\View\Element\Template
         $html .= 'class="' . $this->getClass() . '" ' . $this->getExtraParams() . '/> ';
         $calendarYearsRange = $this->getYearsRange();
         $html .= '<script type="text/javascript">
+            require(["jquery", "mage/calendar"], function($){
             //<![CDATA[
             (function($) {
                 $(document).ready(function(){
@@ -72,7 +73,8 @@ class Date extends \Magento\Framework\View\Element\Template
             '"
                     })
                 });
-            })(jQuery)
+            });
+            });
             //]]>
             </script>';
 
diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..9a4f149393c25d233d6e25a4f4df75ce0af5cc64
--- /dev/null
+++ b/lib/internal/Magento/Framework/composer.json
@@ -0,0 +1,30 @@
+{
+    "name": "magento/framework",
+    "description": "N/A",
+    "type": "magento2-library",
+    "version": "0.1.0-alpha89",
+    "require": {
+        "php": "5.4.*|5.5.*",
+        "ext-spl": "*",
+        "ext-dom": "*",
+        "ext-simplexml": "*",
+        "ext-mcrypt": "*",
+        "ext-hash": "*",
+        "ext-curl": "*",
+        "ext-iconv": "*",
+        "ext-gd": "*",
+        "lib-libxml": "*",
+        "magento/magento-composer-installer": "*"
+    },
+    "suggest": {
+        "ext-imagick": "Use Image Magick >=3.0.0 as an optional alternative image processing library"
+    },
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Framework"
+            ]
+        ]
+    }
+}
diff --git a/lib/web/app-config.js b/lib/web/app-config.js
new file mode 100644
index 0000000000000000000000000000000000000000..33624b19c6896e203dd2aa294ea3bf5505aa31ec
--- /dev/null
+++ b/lib/web/app-config.js
@@ -0,0 +1,65 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+require.config({
+    "shim": {
+        "jquery/bootstrap-carousel/jquery.bootstrap-carousel": ["jquery"], // no longer used
+        "jquery/bootstrap-carousel/jquery.bootstrap-transition": ["jquery"], // no longer used
+        "jquery/jquery.hashchange": ["jquery"],
+        "jquery/jquery.mousewheel": ["jquery"],
+        "jquery/jquery.popups": ["jquery"],
+        "jquery/jquery-migrate": ["jquery"],
+        "jquery/jstree/jquery.hotkeys": ["jquery"],
+        "jquery/hover-intent": ["jquery"],
+        "mage/adminhtml/backup": ["prototype"],
+        "mage/adminhtml/tools": ["prototype"],
+        "mage/adminhtml/varienLoader": ["prototype"],
+        "mage/captcha": ["prototype"],
+        "mage/common": ["jquery"],
+        "mage/jquery-no-conflict": ["jquery"],
+        "mage/requirejs/plugin/id-normalizer": ["jquery"],
+        "mage/webapi": ["jquery"]
+    },
+    "paths":{
+        "baseImage": 'Magento_Catalog/catalog/base-image-uploader',
+        "jquery/validate": "jquery/jquery.validate",
+        "jquery/hover-intent": "jquery/jquery.hoverIntent",
+        "jquery/template": "jquery/jquery.tmpl.min",
+        "jquery/farbtastic": "jquery/farbtastic/jquery.farbtastic",
+        "jquery/file-uploader": "jquery/fileUploader/jquery.fileupload-ui",
+        "handlebars": "jquery/handlebars/handlebars-v1.3.0",
+        "jquery/jquery.hashchange": "jquery/jquery.ba-hashchange.min",
+        "prototype": "prototype/prototype-amd",
+        "_": "underscore"
+    },
+    "deps": [
+        "bootstrap"
+    ]
+});
+
+require([
+    'jquery',
+    'mage/components',
+    'mage/mage'
+], function($, components){
+    $.mage.component( components );
+});
diff --git a/lib/web/bootstrap.js b/lib/web/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..11cbec362ad756177dfca3349692f9ee2245f86d
--- /dev/null
+++ b/lib/web/bootstrap.js
@@ -0,0 +1,23 @@
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
\ No newline at end of file
diff --git a/lib/web/firebug/errorIcon.png b/lib/web/firebug/errorIcon.png
deleted file mode 100644
index 2d75261bb675f5f878a9ca549340d11694287ea9..0000000000000000000000000000000000000000
Binary files a/lib/web/firebug/errorIcon.png and /dev/null differ
diff --git a/lib/web/firebug/firebug.css b/lib/web/firebug/firebug.css
deleted file mode 100644
index 1f041c4da95c0ae9e3d22af6a51d256d8b50aa17..0000000000000000000000000000000000000000
--- a/lib/web/firebug/firebug.css
+++ /dev/null
@@ -1,209 +0,0 @@
-
-html, body {
-    margin: 0;
-    background: #FFFFFF;
-    font-family: Lucida Grande, Tahoma, sans-serif;
-    font-size: 11px;
-    overflow: hidden;
-}
-
-a {
-    text-decoration: none;
-}
-
-a:hover {
-    text-decoration: underline;
-}
-
-.toolbar {
-    height: 14px;
-    border-top: 1px solid ThreeDHighlight;
-    border-bottom: 1px solid ThreeDShadow;
-    padding: 2px 6px;
-    background: ThreeDFace;
-}
-
-.toolbarRight {
-    position: absolute;
-    top: 4px;
-    right: 6px;
-}
-
-#log {
-    overflow: auto;
-    position: absolute;
-    left: 0;
-    width: 100%;
-}
-
-#commandLine {
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    width: 100%;
-    height: 18px;
-    border: none;
-    border-top: 1px solid ThreeDShadow;
-}
-
-/************************************************************************************************/
-
-.logRow {
-    position: relative;
-    border-bottom: 1px solid #D7D7D7;
-    padding: 2px 4px 1px 6px;
-    background-color: #FFFFFF;
-}
-
-.logRow-command {
-    font-family: Monaco, monospace;
-    color: blue;
-}
-
-.objectBox-null {
-    padding: 0 2px;
-    border: 1px solid #666666;
-    background-color: #888888;
-    color: #FFFFFF;
-}
-
-.objectBox-string {
-    font-family: Monaco, monospace;
-    color: red;
-    white-space: pre;
-}
-
-.objectBox-number {
-    color: #000088;
-}
-
-.objectBox-function {
-    font-family: Monaco, monospace;
-    color: DarkGreen;
-}
-
-.objectBox-object {
-    color: DarkGreen;
-    font-weight: bold;
-}
-
-/************************************************************************************************/
-
-.logRow-info,
-.logRow-error,
-.logRow-warning {
-    background: #FFFFFF no-repeat 2px 2px;
-    padding-left: 20px;
-    padding-bottom: 3px;
-}
-
-.logRow-info {
-    background-image: url(infoIcon.png);
-}
-
-.logRow-warning {
-    background-color: cyan;
-    background-image: url(warningIcon.png);
-}
-
-.logRow-error {
-    background-color: LightYellow;
-    background-image: url(errorIcon.png);
-}
-
-.errorMessage {
-    vertical-align: top;
-    color: #FF0000;
-}
-
-.objectBox-sourceLink {
-    position: absolute;
-    right: 4px;
-    top: 2px;
-    padding-left: 8px;
-    font-family: Lucida Grande, sans-serif;
-    font-weight: bold;
-    color: #0000FF;
-}
-
-/************************************************************************************************/
-
-.logRow-group {
-    background: #EEEEEE;
-    border-bottom: none;
-}
-
-.logGroup {
-    background: #EEEEEE;
-}
-
-.logGroupBox {
-    margin-left: 24px;
-    border-top: 1px solid #D7D7D7;
-    border-left: 1px solid #D7D7D7;
-}
-
-/************************************************************************************************/
-
-.selectorTag,
-.selectorId,
-.selectorClass {
-    font-family: Monaco, monospace;
-    font-weight: normal;
-}
-
-.selectorTag {
-    color: #0000FF;
-}
-
-.selectorId {
-    color: DarkBlue;
-}
-
-.selectorClass {
-    color: red;
-}
-
-/************************************************************************************************/
-
-.objectBox-element {
-    font-family: Monaco, monospace;
-    color: #000088;
-}
-
-.nodeChildren {
-    margin-left: 16px;
-}
-
-.nodeTag {
-    color: blue;
-}
-
-.nodeValue {
-    color: #FF0000;
-    font-weight: normal;
-}
-
-.nodeText,
-.nodeComment {
-    margin: 0 2px;
-    vertical-align: top;
-}
-
-.nodeText {
-    color: #333333;
-}
-
-.nodeComment {
-    color: DarkGreen;
-}
-
-/************************************************************************************************/
-
-.propertyNameCell {
-    vertical-align: top;
-}
-
-.propertyName {
-    font-weight: bold;
-}
diff --git a/lib/web/firebug/firebug.html b/lib/web/firebug/firebug.html
deleted file mode 100644
index 861e6393268a324d12c468e0b4da26beffce9137..0000000000000000000000000000000000000000
--- a/lib/web/firebug/firebug.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
-    <title>Firebug</title>
-    <link rel="stylesheet" type="text/css" href="firebug.css">
-</head>
-
-<body>
-    <div id="toolbar" class="toolbar">
-        <a href="#" onclick="parent.console.clear()">Clear</a>
-        <span class="toolbarRight">
-            <a href="#" onclick="parent.console.close()">Close</a>
-        </span>
-    </div>
-    <div id="log"></div>
-    <input type="text" id="commandLine">
-    
-    <script>parent.onFirebugReady(document);</script>
-</body>
-</html>
diff --git a/lib/web/firebug/firebug.js b/lib/web/firebug/firebug.js
deleted file mode 100644
index 2a5f9b2ac411a8d7722305a5a08f96cb5accc172..0000000000000000000000000000000000000000
--- a/lib/web/firebug/firebug.js
+++ /dev/null
@@ -1,672 +0,0 @@
-
-if (!("console" in window) || !("firebug" in console)) {
-(function()
-{
-    window.console = 
-    {
-        log: function()
-        {
-            logFormatted(arguments, "");
-        },
-        
-        debug: function()
-        {
-            logFormatted(arguments, "debug");
-        },
-        
-        info: function()
-        {
-            logFormatted(arguments, "info");
-        },
-        
-        warn: function()
-        {
-            logFormatted(arguments, "warning");
-        },
-        
-        error: function()
-        {
-            logFormatted(arguments, "error");
-        },
-        
-        assert: function(truth, message)
-        {
-            if (!truth)
-            {
-                var args = [];
-                for (var i = 1; i < arguments.length; ++i)
-                    args.push(arguments[i]);
-                
-                logFormatted(args.length ? args : ["Assertion Failure"], "error");
-                throw message ? message : "Assertion Failure";
-            }
-        },
-        
-        dir: function(object)
-        {
-            var html = [];
-                        
-            var pairs = [];
-            for (var name in object)
-            {
-                try
-                {
-                    pairs.push([name, object[name]]);
-                }
-                catch (exc)
-                {
-                }
-            }
-            
-            pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; });
-            
-            html.push('<table>');
-            for (var i = 0; i < pairs.length; ++i)
-            {
-                var name = pairs[i][0], value = pairs[i][1];
-                
-                html.push('<tr>', 
-                '<td class="propertyNameCell"><span class="propertyName">',
-                    escapeHTML(name), '</span></td>', '<td><span class="propertyValue">');
-                appendObject(value, html);
-                html.push('</span></td></tr>');
-            }
-            html.push('</table>');
-            
-            logRow(html, "dir");
-        },
-        
-        dirxml: function(node)
-        {
-            var html = [];
-            
-            appendNode(node, html);
-            logRow(html, "dirxml");
-        },
-        
-        group: function()
-        {
-            logRow(arguments, "group", pushGroup);
-        },
-        
-        groupEnd: function()
-        {
-            logRow(arguments, "", popGroup);
-        },
-        
-        time: function(name)
-        {
-            timeMap[name] = (new Date()).getTime();
-        },
-        
-        timeEnd: function(name)
-        {
-            if (name in timeMap)
-            {
-                var delta = (new Date()).getTime() - timeMap[name];
-                logFormatted([name+ ":", delta+"ms"]);
-                delete timeMap[name];
-            }
-        },
-        
-        count: function()
-        {
-            this.warn(["count() not supported."]);
-        },
-        
-        trace: function()
-        {
-            this.warn(["trace() not supported."]);
-        },
-        
-        profile: function()
-        {
-            this.warn(["profile() not supported."]);
-        },
-        
-        profileEnd: function()
-        {
-        },
-        
-        clear: function()
-        {
-            consoleBody.innerHTML = "";
-        },
-
-        open: function()
-        {
-            toggleConsole(true);
-        },
-        
-        close: function()
-        {
-            if (frameVisible)
-                toggleConsole();
-        }
-    };
- 
-    // ********************************************************************************************
-       
-    var consoleFrame = null;
-    var consoleBody = null;
-    var commandLine = null;
-    
-    var frameVisible = false;
-    var messageQueue = [];
-    var groupStack = [];
-    var timeMap = {};
-    
-    var clPrefix = ">>> ";
-    
-    var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
-    var isIE = navigator.userAgent.indexOf("MSIE") != -1;
-    var isOpera = navigator.userAgent.indexOf("Opera") != -1;
-    var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1;
-
-    // ********************************************************************************************
-
-    function toggleConsole(forceOpen)
-    {
-        frameVisible = forceOpen || !frameVisible;
-        if (consoleFrame)
-            consoleFrame.style.visibility = frameVisible ? "visible" : "hidden";
-        else
-            waitForBody();
-    }
-
-    function focusCommandLine()
-    {
-        toggleConsole(true);
-        if (commandLine)
-            commandLine.focus();
-    }
-
-    function waitForBody()
-    {
-        if (document.body)
-            createFrame();
-        else
-            setTimeout(waitForBody, 200);
-    }    
-
-    function createFrame()
-    {
-        if (consoleFrame)
-            return;
-        
-        window.onFirebugReady = function(doc)
-        {
-            window.onFirebugReady = null;
-
-            var toolbar = doc.getElementById("toolbar");
-            toolbar.onmousedown = onSplitterMouseDown;
-
-            commandLine = doc.getElementById("commandLine");
-            addEvent(commandLine, "keydown", onCommandLineKeyDown);
-
-            addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
-            
-            consoleBody = doc.getElementById("log");
-            layout();
-            flush();
-        }
-
-        var baseURL = getFirebugURL();
-
-        consoleFrame = document.createElement("iframe");
-        consoleFrame.setAttribute("src", baseURL+"/firebug.html");
-        consoleFrame.setAttribute("frameBorder", "0");
-        consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");    
-        consoleFrame.style.zIndex = "2147483647";
-        consoleFrame.style.position = "fixed";
-        consoleFrame.style.width = "100%";
-        consoleFrame.style.left = "0";
-        consoleFrame.style.bottom = "0";
-        consoleFrame.style.height = "200px";
-        document.body.appendChild(consoleFrame);
-    }
-    
-    function getFirebugURL()
-    {
-        var scripts = document.getElementsByTagName("script");
-        for (var i = 0; i < scripts.length; ++i)
-        {
-            if (scripts[i].src.indexOf("firebug.js") != -1)
-            {
-                var lastSlash = scripts[i].src.lastIndexOf("/");
-                return scripts[i].src.substr(0, lastSlash);
-            }
-        }
-    }
-    
-    function evalCommandLine()
-    {
-        var text = commandLine.value;
-        commandLine.value = "";
-
-        logRow([clPrefix, text], "command");
-        
-        var value;
-        try
-        {
-            value = eval(text);
-        }
-        catch (exc)
-        {
-        }
-
-        //console.log(value);
-    }
-    
-    function layout()
-    {
-        var toolbar = consoleBody.ownerDocument.getElementById("toolbar");
-        var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight);
-        consoleBody.style.top = toolbar.offsetHeight + "px";
-        consoleBody.style.height = height + "px";
-        
-        commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px";
-    }
-    
-    function logRow(message, className, handler)
-    {
-        if (consoleBody)
-            writeMessage(message, className, handler);
-        else
-        {
-            messageQueue.push([message, className, handler]);
-            waitForBody();
-        }
-    }
-    
-    function flush()
-    {
-        var queue = messageQueue;
-        messageQueue = [];
-        
-        for (var i = 0; i < queue.length; ++i)
-            writeMessage(queue[i][0], queue[i][1], queue[i][2]);
-    }
-
-    function writeMessage(message, className, handler)
-    {
-        var isScrolledToBottom =
-            consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight;
-
-        if (!handler)
-            handler = writeRow;
-        
-        handler(message, className);
-        
-        if (isScrolledToBottom)
-            consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight;
-    }
-    
-    function appendRow(row)
-    {
-        var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody;
-        container.appendChild(row);
-    }
-
-    function writeRow(message, className)
-    {
-        var row = consoleBody.ownerDocument.createElement("div");
-        row.className = "logRow" + (className ? " logRow-"+className : "");
-        row.innerHTML = message.join("");
-        appendRow(row);
-    }
-
-    function pushGroup(message, className)
-    {
-        logFormatted(message, className);
-
-        var groupRow = consoleBody.ownerDocument.createElement("div");
-        groupRow.className = "logGroup";
-        var groupRowBox = consoleBody.ownerDocument.createElement("div");
-        groupRowBox.className = "logGroupBox";
-        groupRow.appendChild(groupRowBox);
-        appendRow(groupRowBox);
-        groupStack.push(groupRowBox);
-    }
-
-    function popGroup()
-    {
-        groupStack.pop();
-    }
-    
-    // ********************************************************************************************
-
-    function logFormatted(objects, className)
-    {
-        var html = [];
-
-        var format = objects[0];
-        var objIndex = 0;
-
-        if (typeof(format) != "string")
-        {
-            format = "";
-            objIndex = -1;
-        }
-
-        var parts = parseFormat(format);
-        for (var i = 0; i < parts.length; ++i)
-        {
-            var part = parts[i];
-            if (part && typeof(part) == "object")
-            {
-                var object = objects[++objIndex];
-                part.appender(object, html);
-            }
-            else
-                appendText(part, html);
-        }
-
-        for (var i = objIndex+1; i < objects.length; ++i)
-        {
-            appendText(" ", html);
-            
-            var object = objects[i];
-            if (typeof(object) == "string")
-                appendText(object, html);
-            else
-                appendObject(object, html);
-        }
-        
-        logRow(html, className);
-    }
-
-    function parseFormat(format)
-    {
-        var parts = [];
-
-        var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;    
-        var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};
-
-        for (var m = reg.exec(format); m; m = reg.exec(format))
-        {
-            var type = m[8] ? m[8] : m[5];
-            var appender = type in appenderMap ? appenderMap[type] : appendObject;
-            var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);
-
-            parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));
-            parts.push({appender: appender, precision: precision});
-
-            format = format.substr(m.index+m[0].length);
-        }
-
-        parts.push(format);
-
-        return parts;
-    }
-
-    function escapeHTML(value)
-    {
-        function replaceChars(ch)
-        {
-            switch (ch)
-            {
-                case "<":
-                    return "&lt;";
-                case ">":
-                    return "&gt;";
-                case "&":
-                    return "&amp;";
-                case "'":
-                    return "&#39;";
-                case '"':
-                    return "&quot;";
-            }
-            return "?";
-        };
-        return String(value).replace(/[<>&"']/g, replaceChars);
-    }
-
-    function objectToString(object)
-    {
-        try
-        {
-            return object+"";
-        }
-        catch (exc)
-        {
-            return null;
-        }
-    }
-
-    // ********************************************************************************************
-
-    function appendText(object, html)
-    {
-        html.push(escapeHTML(objectToString(object)));
-    }
-
-    function appendNull(object, html)
-    {
-        html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>');
-    }
-
-    function appendString(object, html)
-    {
-        html.push('<span class="objectBox-string">&quot;', escapeHTML(objectToString(object)),
-            '&quot;</span>');
-    }
-
-    function appendInteger(object, html)
-    {
-        html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
-    }
-
-    function appendFloat(object, html)
-    {
-        html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
-    }
-
-    function appendFunction(object, html)
-    {
-        var reName = /function ?(.*?)\(/;
-        var m = reName.exec(objectToString(object));
-        var name = m ? m[1] : "function";
-        html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>');
-    }
-    
-    function appendObject(object, html)
-    {
-        try
-        {
-            if (object == undefined)
-                appendNull("undefined", html);
-            else if (object == null)
-                appendNull("null", html);
-            else if (typeof object == "string")
-                appendString(object, html);
-            else if (typeof object == "number")
-                appendInteger(object, html);
-            else if (typeof object == "function")
-                appendFunction(object, html);
-            else if (object.nodeType == 1)
-                appendSelector(object, html);
-            else if (typeof object == "object")
-                appendObjectFormatted(object, html);
-            else
-                appendText(object, html);
-        }
-        catch (exc)
-        {
-        }
-    }
-        
-    function appendObjectFormatted(object, html)
-    {
-        var text = objectToString(object);
-        var reObject = /\[object (.*?)\]/;
-
-        var m = reObject.exec(text);
-        html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>')
-    }
-    
-    function appendSelector(object, html)
-    {
-        html.push('<span class="objectBox-selector">');
-
-        html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>');
-        if (object.id)
-            html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>');
-        if (object.className)
-            html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>');
-
-        html.push('</span>');
-    }
-
-    function appendNode(node, html)
-    {
-        if (node.nodeType == 1)
-        {
-            html.push(
-                '<div class="objectBox-element">',
-                    '&lt;<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>');
-
-            for (var i = 0; i < node.attributes.length; ++i)
-            {
-                var attr = node.attributes[i];
-                if (!attr.specified)
-                    continue;
-                
-                html.push('&nbsp;<span class="nodeName">', attr.nodeName.toLowerCase(),
-                    '</span>=&quot;<span class="nodeValue">', escapeHTML(attr.nodeValue),
-                    '</span>&quot;')
-            }
-
-            if (node.firstChild)
-            {
-                html.push('&gt;</div><div class="nodeChildren">');
-
-                for (var child = node.firstChild; child; child = child.nextSibling)
-                    appendNode(child, html);
-                    
-                html.push('</div><div class="objectBox-element">&lt;/<span class="nodeTag">', 
-                    node.nodeName.toLowerCase(), '&gt;</span></div>');
-            }
-            else
-                html.push('/&gt;</div>');
-        }
-        else if (node.nodeType == 3)
-        {
-            html.push('<div class="nodeText">', escapeHTML(node.nodeValue),
-                '</div>');
-        }
-    }
-
-    // ********************************************************************************************
-    
-    function addEvent(object, name, handler)
-    {
-        if (document.all)
-            object.attachEvent("on"+name, handler);
-        else
-            object.addEventListener(name, handler, false);
-    }
-    
-    function removeEvent(object, name, handler)
-    {
-        if (document.all)
-            object.detachEvent("on"+name, handler);
-        else
-            object.removeEventListener(name, handler, false);
-    }
-    
-    function cancelEvent(event)
-    {
-        if (document.all)
-            event.cancelBubble = true;
-        else
-            event.stopPropagation();        
-    }
-
-    function onError(msg, href, lineNo)
-    {
-        var html = [];
-        
-        var lastSlash = href.lastIndexOf("/");
-        var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1);
-        
-        html.push(
-            '<span class="errorMessage">', msg, '</span>', 
-            '<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>'
-        );
-        
-        logRow(html, "error");
-    };
-
-    function onKeyDown(event)
-    {
-        if (event.keyCode == 123)
-            toggleConsole();
-        else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey
-                 && (event.metaKey || event.ctrlKey))
-            focusCommandLine();
-        else
-            return;
-        
-        cancelEvent(event);
-    }
-
-    function onSplitterMouseDown(event)
-    {
-        if (isSafari || isOpera)
-            return;
-        
-        addEvent(document, "mousemove", onSplitterMouseMove);
-        addEvent(document, "mouseup", onSplitterMouseUp);
-
-        for (var i = 0; i < frames.length; ++i)
-        {
-            addEvent(frames[i].document, "mousemove", onSplitterMouseMove);
-            addEvent(frames[i].document, "mouseup", onSplitterMouseUp);
-        }
-    }
-    
-    function onSplitterMouseMove(event)
-    {
-        var win = document.all
-            ? event.srcElement.ownerDocument.parentWindow
-            : event.target.ownerDocument.defaultView;
-
-        var clientY = event.clientY;
-        if (win != win.parent)
-            clientY += win.frameElement ? win.frameElement.offsetTop : 0;
-        
-        var height = consoleFrame.offsetTop + consoleFrame.clientHeight;
-        var y = height - clientY;
-        
-        consoleFrame.style.height = y + "px";
-        layout();
-    }
-    
-    function onSplitterMouseUp(event)
-    {
-        removeEvent(document, "mousemove", onSplitterMouseMove);
-        removeEvent(document, "mouseup", onSplitterMouseUp);
-
-        for (var i = 0; i < frames.length; ++i)
-        {
-            removeEvent(frames[i].document, "mousemove", onSplitterMouseMove);
-            removeEvent(frames[i].document, "mouseup", onSplitterMouseUp);
-        }
-    }
-    
-    function onCommandLineKeyDown(event)
-    {
-        if (event.keyCode == 13)
-            evalCommandLine();
-        else if (event.keyCode == 27)
-            commandLine.value = "";
-    }
-    
-    window.onerror = onError;
-    addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
-    
-    if (document.documentElement.getAttribute("debug") == "true")
-        toggleConsole(true);
-})();
-}
diff --git a/lib/web/firebug/firebugx.js b/lib/web/firebug/firebugx.js
deleted file mode 100644
index 5a467fc14389a4558eca75c842ab224d5ac268cb..0000000000000000000000000000000000000000
--- a/lib/web/firebug/firebugx.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-if (!("console" in window) || !("firebug" in console))
-{
-    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
-    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
-
-    window.console = {};
-    for (var i = 0; i < names.length; ++i)
-        window.console[names[i]] = function() {}
-}
\ No newline at end of file
diff --git a/lib/web/firebug/infoIcon.png b/lib/web/firebug/infoIcon.png
deleted file mode 100644
index da1e5334c19375c7855e04792661bf2cc15b7e14..0000000000000000000000000000000000000000
Binary files a/lib/web/firebug/infoIcon.png and /dev/null differ
diff --git a/lib/web/firebug/warningIcon.png b/lib/web/firebug/warningIcon.png
deleted file mode 100644
index de51084e8489f498b89dd9a59d82eb9564b7d050..0000000000000000000000000000000000000000
Binary files a/lib/web/firebug/warningIcon.png and /dev/null differ
diff --git a/lib/web/flash/AC_RunActiveContent.js b/lib/web/flash/AC_RunActiveContent.js
deleted file mode 100644
index 39c294bbd8178af08cefe190531f6fee3b5c22dc..0000000000000000000000000000000000000000
--- a/lib/web/flash/AC_RunActiveContent.js
+++ /dev/null
@@ -1,292 +0,0 @@
-//v1.7
-// Flash Player Version Detection
-// Detect Client Browser type
-// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
-var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
-var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
-var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
-
-function ControlVersion()
-{
-	var version;
-	var axo;
-	var e;
-
-	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
-
-	try {
-		// version will be set for 7.X or greater players
-		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
-		version = axo.GetVariable("$version");
-	} catch (e) {
-	}
-
-	if (!version)
-	{
-		try {
-			// version will be set for 6.X players only
-			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
-			
-			// installed player is some revision of 6.0
-			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
-			// so we have to be careful. 
-			
-			// default to the first public version
-			version = "WIN 6,0,21,0";
-
-			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
-			axo.AllowScriptAccess = "always";
-
-			// safe to call for 6.0r47 or greater
-			version = axo.GetVariable("$version");
-
-		} catch (e) {
-		}
-	}
-
-	if (!version)
-	{
-		try {
-			// version will be set for 4.X or 5.X player
-			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
-			version = axo.GetVariable("$version");
-		} catch (e) {
-		}
-	}
-
-	if (!version)
-	{
-		try {
-			// version will be set for 3.X player
-			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
-			version = "WIN 3,0,18,0";
-		} catch (e) {
-		}
-	}
-
-	if (!version)
-	{
-		try {
-			// version will be set for 2.X player
-			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
-			version = "WIN 2,0,0,11";
-		} catch (e) {
-			version = -1;
-		}
-	}
-	
-	return version;
-}
-
-// JavaScript helper required to detect Flash Player PlugIn version information
-function GetSwfVer(){
-	// NS/Opera version >= 3 check for Flash plugin in plugin array
-	var flashVer = -1;
-	
-	if (navigator.plugins != null && navigator.plugins.length > 0) {
-		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
-			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
-			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
-			var descArray = flashDescription.split(" ");
-			var tempArrayMajor = descArray[2].split(".");			
-			var versionMajor = tempArrayMajor[0];
-			var versionMinor = tempArrayMajor[1];
-			var versionRevision = descArray[3];
-			if (versionRevision == "") {
-				versionRevision = descArray[4];
-			}
-			if (versionRevision[0] == "d") {
-				versionRevision = versionRevision.substring(1);
-			} else if (versionRevision[0] == "r") {
-				versionRevision = versionRevision.substring(1);
-				if (versionRevision.indexOf("d") > 0) {
-					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
-				}
-			}
-			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
-		}
-	}
-	// MSN/WebTV 2.6 supports Flash 4
-	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
-	// WebTV 2.5 supports Flash 3
-	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
-	// older WebTV supports Flash 2
-	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
-	else if ( isIE && isWin && !isOpera ) {
-		flashVer = ControlVersion();
-	}	
-	return flashVer;
-}
-
-// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
-function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
-{
-	versionStr = GetSwfVer();
-	if (versionStr == -1 ) {
-		return false;
-	} else if (versionStr != 0) {
-		if(isIE && isWin && !isOpera) {
-			// Given "WIN 2,0,0,11"
-			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
-			tempString        = tempArray[1];			// "2,0,0,11"
-			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
-		} else {
-			versionArray      = versionStr.split(".");
-		}
-		var versionMajor      = versionArray[0];
-		var versionMinor      = versionArray[1];
-		var versionRevision   = versionArray[2];
-
-        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
-		if (versionMajor > parseFloat(reqMajorVer)) {
-			return true;
-		} else if (versionMajor == parseFloat(reqMajorVer)) {
-			if (versionMinor > parseFloat(reqMinorVer))
-				return true;
-			else if (versionMinor == parseFloat(reqMinorVer)) {
-				if (versionRevision >= parseFloat(reqRevision))
-					return true;
-			}
-		}
-		return false;
-	}
-}
-
-function AC_AddExtension(src, ext)
-{
-  if (src.indexOf('?') != -1)
-    return src.replace(/\?/, ext+'?'); 
-  else
-    return src + ext;
-}
-
-function AC_Generateobj(objAttrs, params, embedAttrs) 
-{ 
-  var str = '';
-  if (isIE && isWin && !isOpera)
-  {
-    str += '<object ';
-    for (var i in objAttrs)
-    {
-      str += i + '="' + objAttrs[i] + '" ';
-    }
-    str += '>';
-    for (var i in params)
-    {
-      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
-    }
-    str += '</object>';
-  }
-  else
-  {
-    str += '<embed ';
-    for (var i in embedAttrs)
-    {
-      str += i + '="' + embedAttrs[i] + '" ';
-    }
-    str += '> </embed>';
-  }
-
-  document.write(str);
-}
-
-function AC_FL_RunContent(){
-  var ret = 
-    AC_GetArgs
-    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
-     , "application/x-shockwave-flash"
-    );
-  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
-}
-
-function AC_SW_RunContent(){
-  var ret = 
-    AC_GetArgs
-    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
-     , null
-    );
-  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
-}
-
-function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
-  var ret = new Object();
-  ret.embedAttrs = new Object();
-  ret.params = new Object();
-  ret.objAttrs = new Object();
-  for (var i=0; i < args.length; i=i+2){
-    var currArg = args[i].toLowerCase();    
-
-    switch (currArg){	
-      case "classid":
-        break;
-      case "pluginspage":
-        ret.embedAttrs[args[i]] = args[i+1];
-        break;
-      case "src":
-      case "movie":	
-        args[i+1] = AC_AddExtension(args[i+1], ext);
-        ret.embedAttrs["src"] = args[i+1];
-        ret.params[srcParamName] = args[i+1];
-        break;
-      case "onafterupdate":
-      case "onbeforeupdate":
-      case "onblur":
-      case "oncellchange":
-      case "onclick":
-      case "ondblclick":
-      case "ondrag":
-      case "ondragend":
-      case "ondragenter":
-      case "ondragleave":
-      case "ondragover":
-      case "ondrop":
-      case "onfinish":
-      case "onfocus":
-      case "onhelp":
-      case "onmousedown":
-      case "onmouseup":
-      case "onmouseover":
-      case "onmousemove":
-      case "onmouseout":
-      case "onkeypress":
-      case "onkeydown":
-      case "onkeyup":
-      case "onload":
-      case "onlosecapture":
-      case "onpropertychange":
-      case "onreadystatechange":
-      case "onrowsdelete":
-      case "onrowenter":
-      case "onrowexit":
-      case "onrowsinserted":
-      case "onstart":
-      case "onscroll":
-      case "onbeforeeditfocus":
-      case "onactivate":
-      case "onbeforedeactivate":
-      case "ondeactivate":
-      case "type":
-      case "codebase":
-      case "id":
-        ret.objAttrs[args[i]] = args[i+1];
-        break;
-      case "width":
-      case "height":
-      case "align":
-      case "vspace": 
-      case "hspace":
-      case "class":
-      case "title":
-      case "accesskey":
-      case "name":
-      case "tabindex":
-        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
-        break;
-      default:
-        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
-    }
-  }
-  ret.objAttrs["classid"] = classid;
-  if (mimeType) ret.embedAttrs["type"] = mimeType;
-  return ret;
-}
diff --git a/lib/web/headjs/head.min.js b/lib/web/headjs/head.min.js
deleted file mode 100644
index cb58a5cfb384faf5880c1f53ddb20b6fa37f6938..0000000000000000000000000000000000000000
--- a/lib/web/headjs/head.min.js
+++ /dev/null
@@ -1,341 +0,0 @@
-/*!
- * HeadJS     The only script in your <HEAD>
- * Author     Tero Piirainen  (tipiirai)
- * Maintainer Robert Hoffmann (itechnology)
- * License    MIT / http://bit.ly/mit-license
- *
- * http://headjs.com
- */
-(function (a, w) {
-    function f(a) {
-        p[p.length] = a
-    }
-
-    function m(a) {
-        q.className = q.className.replace(RegExp("\\b" + a + "\\b"), "")
-    }
-
-    function k(a, d) {
-        for (var b = 0, c = a.length; b < c; b++)d.call(a, a[b], b)
-    }
-
-    function s() {
-        q.className = q.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, "");
-        var b = a.innerWidth || q.clientWidth, d = a.outerWidth || a.screen.width;
-        h.screen.innerWidth = b;
-        h.screen.outerWidth = d;
-        f("w-" + b);
-        k(c.screens, function (a) {
-            b > a ? (c.screensCss.gt && f("gt-" + a), c.screensCss.gte && f("gte-" +
-                a)) : b < a ? (c.screensCss.lt && f("lt-" + a), c.screensCss.lte && f("lte-" + a)) : b === a && (c.screensCss.lte && f("lte-" + a), c.screensCss.eq && f("e-q" + a), c.screensCss.gte && f("gte-" + a))
-        });
-        var d = a.innerHeight || q.clientHeight, g = a.outerHeight || a.screen.height;
-        h.screen.innerHeight = d;
-        h.screen.outerHeight = g;
-        h.feature("portrait", d > b);
-        h.feature("landscape", d < b)
-    }
-
-    function r() {
-        a.clearTimeout(u);
-        u = a.setTimeout(s, 100)
-    }
-
-    var n = a.document, g = a.navigator, t = a.location, q = n.documentElement, p = [], c = {screens:[240, 320, 480, 640, 768, 800, 1024, 1280,
-        1440, 1680, 1920], screensCss:{gt:!0, gte:!1, lt:!0, lte:!1, eq:!1}, browsers:[
-        {ie:{min:6, max:10}}
-    ], browserCss:{gt:!0, gte:!1, lt:!0, lte:!1, eq:!0}, section:"-section", page:"-page", head:"head"};
-    if (a.head_conf)for (var b in a.head_conf)a.head_conf[b] !== w && (c[b] = a.head_conf[b]);
-    var h = a[c.head] = function () {
-        h.ready.apply(null, arguments)
-    };
-    h.feature = function (a, b, c) {
-        if (!a)return q.className += " " + p.join(" "), p = [], h;
-        "[object Function]" === Object.prototype.toString.call(b) && (b = b.call());
-        f((b ? "" : "no-") + a);
-        h[a] = !!b;
-        c || (m("no-" +
-            a), m(a), h.feature());
-        return h
-    };
-    h.feature("js", !0);
-    b = g.userAgent.toLowerCase();
-    g = /mobile|midp/.test(b);
-    h.feature("mobile", g, !0);
-    h.feature("desktop", !g, !0);
-    b = /(chrome|firefox)[ \/]([\w.]+)/.exec(b) || /(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(b) || /(android)(?:.*version)?[ \/]([\w.]+)/.exec(b) || /(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(b) || /(msie) ([\w.]+)/.exec(b) || [];
-    g = b[1];
-    b = parseFloat(b[2]);
-    switch (g) {
-        case "msie":
-            g = "ie";
-            b = n.documentMode || b;
-            break;
-        case "firefox":
-            g = "ff";
-            break;
-        case "ipod":
-        case "ipad":
-        case "iphone":
-            g =
-                "ios";
-            break;
-        case "webkit":
-            g = "safari"
-    }
-    h.browser = {name:g, version:b};
-    h.browser[g] = !0;
-    for (var v = 0, x = c.browsers.length; v < x; v++)for (var i in c.browsers[v])if (g === i) {
-        f(i);
-        for (var A = c.browsers[v][i].max, l = c.browsers[v][i].min; l <= A; l++)b > l ? (c.browserCss.gt && f("gt-" + i + l), c.browserCss.gte && f("gte-" + i + l)) : b < l ? (c.browserCss.lt && f("lt-" + i + l), c.browserCss.lte && f("lte-" + i + l)) : b === l && (c.browserCss.lte && f("lte-" + i + l), c.browserCss.eq && f("eq-" + i + l), c.browserCss.gte && f("gte-" + i + l))
-    } else f("no-" + i);
-    "ie" === g && 9 > b && k("abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),
-        function (a) {
-            n.createElement(a)
-        });
-    k(t.pathname.split("/"), function (a, b) {
-        if (2 < this.length && this[b + 1] !== w)b && f(this.slice(1, b + 1).join("-").toLowerCase() + c.section); else {
-            var g = a || "index", h = g.indexOf(".");
-            0 < h && (g = g.substring(0, h));
-            q.id = g.toLowerCase() + c.page;
-            b || f("root" + c.section)
-        }
-    });
-    h.screen = {height:a.screen.height, width:a.screen.width};
-    s();
-    var u = 0;
-    a.addEventListener ? a.addEventListener("resize", r, !1) : a.attachEvent("onresize", r)
-})(window);
-(function (a, w) {
-    function f(a) {
-        var f = a.charAt(0).toUpperCase() + a.substr(1), a = (a + " " + r.join(f + " ") + f).split(" "), c;
-        a:{
-            for (c in a)if (k[a[c]] !== w) {
-                c = !0;
-                break a
-            }
-            c = !1
-        }
-        return!!c
-    }
-
-    var m = a.document.createElement("i"), k = m.style, s = " -o- -moz- -ms- -webkit- -khtml- ".split(" "), r = ["Webkit", "Moz", "O", "ms", "Khtml"], n = a[a.head_conf && a.head_conf.head || "head"], g = {gradient:function () {
-        k.cssText = ("background-image:" + s.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));background-image:") + s.join("linear-gradient(left top,#eee,#fff);background-image:")).slice(0,
-            -17);
-        return!!k.backgroundImage
-    }, rgba:function () {
-        k.cssText = "background-color:rgba(0,0,0,0.5)";
-        return!!k.backgroundColor
-    }, opacity:function () {
-        return"" === m.style.opacity
-    }, textshadow:function () {
-        return"" === k.textShadow
-    }, multiplebgs:function () {
-        k.cssText = "background:url(//:),url(//:),red url(//:)";
-        return/(url\s*\(.*?){3}/.test(k.background)
-    }, boxshadow:function () {
-        return f("boxShadow")
-    }, borderimage:function () {
-        return f("borderImage")
-    }, borderradius:function () {
-        return f("borderRadius")
-    }, cssreflections:function () {
-        return f("boxReflect")
-    },
-        csstransforms:function () {
-            return f("transform")
-        }, csstransitions:function () {
-            return f("transition")
-        }, touch:function () {
-            return"ontouchstart"in a
-        }, retina:function () {
-            return 1 < a.devicePixelRatio
-        }, fontface:function () {
-            var a = n.browser.version;
-            switch (n.browser.name) {
-                case "ie":
-                    return 9 <= a;
-                case "chrome":
-                    return 13 <= a;
-                case "ff":
-                    return 6 <= a;
-                case "ios":
-                    return 5 <= a;
-                case "android":
-                    return!1;
-                case "webkit":
-                    return 5.1 <= a;
-                case "opera":
-                    return 10 <= a;
-                default:
-                    return!1
-            }
-        }}, t;
-    for (t in g)g[t] && n.feature(t, g[t].call(), !0);
-    n.feature()
-})(window);
-(function (a, w) {
-    function f() {
-    }
-
-    function m(j, a) {
-        if (j) {
-            "object" === typeof j && (j = [].slice.call(j));
-            for (var b = 0, c = j.length; b < c; b++)a.call(j, j[b], b)
-        }
-    }
-
-    function k(a, b) {
-        var e = Object.prototype.toString.call(b).slice(8, -1);
-        return b !== w && null !== b && e === a
-    }
-
-    function s(a) {
-        return k("Function", a)
-    }
-
-    function r(a) {
-        a = a || f;
-        a._done || (a(), a._done = 1)
-    }
-
-    function n(a) {
-        var b = {};
-        if ("object" === typeof a)for (var e in a)a[e] && (b = {name:e, url:a[e]}); else b = a.split("/"), b = b[b.length - 1], e = b.indexOf("?"), b = {name:-1 !== e ? b.substring(0, e) : b, url:a};
-        return(a = i[b.name]) && a.url === b.url ? a : i[b.name] = b
-    }
-
-    function g(a) {
-        var a = a || i, b;
-        for (b in a)if (a.hasOwnProperty(b) && a[b].state !== y)return!1;
-        return!0
-    }
-
-    function t(a, b) {
-        b = b || f;
-        a.state === y ? b() : a.state === D ? d.ready(a.name, b) : a.state === C ? a.onpreload.push(function () {
-            t(a, b)
-        }) : (a.state = D, q(a, function () {
-            a.state = y;
-            b();
-            m(x[a.name], function (a) {
-                r(a)
-            });
-            u && g() && m(x.ALL, function (a) {
-                r(a)
-            })
-        }))
-    }
-
-    function q(j, c) {
-        var c = c || f, e;
-        /\.css[^\.]*$/.test(j.url) ? (e = b.createElement("link"), e.type = "text/" + (j.type || "css"), e.rel = "stylesheet",
-            e.href = j.url) : (e = b.createElement("script"), e.type = "text/" + (j.type || "javascript"), e.src = j.url);
-        e.onload = e.onreadystatechange = function (j) {
-            j = j || a.event;
-            if ("load" === j.type || /loaded|complete/.test(e.readyState) && (!b.documentMode || 9 > b.documentMode))e.onload = e.onreadystatechange = e.onerror = null, c()
-        };
-        e.onerror = function () {
-            e.onload = e.onreadystatechange = e.onerror = null;
-            c()
-        };
-        e.async = !1;
-        e.defer = !1;
-        var d = b.head || b.getElementsByTagName("head")[0];
-        d.insertBefore(e, d.lastChild)
-    }
-
-    function p() {
-        b.body ? u || (u = !0, m(h, function (a) {
-            r(a)
-        })) :
-            (a.clearTimeout(d.readyTimeout), d.readyTimeout = a.setTimeout(p, 50))
-    }
-
-    function c() {
-        b.addEventListener ? (b.removeEventListener("DOMContentLoaded", c, !1), p()) : "complete" === b.readyState && (b.detachEvent("onreadystatechange", c), p())
-    }
-
-    var b = a.document, h = [], v = [], x = {}, i = {}, A = "async"in b.createElement("script") || "MozAppearance"in b.documentElement.style || a.opera, l, u, B = a.head_conf && a.head_conf.head || "head", d = a[B] = a[B] || function () {
-        d.ready.apply(null, arguments)
-    }, C = 1, D = 3, y = 4;
-    d.load = A ? function () {
-        var a = arguments, b = a[a.length -
-            1], e = {};
-        s(b) || (b = null);
-        m(a, function (c, d) {
-            c !== b && (c = n(c), e[c.name] = c, t(c, b && d === a.length - 2 ? function () {
-                g(e) && r(b)
-            } : null))
-        });
-        return d
-    } : function () {
-        var a = arguments, b = [].slice.call(a, 1), c = b[0];
-        if (!l)return v.push(function () {
-            d.load.apply(null, a)
-        }), d;
-        c ? (m(b, function (a) {
-            if (!s(a)) {
-                var b = n(a);
-                b.state === w && (b.state = C, b.onpreload = [], q({url:b.url, type:"cache"}, function () {
-                    b.state = 2;
-                    m(b.onpreload, function (a) {
-                        a.call()
-                    })
-                }))
-            }
-        }), t(n(a[0]), s(c) ? c : function () {
-            d.load.apply(null, b)
-        })) : t(n(a[0]));
-        return d
-    };
-    d.js = d.load;
-    d.test =
-        function (a, b, c, g) {
-            a = "object" === typeof a ? a : {test:a, success:b ? k("Array", b) ? b : [b] : !1, failure:c ? k("Array", c) ? c : [c] : !1, callback:g || f};
-            (b = !!a.test) && a.success ? (a.success.push(a.callback), d.load.apply(null, a.success)) : !b && a.failure ? (a.failure.push(a.callback), d.load.apply(null, a.failure)) : g();
-            return d
-        };
-    d.ready = function (a, c) {
-        if (a === b)return u ? r(c) : h.push(c), d;
-        s(a) && (c = a, a = "ALL");
-        if ("string" !== typeof a || !s(c))return d;
-        var e = i[a];
-        if (e && e.state === y || "ALL" === a && g() && u)return r(c), d;
-        (e = x[a]) ? e.push(c) : x[a] = [c];
-        return d
-    };
-    d.ready(b, function () {
-        g() && m(x.ALL, function (a) {
-            r(a)
-        });
-        d.feature && d.feature("domloaded", !0)
-    });
-    if ("complete" === b.readyState)p(); else if (b.addEventListener)b.addEventListener("DOMContentLoaded", c, !1), a.addEventListener("load", p, !1); else {
-        b.attachEvent("onreadystatechange", c);
-        a.attachEvent("onload", p);
-        var z = !1;
-        try {
-            z = null == a.frameElement && b.documentElement
-        } catch (F) {
-        }
-        z && z.doScroll && function E() {
-            if (!u) {
-                try {
-                    z.doScroll("left")
-                } catch (b) {
-                    a.clearTimeout(d.readyTimeout);
-                    d.readyTimeout = a.setTimeout(E, 50);
-                    return
-                }
-                p()
-            }
-        }()
-    }
-    setTimeout(function () {
-        l = !0;
-        m(v, function (a) {
-            a()
-        })
-    }, 300)
-})(window);
diff --git a/lib/web/jquery/editableMultiselect/js/jquery.multiselect.js b/lib/web/jquery/editableMultiselect/js/jquery.multiselect.js
index 2cadbae61a3652003e42a052e9565f355398babe..4a5fd82e15e36ac3a73e9bc0e39c83cfe5bf23df 100644
--- a/lib/web/jquery/editableMultiselect/js/jquery.multiselect.js
+++ b/lib/web/jquery/editableMultiselect/js/jquery.multiselect.js
@@ -1,4 +1,7 @@
-(function($) {
+define([
+    "jquery"
+], function($){
+
     /*
      * jQuery.multiselect plugin
      *
@@ -190,4 +193,4 @@
             reset();
         }).end();
     };
-})(jQuery);
+});
\ No newline at end of file
diff --git a/lib/web/jquery/farbtastic/jquery.farbtastic.js b/lib/web/jquery/farbtastic/jquery.farbtastic.js
index 43fcca1d880da3310ac9e7fd58da53e10c147077..c6a5b4524988c0c46337fe0601a430affb7856eb 100644
--- a/lib/web/jquery/farbtastic/jquery.farbtastic.js
+++ b/lib/web/jquery/farbtastic/jquery.farbtastic.js
@@ -17,6 +17,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+define([
+  "jquery"
+], function(jQuery){
+
 jQuery.fn.farbtastic = function (callback) {
   jQuery.farbtastic(this, callback);
   return this;
@@ -342,4 +346,6 @@ jQuery._farbtastic = function (container, callback) {
   if (callback) {
     fb.linkTo(callback);
   }
-}
\ No newline at end of file
+}
+
+});
\ No newline at end of file
diff --git a/lib/web/jquery/fileUploader/bootstrap.js b/lib/web/jquery/fileUploader/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..10747cbd61d0c05289a2cc82a702ed8433f0a73a
--- /dev/null
+++ b/lib/web/jquery/fileUploader/bootstrap.js
@@ -0,0 +1,3 @@
+require([
+    "jquery/file-uploader"
+]);
\ No newline at end of file
diff --git a/lib/web/jquery/fileUploader/canvas-to-blob.min.js b/lib/web/jquery/fileUploader/canvas-to-blob.js
similarity index 100%
rename from lib/web/jquery/fileUploader/canvas-to-blob.min.js
rename to lib/web/jquery/fileUploader/canvas-to-blob.js
diff --git a/lib/web/jquery/fileUploader/jquery.fileupload-fp.js b/lib/web/jquery/fileUploader/jquery.fileupload-fp.js
index 9b45c68204b3ac0683a62397922d51844c5a4092..ee8f46342a93a33817bfd2f7809af3aa83e56e07 100644
--- a/lib/web/jquery/fileUploader/jquery.fileupload-fp.js
+++ b/lib/web/jquery/fileUploader/jquery.fileupload-fp.js
@@ -18,9 +18,9 @@
         // Register as an anonymous AMD module:
         define([
             'jquery',
-            'load-image',
-            'canvas-to-blob',
-            './jquery.fileupload.js'
+            'jquery/fileUploader/load-image',
+            'jquery/fileUploader/canvas-to-blob',
+            'jquery/fileUploader/jquery.fileupload'
         ], factory);
     } else {
         // Browser globals:
diff --git a/lib/web/jquery/fileUploader/jquery.fileupload-ui.js b/lib/web/jquery/fileUploader/jquery.fileupload-ui.js
index 216ef6cbcf30548f09cebad3c6344e904fd2b6b9..828027fc24dfa5904109a5702eaf8112e7b2bf24 100644
--- a/lib/web/jquery/fileUploader/jquery.fileupload-ui.js
+++ b/lib/web/jquery/fileUploader/jquery.fileupload-ui.js
@@ -18,9 +18,10 @@
         // Register as an anonymous AMD module:
         define([
             'jquery',
-            'tmpl',
-            'load-image',
-            './jquery.fileupload-fp.js'
+            'jquery/template',
+            'jquery/fileUploader/load-image',
+            'jquery/fileUploader/jquery.fileupload-fp',
+            'jquery/fileUploader/jquery.iframe-transport'
         ], factory);
     } else {
         // Browser globals:
diff --git a/lib/web/jquery/fileUploader/jquery.fileupload.js b/lib/web/jquery/fileUploader/jquery.fileupload.js
index b2638ef919f3363cc924e63242684c42cb6338b9..f4813d16a10440c393a93cabbb23a96a1f61a2bf 100644
--- a/lib/web/jquery/fileUploader/jquery.fileupload.js
+++ b/lib/web/jquery/fileUploader/jquery.fileupload.js
@@ -18,7 +18,7 @@
         // Register as an anonymous AMD module:
         define([
             'jquery',
-            'jquery.ui.widget'
+            'jquery/ui'
         ], factory);
     } else {
         // Browser globals:
diff --git a/lib/web/jquery/fileUploader/load-image.min.js b/lib/web/jquery/fileUploader/load-image.js
similarity index 100%
rename from lib/web/jquery/fileUploader/load-image.min.js
rename to lib/web/jquery/fileUploader/load-image.js
diff --git a/lib/web/jquery/jquery-ui-1.9.2.js b/lib/web/jquery/jquery-ui-1.9.2.js
index d556f0d7f605fcc1ab4dad10ebd7ee6d3e5bc35c..cc141602954f86adcce844f8ee003507e05ad12f 100644
--- a/lib/web/jquery/jquery-ui-1.9.2.js
+++ b/lib/web/jquery/jquery-ui-1.9.2.js
@@ -3,6 +3,17 @@
 * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
 * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
 
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/jquery.cookie"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function (jQuery) {
+
 (function( $, undefined ) {
 
 var uuid = 0,
@@ -14931,3 +14942,5 @@ $.widget( "ui.tooltip", {
 });
 
 }( jQuery ) );
+
+}));
\ No newline at end of file
diff --git a/lib/web/jquery/jquery-ui-timepicker-addon.js b/lib/web/jquery/jquery-ui-timepicker-addon.js
index 8f6eb19a87073d7a7854eb5197303330b0f183de..0a52b7dec4f1900493fc28db2344a1aa10ec710f 100644
--- a/lib/web/jquery/jquery-ui-timepicker-addon.js
+++ b/lib/web/jquery/jquery-ui-timepicker-addon.js
@@ -1,7 +1,16 @@
 /*! jQuery Timepicker Addon - v1.4.3 - 2013-11-30
 * http://trentrichardson.com/examples/timepicker
 * Copyright (c) 2013 Trent Richardson; Licensed MIT */
-(function ($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
 
 	/*
 	* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
@@ -2142,4 +2151,4 @@
 	*/
 	$.timepicker.version = "1.4.3";
 
-})(jQuery);
\ No newline at end of file
+}));
\ No newline at end of file
diff --git a/lib/web/jquery/jquery-ui.js b/lib/web/jquery/jquery-ui.js
index 676e1f0cf3da91b7e50e5eb12265a6ae3276f4bf..b64228ac1c49c7a42ab36d6163ed59cd57d534af 100644
--- a/lib/web/jquery/jquery-ui.js
+++ b/lib/web/jquery/jquery-ui.js
@@ -2,6 +2,10 @@
 * http://jqueryui.com
 * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
 * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
+define([
+	"jquery",
+	"jquery/jquery.cookie"
+], function(jQuery){
 (function( $, undefined ) {
 
 var uuid = 0,
@@ -15038,3 +15042,5 @@ $.widget( "ui.tooltip", {
 });
 
 }( jQuery ) );
+
+});
\ No newline at end of file
diff --git a/lib/web/jquery/jquery.cookie.js b/lib/web/jquery/jquery.cookie.js
index 4958dd25dcea70d517e109a082f3dfd811e29105..b0675946910ab05b1449dc8c1846b04752ae4955 100644
--- a/lib/web/jquery/jquery.cookie.js
+++ b/lib/web/jquery/jquery.cookie.js
@@ -8,7 +8,13 @@
  * http://www.opensource.org/licenses/mit-license.php
  * http://www.opensource.org/licenses/GPL-2.0
  */
-(function($, document) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define(["jquery"], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
 
     var pluses = /\+/g;
     function raw(s) {
@@ -58,4 +64,4 @@
 
     $.cookie.defaults = {};
 
-})(jQuery, document);
+}));
diff --git a/lib/web/jquery/jquery.details.js b/lib/web/jquery/jquery.details.js
index 30ce703386614f6d1494317cf0a5b5a1bf283fcc..1d0b396ea6768b29dfae897661e6cea689611c14 100644
--- a/lib/web/jquery/jquery.details.js
+++ b/lib/web/jquery/jquery.details.js
@@ -1,5 +1,9 @@
 /*! http://mths.be/details v0.0.6 by @mathias | includes http://mths.be/noselect v1.0.3 */
-;(function(document, $) {
+define([
+    "jquery",
+    "modernizr/modernizr.details"
+], function($){
+
     var proto = $.fn,
         details,
         // :'(
@@ -120,4 +124,4 @@
 
     }
 
-}(document, jQuery));
+});
diff --git a/lib/web/jquery/jquery.metadata.js b/lib/web/jquery/jquery.metadata.js
index 5710f7487d015be3a9e5d06defb430ed77de2704..07c2b5c3e7ed03d76527fd9d54d26d17fb84dd60 100644
--- a/lib/web/jquery/jquery.metadata.js
+++ b/lib/web/jquery/jquery.metadata.js
@@ -59,8 +59,14 @@
  * @type undefined
  * @see metadata()
  */
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define(["jquery"], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
 
-(function($) {
 
     $.extend({
         metadata : {
@@ -155,4 +161,4 @@
         return $.metadata.get( this[0], opts );
     };
 
-})(jQuery);
\ No newline at end of file
+}));
\ No newline at end of file
diff --git a/lib/web/jquery/jquery.parsequery.js b/lib/web/jquery/jquery.parsequery.js
index 87bae389eecffaddbea8333842d2a810e5281b04..15e160a45ca39cb0f0c0f9a38500e5524b34222a 100644
--- a/lib/web/jquery/jquery.parsequery.js
+++ b/lib/web/jquery/jquery.parsequery.js
@@ -8,7 +8,10 @@
  **/
 /*jshint jquery:true */
 /*global window:true */
-(function ($) {
+define([
+    "jquery"
+], function($){
+
     $.parseQuery = function(options) {
         var config = {query: window.location.search || ""},
             params = {};
@@ -44,4 +47,5 @@
     };
 
     $.parseQuery.separator = "&";
-}(jQuery));
+
+});
diff --git a/lib/web/jquery/jquery.tabs.js b/lib/web/jquery/jquery.tabs.js
index e02dbd1a1746922bbaf67c99a53afde77ea8ccbd..d6cf21d6d5dd8c7e9b82143d46d831c6f514af21 100644
--- a/lib/web/jquery/jquery.tabs.js
+++ b/lib/web/jquery/jquery.tabs.js
@@ -17,6 +17,10 @@
  * limitations under the License.
  * ======================================================== */
 
+define([
+  "jquery"
+], function(jQuery){
+
 
 !function ($) {
 
@@ -132,7 +136,7 @@
     })
   })
 
-}(window.jQuery);
+}(jQuery);
 
 /* =============================================================
  * bootstrap-collapse.js v2.0.4
@@ -291,4 +295,6 @@
     })
   })
 
-}(window.jQuery);
+}(jQuery);
+
+});
\ No newline at end of file
diff --git a/lib/web/jquery/jquery.tipsy.js b/lib/web/jquery/jquery.tipsy.js
deleted file mode 100644
index 1ade2be8a99f3753ab326408021d211a6269b882..0000000000000000000000000000000000000000
--- a/lib/web/jquery/jquery.tipsy.js
+++ /dev/null
@@ -1,246 +0,0 @@
-// tipsy, facebook style tooltips for jquery
-// http://onehackoranother.com/projects/jquery/tipsy/
-// version 1.0.0a
-// (c) 2008-2010 jason frame [jason@onehackoranother.com]
-// releated under the MIT license
-
-;(function($) {
-    'use strict';
-
-    function fixTitle($ele) {
-        if ($ele.attr('title') || typeof($ele.attr('original-title')) != 'string') {
-            $ele.attr('original-title', $ele.attr('title') || '').removeAttr('title');
-        }
-    }
-    
-    function Tipsy(element, options) {
-        this.$element = $(element);
-        this.options = options;
-        this.enabled = true;
-        fixTitle(this.$element);
-
-        if ($(element).attr('tooltip-target') && $(element).attr('tooltip-target').length) {
-            this.$element = $($(element).attr('tooltip-target'));
-        }
-    }
-    
-    Tipsy.prototype = {
-        show: function(params) {
-            var title = this.getTitle();
-            if (title && this.enabled) {
-                var $tip = this.tip();
-                
-                $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
-                $tip[0].className = 'tipsy'; // reset classname in case of dynamic tooltipPos
-                $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
-                
-                var pos = $.extend({}, this.$element.offset(), {
-                    width: this.$element[0].offsetWidth,
-                    height: this.$element[0].offsetHeight
-                });
-                
-                var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
-                var tooltipPosition = (typeof this.options.tooltipPos == 'function')
-                                ? this.options.tooltipPos.call(this.$element[0])
-                                : this.options.tooltipPos;
-
-                var tp;
-                switch (tooltipPosition.charAt(0)) {
-                    case 's':
-                        tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
-                        break;
-                    case 'n':
-                        tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
-                        break;
-                    case 'w':
-                        tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
-                        break;
-                    case 'e':
-                        tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
-                        break;
-                }
-                
-                if (tooltipPosition.length == 2) {
-                    if (tooltipPosition.charAt(1) == 'e') {
-                        tp.left = pos.left + pos.width / 2 - 15;
-                    } else {
-                        tp.left = pos.left + pos.width / 2 - actualWidth + 15;
-                    }
-                }
-
-                $tip.css(tp).addClass('tipsy-' + tooltipPosition);
-                
-                if (this.options.fade) {
-                    $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
-                } else {
-                    $tip.css({visibility: 'visible', opacity: this.options.opacity});
-                }
-            }
-        },
-        
-        hide: function() {
-            if (this.options.fade) {
-                this.tip().stop().fadeOut(function() { $(this).remove(); });
-            } else {
-                this.tip().remove();
-            }
-        },
-        
-        getTitle: function() {
-            var title, $e = this.$element, o = this.options;
-            fixTitle($e);
-            var title, o = this.options;
-            if (typeof o.title == 'string') {
-                title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
-            } else if (typeof o.title == 'function') {
-                title = o.title.call($e[0]);
-            }
-            title = ('' + title).replace(/(^\s*|\s*$)/, "");
-            return title || o.fallback;
-        },
-        
-        tip: function() {
-            if (!this.$tip) {
-                this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>');
-            }
-            return this.$tip;
-        },
-        
-        validate: function() {
-            if (!this.$element[0].parentNode) {
-                this.hide();
-                this.$element = null;
-                this.options = null;
-            }
-        },
-        
-        enable: function() { this.enabled = true; },
-        disable: function() { this.enabled = false; },
-        toggleEnabled: function() { this.enabled = !this.enabled; }
-    };
-    
-    $.fn.tipsy = function(options) {
-        if (options === true) {
-            return this.data('tipsy');
-        } else if (typeof options == 'string') {
-            return this.data('tipsy')[options]();
-        }
-        
-        options = $.extend({}, $.fn.tipsy.defaults, options);
-        
-        function get(ele) {
-            var tipsy = $.data(ele, 'tipsy');
-            if (!tipsy) {
-                tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
-                $.data(ele, 'tipsy', tipsy);
-            }
-            return tipsy;
-        }
-        
-        function enter() {
-            var tipsy = get(this);
-            tipsy.hoverState = 'in';
-            if (options.delayIn == 0) {
-                tipsy.show();
-            } else {
-                setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
-            }
-        }
-        
-        function leave() {
-            var tipsy = get(this);
-            tipsy.hoverState = 'out';
-            if (options.delayOut == 0) {
-                tipsy.hide();
-            } else {
-                setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
-            }
-        }
-        
-        if (!options.live) this.each(function() { get(this); });
-        
-        if (options.trigger != 'manual') {
-            var binder   = options.live ? 'live' : 'bind',
-                eventIn  = options.trigger == 'hover' ? 'mouseenter' : 'focus',
-                eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
-            this[binder](eventIn, enter)[binder](eventOut, leave);
-        }
-        
-        return this;
-        
-    };
-    
-    // Overwrite this method to provide options on a per-element basis.
-    // For example, you could store the tooltipPos in a 'tipsy-tooltipPos' attribute:
-    // return $.extend({}, options, {tooltipPos: $(ele).attr('tipsy-tooltipPos') || 'n' });
-    // (remember - do not modify 'options' in place!)
-    $.fn.tipsy.elementOptions = function(ele, options) {
-        return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
-    };
-    
-    $.fn.tipsy.autoNS = function() {
-        return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
-    };
-    
-    $.fn.tipsy.autoWE = function() {
-        return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'w' : 'e';
-    };
-
-    $.fn.tipsy.auto = function(element) {
-        var elem = element,
-            offset = elem.offset(),
-            fLeft, fRight, fTop, fBottom;
-
-        fLeft = offset.left - $(document).scrollLeft();
-        fRight = $(window).width() - (offset.left - $(document).scrollLeft() + elem.outerWidth(true));
-        fTop = offset.top - $(document).scrollTop();
-        fBottom = $(window).height() - (offset.top - $(document).scrollTop() + elem.outerHeight(true));
-
-        var freeSpaces = [
-            {
-                name:'n',
-                value:fTop
-            },
-            {
-                name:'w',
-                value:fLeft
-            },
-            {
-                name:'s',
-                value:fBottom
-            },
-            {
-                name:'e',
-                value:fRight
-            },
-        ].sort(function (a,b) {return a.value - b.value;});
-
-        var majority = {
-            'n': 2,
-            'w': 1,
-            's': 2,
-            'e': 4
-        };
-
-        for (var i=0, len=freeSpaces.length; i<len; i++) {
-            var item = freeSpaces[i];
-
-            item.coof = (i + 1) * majority[item.name];
-        }
-        return freeSpaces.sort(function(a,b) {return a.coof - b.coof;})[freeSpaces.length - 1].name;
-    };
-
-    $.fn.tipsy.defaults = {
-        delayIn: 0,
-        delayOut: 0,
-        fade: false,
-        fallback: '',
-        tooltipPos: 's',
-        html: true,
-        live: false,
-        offset: 0,
-        opacity: 1,
-        title: 'title',
-        trigger: 'hover'
-    };
-})(jQuery);
\ No newline at end of file
diff --git a/lib/web/jquery/jquery.tmpl.min.js b/lib/web/jquery/jquery.tmpl.min.js
index a615f5b21677b16948259ef15147d71d66e4b634..8b4503bedea1202743e2687ef217fdfef543c619 100644
--- a/lib/web/jquery/jquery.tmpl.min.js
+++ b/lib/web/jquery/jquery.tmpl.min.js
@@ -7,4 +7,10 @@
  * Dual licensed under the MIT or GPL Version 2 licenses.
  * http://jquery.org/license
  */
-(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);
\ No newline at end of file
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define(["jquery"], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}}));
\ No newline at end of file
diff --git a/lib/web/jquery/jquery.validate.js b/lib/web/jquery/jquery.validate.js
index 81e02d6dba9bed2f896d3c736b802ec8ec21640e..58fdf10e665f2de752181fcfc09e1cfc5ecad2c2 100644
--- a/lib/web/jquery/jquery.validate.js
+++ b/lib/web/jquery/jquery.validate.js
@@ -10,6 +10,16 @@
  *   http://www.opensource.org/licenses/mit-license.php
  *   http://www.gnu.org/licenses/gpl.html
  */
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/jquery.metadata"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function (jQuery) {
 
 (function ($) {
 
@@ -1262,3 +1272,5 @@
         }
     });
 }(jQuery));
+
+}));
\ No newline at end of file
diff --git a/lib/web/jquery/jqzoom/BSD-LICENSE.txt b/lib/web/jquery/jqzoom/BSD-LICENSE.txt
deleted file mode 100644
index acd2e7c48a11518e2dc2e21eae3063590db8d17d..0000000000000000000000000000000000000000
--- a/lib/web/jquery/jqzoom/BSD-LICENSE.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-* Copyright (c) 2011 Marco Renzi, http://www.mind-projects.it
-* 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 the organization 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 Marco Renzi "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 <copyright holder> 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/lib/web/jquery/jqzoom/css/jquery.jqzoom.css b/lib/web/jquery/jqzoom/css/jquery.jqzoom.css
deleted file mode 100644
index 1a06853f9274ee23d2b1dc334a26899e53ab913f..0000000000000000000000000000000000000000
--- a/lib/web/jquery/jqzoom/css/jquery.jqzoom.css
+++ /dev/null
@@ -1,120 +0,0 @@
-.zoomPad{
-	position:relative;
-	float:left;
-	z-index:99;
-	cursor:crosshair;
-}
-
-
-.zoomPreload{
-   -moz-opacity:0.8;
-   opacity: 0.8;
-   filter: alpha(opacity = 80);
-   color: #333;
-   font-size: 12px;
-   font-family: Tahoma;
-   text-decoration: none;
-   border: 1px solid #CCC;
-   background-color: white;
-   padding: 8px;
-   text-align:center;
-   background-image: url(../images/zoomloader.gif);
-   background-repeat: no-repeat;
-   background-position: 43px 30px;
-   z-index:110;
-   width:90px;
-   height:43px;
-   position:absolute;
-   top:0px;
-   left:0px;
-    * width:100px;
-    * height:49px;
-}
-
-
-.zoomPup{
-	overflow:hidden;
-	background-color: #FFF;
-	-moz-opacity:0.6;
-	opacity: 0.6;
-	filter: alpha(opacity = 60);
-	z-index:120;
-	position:absolute;
-	border:1px solid #CCC;
-  z-index:101;
-  cursor:crosshair;
-}
-
-.zoomOverlay{
-	position:absolute;
-	left:0px;
-	top:0px;
-	background:#FFF;
-	/*opacity:0.5;*/
-	z-index:5000;
-	width:100%;
-	height:100%;
-	display:none;
-  z-index:101;
-}
-
-.zoomWindow{
-	position:absolute;
-	left:110%;
-	top:40px;
-	background:#FFF;
-	z-index:6000;
-	height:auto;
-  z-index:10000;
-  z-index:110;
-}
-.zoomWrapper{
-	position:relative;
-	border:1px solid #999;
-  z-index:110;
-}
-.zoomWrapperTitle{
-	display:block;
-	background:#999;
-	color:#FFF;
-	height:18px;
-	line-height:18px;
-	width:100%;
-  overflow:hidden;
-	text-align:center;
-	font-size:10px;
-  position:absolute;
-  top:0px;
-  left:0px;
-  z-index:120;
-  -moz-opacity:0.6;
-  opacity: 0.6;
-  filter: alpha(opacity = 60);
-}
-.zoomWrapperImage{
-	display:block;
-  position:relative;
-  overflow:hidden;
-  z-index:110;
-
-}
-.zoomWrapperImage img{
-  border:0px;
-  display:block;
-  position:absolute;
-  z-index:101;
-}
-
-.zoomIframe{
-  z-index: -1;
-  filter:alpha(opacity=0);
-  -moz-opacity: 0.80;
-  opacity: 0.80;
-  position:absolute;
-  display:block;
-}
-
-/*********************************************************
-/ When clicking on thumbs jqzoom will add the class
-/ "zoomThumbActive" on the anchor selected
-/*********************************************************/
\ No newline at end of file
diff --git a/lib/web/jquery/jqzoom/images/zoomloader.gif b/lib/web/jquery/jqzoom/images/zoomloader.gif
deleted file mode 100644
index 5b33f7e54f4e55b6b8774d86d96895db9af044b4..0000000000000000000000000000000000000000
Binary files a/lib/web/jquery/jqzoom/images/zoomloader.gif and /dev/null differ
diff --git a/lib/web/jquery/jqzoom/js/jquery.jqzoom-core-pack.js b/lib/web/jquery/jqzoom/js/jquery.jqzoom-core-pack.js
deleted file mode 100644
index 828f44df0ad6c3035348a291b20fcdece2300ccf..0000000000000000000000000000000000000000
--- a/lib/web/jquery/jqzoom/js/jquery.jqzoom-core-pack.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*!
- * jQzoom Evolution Library v2.3  - Javascript Image magnifier
- * http://www.mind-projects.it
- *
- * Copyright 2011, Engineer Marco Renzi
- * Licensed under the BSD license.
- *
- * 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 the organization nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * Date: 03 May 2011 22:16:00
- */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(8($){9 v=($.1A.2j&&$.1A.2k<7);9 w=$(1B.1C);9 y=$(y);9 z=F;$.3d.13=8(b){G 5.1Y(8(){9 a=5.3e.3f();A(a==\'a\'){Q 13(5,b)}})};13=8(g,h){9 j=2l;j=$(g).1D("13");A(j)G j;9 k=5;9 l=$.1E({},$.13.2m,h||{});k.3g=g;g.1p=$(g).R(\'1p\');g.1F=F;g.3h=F;g.1u=F;g.1h=F;g.1b={};g.2n=2l;g.14={};g.1G=F;$(g).D({\'3i-1i\':\'1v\',\'3j-3k\':\'1v\'});9 m=$("3l:3m(0)",g);g.V=$(g).R(\'V\');g.1Z=m.R(\'V\');9 n=($.1w(g.V).Y>0)?g.V:g.1Z;9 p=Q 2o(m);9 q=Q 2p();9 r=Q 2q();9 s=Q 2r();9 t=Q 2s();$(g).1H(\'2t\',8(e){e.2u();G F});9 u=[\'20\',\'1c\',\'1j\',\'1q\'];A($.3n($.1w(l.H),u)<0){l.H=\'20\'}$.1E(k,{21:8(){A($(".L",g).Y==0){g.L=$(\'<Z/>\').1I(\'L\');m.3o(g.L)}A(l.H==\'1j\'){l.15=p.w;l.16=p.h}A($(".22",g).Y==0){q.S()}A($(".23",g).Y==0){r.S()}A($(".2v",g).Y==0){t.S()}A(l.24||l.H==\'1c\'||l.1J){k.1K()}k.2w()},2w:8(){A(l.H==\'1c\'){$(".L",g).3p(8(){g.1G=17});$(".L",g).3q(8(){g.1G=F});1B.1C.3r=8(){G F};$(".L",g).D({1L:\'1r\'});$(".22",g).D({1L:\'3s\'})}A(l.H==\'1j\'){$(".1M",g).D({1L:\'3t\'})}$(".L",g).1H(\'3u 3v\',8(a){m.R(\'V\',\'\');$(g).R(\'V\',\'\');g.1F=17;p.1s();A(g.1h){k.25(a)}1k{k.1K()}});$(".L",g).1H(\'3w\',8(a){k.2x()});$(".L",g).1H(\'3x\',8(e){A(e.26>p.E.r||e.26<p.E.l||e.27<p.E.t||e.27>p.E.b){q.1N();G F}g.1F=17;A(g.1h&&!$(\'.23\',g).3y(\':2y\')){k.25(e)}A(g.1h&&(l.H!=\'1c\'||(l.H==\'1c\'&&g.1G))){q.1l(e)}});9 c=Q 2z();9 i=0;9 d=Q 2z();d=$(\'a\').3z(8(){9 a=Q 3A("3B[\\\\s]*:[\\\\s]*\'"+$.1w(g.1p)+"\'","i");9 b=$(5).R(\'1p\');A(a.3C(b)){G 5}});A(d.Y>0){9 f=d.3D(0,1);d.3E(f)}d.1Y(8(){A(l.24){9 a=$.1E({},1O("("+$.1w($(5).R(\'1p\'))+")"));c[i]=Q 28();c[i].1d=a.1x;i++}$(5).2t(8(e){A($(5).3F(\'29\')){G F}d.1Y(8(){$(5).3G(\'29\')});e.2u();k.2A(5);G F})})},1K:8(){A(g.1h==F&&g.1u==F){9 a=$(g).R(\'2B\');g.1u=17;s.2C(a)}},25:8(e){3H(g.2n);q.T();r.T()},2x:8(e){1P(l.H){1t\'1c\':W;1r:m.R(\'V\',g.1Z);$(g).R(\'V\',g.V);A(l.1J){q.1N()}1k{r.O();q.O()}W}g.1F=F},2A:8(a){g.1u=F;g.1h=F;9 b=Q 3I();b=$.1E({},1O("("+$.1w($(a).R(\'1p\'))+")"));A(b.1Q&&b.1x){9 c=b.1Q;9 d=b.1x;$(a).1I(\'29\');$(g).R(\'2B\',d);m.R(\'1d\',c);q.O();r.O();k.1K()}1k{2a(\'2D :: 2E 2F 1R 1x 2G 1Q.\');2b\'2D :: 2E 2F 1R 1x 2G 1Q.\';}G F}});A(m[0].3J){p.1s();A($(".L",g).Y==0)k.21()}8 2o(c){9 d=5;5.6=c[0];5.2H=8(){9 a=0;a=c.D(\'2c-B-P\');M=\'\';9 b=0;b=c.D(\'2c-C-P\');K=\'\';A(a){1R(i=0;i<3;i++){9 x=[];x=a.1S(i,1);A(2I(x)==F){M=M+\'\'+a.1S(i,1)}1k{W}}}A(b){1R(i=0;i<3;i++){A(!2I(b.1S(i,1))){K=K+b.1S(i,1)}1k{W}}}d.M=(M.Y>0)?1O(M):0;d.K=(K.Y>0)?1O(K):0};5.1s=8(){d.2H();d.w=c.P();d.h=c.12();d.1m=c.3K();d.1e=c.3L();d.E=c.1f();d.E.l=c.1f().C+d.K;d.E.t=c.1f().B+d.M;d.E.r=d.w+d.E.l;d.E.b=d.h+d.E.t;d.2J=c.1f().C+d.1m;d.3M=c.1f().B+d.1e};5.6.2K=8(){2a(\'1T 1U 1V X.\');2b\'1T 1U 1V X.\';};5.6.2L=8(){d.1s();A($(".L",g).Y==0)k.21()};G d};8 2s(){9 a=5;5.S=8(){5.6=$(\'<Z/>\').1I(\'2v\').D(\'2d\',\'2M\').2N(l.2O);$(\'.L\',g).S(5.6)};5.T=8(){5.6.B=(p.1e-5.6.12())/2;5.6.C=(p.1m-5.6.P())/2;5.6.D({B:5.6.B,C:5.6.C,11:\'18\',2d:\'2y\'})};5.O=8(){5.6.D(\'2d\',\'2M\')};G 5}8 2p(){9 d=5;5.6=$(\'<Z/>\').1I(\'22\');5.S=8(){$(\'.L\',g).S($(5.6).O());A(l.H==\'1q\'){5.X=Q 28();5.X.1d=p.6.1d;$(5.6).2e().S(5.X)}};5.2P=8(){5.6.w=(1W((l.15)/g.1b.x)>p.w)?p.w:(1W(l.15/g.1b.x));5.6.h=(1W((l.16)/g.1b.y)>p.h)?p.h:(1W(l.16/g.1b.y));5.6.B=(p.1e-5.6.h-2)/2;5.6.C=(p.1m-5.6.w-2)/2;5.6.D({B:0,C:0,P:5.6.w+\'I\',12:5.6.h+\'I\',11:\'18\',1g:\'1v\',2f:1+\'I\'});A(l.H==\'1q\'){5.X.1d=p.6.1d;$(5.6).D({\'2g\':1});$(5.X).D({11:\'18\',1g:\'1y\',C:-(5.6.C+1-p.K)+\'I\',B:-(5.6.B+1-p.M)+\'I\'})}};5.1N=8(){5.6.B=(p.1e-5.6.h-2)/2;5.6.C=(p.1m-5.6.w-2)/2;5.6.D({B:5.6.B,C:5.6.C});A(l.H==\'1q\'){$(5.X).D({11:\'18\',1g:\'1y\',C:-(5.6.C+1-p.K)+\'I\',B:-(5.6.B+1-p.M)+\'I\'})}s.1l()};5.1l=8(e){g.14.x=e.26;g.14.y=e.27;9 b=0;9 c=0;8 2Q(a){G g.14.x-(a.w)/2<p.E.l}8 2R(a){G g.14.x+(a.w)/2>p.E.r}8 2S(a){G g.14.y-(a.h)/2<p.E.t}8 2T(a){G g.14.y+(a.h)/2>p.E.b}b=g.14.x+p.K-p.E.l-(5.6.w+2)/2;c=g.14.y+p.M-p.E.t-(5.6.h+2)/2;A(2Q(5.6)){b=p.K-1}1k A(2R(5.6)){b=p.w+p.K-5.6.w-1}A(2S(5.6)){c=p.M-1}1k A(2T(5.6)){c=p.h+p.M-5.6.h-1}5.6.C=b;5.6.B=c;5.6.D({\'C\':b+\'I\',\'B\':c+\'I\'});A(l.H==\'1q\'){A($.1A.2j&&$.1A.2k>7){$(5.6).2e().S(5.X)}$(5.X).D({11:\'18\',1g:\'1y\',C:-(5.6.C+1-p.K)+\'I\',B:-(5.6.B+1-p.M)+\'I\'})}s.1l()};5.O=8(){m.D({\'2g\':1});5.6.O()};5.T=8(){A(l.H!=\'1j\'&&(l.2U||l.H==\'1c\')){5.6.T()}A(l.H==\'1q\'){m.D({\'2g\':l.2V})}};5.2h=8(){9 o={};o.C=d.6.C;o.B=d.6.B;G o};G 5};8 2q(){9 b=5;5.6=$("<Z 1z=\'23\'><Z 1z=\'1M\'><Z 1z=\'1X\'></Z><Z 1z=\'2i\'></Z></Z></Z>");5.U=$(\'<2W 1z="3N" 1d="3O:\\\'\\\';" 3P="0" 3Q="0" 3R="2X" 3S="3T" 3U="0" ></2W>\');5.1l=8(){5.6.1n=0;5.6.1o=0;A(l.H!=\'1j\'){1P(l.11){1t"C":5.6.1n=(p.E.l-p.K-J.N(l.19)-l.15>0)?(0-l.15-J.N(l.19)):(p.1m+J.N(l.19));5.6.1o=J.N(l.1a);W;1t"B":5.6.1n=J.N(l.19);5.6.1o=(p.E.t-p.M-J.N(l.1a)-l.16>0)?(0-l.16-J.N(l.1a)):(p.1e+J.N(l.1a));W;1t"2X":5.6.1n=J.N(l.19);5.6.1o=(p.E.t-p.M+p.1e+J.N(l.1a)+l.16<2Y.12)?(p.1e+J.N(l.1a)):(0-l.16-J.N(l.1a));W;1r:5.6.1n=(p.2J+J.N(l.19)+l.15<2Y.P)?(p.1m+J.N(l.19)):(0-l.15-J.N(l.19));5.6.1o=J.N(l.1a);W}}5.6.D({\'C\':5.6.1n+\'I\',\'B\':5.6.1o+\'I\'});G 5};5.S=8(){$(\'.L\',g).S(5.6);5.6.D({11:\'18\',1g:\'1v\',2Z:3V});A(l.H==\'1j\'){5.6.D({1L:\'1r\'});9 a=(p.K==0)?1:p.K;$(\'.1M\',5.6).D({2f:a+\'I\'})}$(\'.1M\',5.6).D({P:J.30(l.15)+\'I\',2f:a+\'I\'});$(\'.2i\',5.6).D({P:\'31%\',12:J.30(l.16)+\'I\'});$(\'.1X\',5.6).D({P:\'31%\',11:\'18\'});$(\'.1X\',5.6).O();A(l.V&&n.Y>0){$(\'.1X\',5.6).2N(n).T()}b.1l()};5.O=8(){1P(l.32){1t\'3W\':5.6.3X(l.33,8(){});W;1r:5.6.O();W}5.U.O()};5.T=8(){1P(l.34){1t\'3Y\':5.6.35();5.6.35(l.36,8(){});W;1r:5.6.T();W}A(v&&l.H!=\'1j\'){5.U.P=5.6.P();5.U.12=5.6.12();5.U.C=5.6.1n;5.U.B=5.6.1o;5.U.D({1g:\'1y\',11:"18",C:5.U.C,B:5.U.B,2Z:3Z,P:5.U.P+\'I\',12:5.U.12+\'I\'});$(\'.L\',g).S(5.U);5.U.T()}}};8 2r(){9 c=5;5.6=Q 28();5.2C=8(a){t.T();5.40=a;5.6.1i.11=\'18\';5.6.1i.2c=\'37\';5.6.1i.1g=\'1v\';5.6.1i.C=\'-41\';5.6.1i.B=\'37\';1B.1C.42(5.6);5.6.1d=a};5.1s=8(){9 a=$(5.6);9 b={};5.6.1i.1g=\'1y\';c.w=a.P();c.h=a.12();c.E=a.1f();c.E.l=a.1f().C;c.E.t=a.1f().B;c.E.r=c.w+c.E.l;c.E.b=c.h+c.E.t;b.x=(c.w/p.w);b.y=(c.h/p.h);g.1b=b;1B.1C.43(5.6);$(\'.2i\',g).2e().S(5.6);q.2P()};5.6.2K=8(){2a(\'1T 1U 1V 38 39 X.\');2b\'1T 1U 1V 38 39 X.\';};5.6.2L=8(){c.1s();t.O();g.1u=F;g.1h=17;A(l.H==\'1c\'||l.1J){q.T();r.T();q.1N()}};5.1l=8(){9 a=-g.1b.x*(q.2h().C-p.K+1);9 b=-g.1b.y*(q.2h().B-p.M+1);$(5.6).D({\'C\':a+\'I\',\'B\':b+\'I\'})};G 5};$(g).1D("13",k)};$.13={2m:{H:\'20\',15:3a,16:3a,19:10,1a:0,11:"44",24:17,2O:\'45 46\',V:17,2U:17,2V:0.4,1J:F,34:\'T\',32:\'O\',36:\'47\',33:\'48\'},3b:8(a){9 b=$(a).1D(\'13\');b.3b();G F},3c:8(a){9 b=$(a).1D(\'13\');b.3c();G F},49:8(a){z=17},4a:8(a){z=F}}})(4b);',62,260,'|||||this|node||function|var|||||||||||||||||||||||||||if|top|left|css|pos|false|return|zoomType|px|Math|bleft|zoomPad|btop|abs|hide|width|new|attr|append|show|ieframe|title|break|image|length|div||position|height|jqzoom|mousepos|zoomWidth|zoomHeight|true|absolute|xOffset|yOffset|scale|drag|src|oh|offset|display|largeimageloaded|style|innerzoom|else|setposition|ow|leftpos|toppos|rel|reverse|default|fetchdata|case|largeimageloading|none|trim|largeimage|block|class|browser|document|body|data|extend|zoom_active|mouseDown|bind|addClass|alwaysOn|load|cursor|zoomWrapper|setcenter|eval|switch|smallimage|for|substr|Problems|while|loading|parseInt|zoomWrapperTitle|each|imagetitle|standard|create|zoomPup|zoomWindow|preloadImages|activate|pageX|pageY|Image|zoomThumbActive|alert|throw|border|visibility|empty|borderWidth|opacity|getoffset|zoomWrapperImage|msie|version|null|defaults|timer|Smallimage|Lens|Stage|Largeimage|Loader|click|preventDefault|zoomPreload|init|deactivate|visible|Array|swapimage|href|loadimage|ERROR|Missing|parameter|or|findborder|isNaN|rightlimit|onerror|onload|hidden|html|preloadText|setdimensions|overleft|overright|overtop|overbottom|lens|imageOpacity|iframe|bottom|screen|zIndex|round|100|hideEffect|fadeoutSpeed|showEffect|fadeIn|fadeinSpeed|0px|the|big|300|disable|enable|fn|nodeName|toLowerCase|el|zoom_disabled|outline|text|decoration|img|eq|inArray|wrap|mousedown|mouseup|ondragstart|move|crosshair|mouseenter|mouseover|mouseleave|mousemove|is|filter|RegExp|gallery|test|splice|push|hasClass|removeClass|clearTimeout|Object|complete|outerWidth|outerHeight|bottomlimit|zoomIframe|javascript|marginwidth|marginheight|align|scrolling|no|frameborder|5001|fadeout|fadeOut|fadein|99|url|5000px|appendChild|removeChild|right|Loading|zoom|slow|2000|disableAll|enableAll|jQuery'.split('|'),0,{}))
\ No newline at end of file
diff --git a/lib/web/jquery/jstree/jquery.hotkeys.js b/lib/web/jquery/jstree/jquery.hotkeys.js
index fbd71c71ec7ceed73a06f0e9447e46bc48b4e5e4..583ac24d59ab7bbecaafdfc1ff9c11687dac74dc 100644
--- a/lib/web/jquery/jstree/jquery.hotkeys.js
+++ b/lib/web/jquery/jstree/jquery.hotkeys.js
@@ -9,9 +9,14 @@
  * Original idea by:
  * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
 */
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define(["jquery"], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function (jQuery) {
 
-(function(jQuery){
-	
 	jQuery.hotkeys = {
 		version: "0.8",
 
@@ -96,4 +101,4 @@
 		jQuery.event.special[ this ] = { add: keyHandler };
 	});
 
-})( jQuery );
\ No newline at end of file
+}));
\ No newline at end of file
diff --git a/lib/web/jquery/jstree/jquery.jstree.js b/lib/web/jquery/jstree/jquery.jstree.js
index ec22f36e5a5af0357351f5eba48d5e6f28fc36f0..e527ab303f32239285db09b0b4746145fd1af188 100644
--- a/lib/web/jquery/jstree/jquery.jstree.js
+++ b/lib/web/jquery/jstree/jquery.jstree.js
@@ -14,7 +14,17 @@
 
 /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
 /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
-
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/jquery.cookie",
+            "jquery/jstree/jquery.hotkeys"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
 "use strict";
 
 // top wrapper to prevent multiple inclusion (is this OK?)
@@ -4820,3 +4830,4 @@
 
 })();
 
+}));
\ No newline at end of file
diff --git a/lib/web/jquery/slimScroll/slimScroll.min.js b/lib/web/jquery/slimScroll/slimScroll.min.js
deleted file mode 100644
index 4a928fb8a7635971038ea434814580de7e136f2c..0000000000000000000000000000000000000000
--- a/lib/web/jquery/slimScroll/slimScroll.min.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- *
- * Version: 0.5.0
- * 
- */
-(function(d){jQuery.fn.extend({slimScroll:function(o){var a=ops=d.extend({wheelStep:20,width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,railVisible:!1,railColor:"#333",railOpacity:"0.2",railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,scroll:0},o);this.each(function(){function h(a,d,e){var f=a;d&&(f=parseInt(c.css("top"))+a*B/100*c.outerHeight(),d=b.outerHeight()-c.outerHeight(),
-f=Math.min(Math.max(f,0),d),c.css({top:f+"px"}));k=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());f=k*(b[0].scrollHeight-b.outerHeight());e&&(f=a,a=f/b[0].scrollHeight*b.outerHeight(),c.css({top:a+"px"}));b.scrollTop(f);p();i()}function w(){q=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),o);c.css({height:q+"px"})}function p(){w();clearTimeout(x);l=C&&k==~~k;q>=b.outerHeight()?l=!0:(c.stop(!0,!0).fadeIn("fast"),y&&g.stop(!0,!0).fadeIn("fast"))}function i(){m||(x=setTimeout(function(){!r&&
-!s&&(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var t,r,s,x,q,k,o=30,l=!1,B=parseInt(a.wheelStep),j=a.width,z=a.height,e=a.size,D=a.color,E=a.position,A=a.distance,u=a.start,F=a.opacity,m=a.alwaysVisible,y=a.railVisible,G=a.railColor,H=a.railOpacity,C=a.allowPageScroll,n=a.scroll,b=d(this);if(b.parent().hasClass("slimScrollDiv"))n&&(c=b.parent().find(".slimScrollBar"),g=b.parent().find(".slimScrollRail"),h(b.scrollTop()+parseInt(n),!1,!0));else{n=d("<div></div>").addClass(a.wrapperClass).css({position:"relative",
-overflow:"hidden",width:j,height:z});b.css({overflow:"hidden",width:j,height:z});var g=d("<div></div>").addClass(a.railClass).css({width:e,height:"100%",position:"absolute",top:0,display:m&&y?"block":"none","border-radius":e,background:G,opacity:H,zIndex:90}),c=d("<div></div>").addClass(a.barClass).css({background:D,width:e,position:"absolute",top:0,opacity:F,display:m?"block":"none","border-radius":e,BorderRadius:e,MozBorderRadius:e,WebkitBorderRadius:e,zIndex:99}),j="right"==E?{right:A}:{left:A};
-g.css(j);c.css(j);b.wrap(n);b.parent().append(c);b.parent().append(g);c.draggable({axis:"y",containment:"parent",start:function(){s=!0},stop:function(){s=!1;i()},drag:function(){h(0,d(this).position().top,!1)}});g.hover(function(){p()},function(){i()});c.hover(function(){r=!0},function(){r=!1});b.hover(function(){t=!0;p();i()},function(){t=!1;i()});var v=function(a){if(t){var a=a||window.event,b=0;a.wheelDelta&&(b=-a.wheelDelta/120);a.detail&&(b=a.detail/3);h(b,!0);a.preventDefault&&!l&&a.preventDefault();
-l||(a.returnValue=!1)}};(function(){window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)})();w();"bottom"==u?(c.css({top:b.outerHeight()-c.outerHeight()}),h(0,!0)):"object"==typeof u&&(h(d(u).position().top,null,!0),m||c.hide())}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery);
\ No newline at end of file
diff --git a/lib/web/lib/FABridge.js b/lib/web/lib/FABridge.js
deleted file mode 100644
index a413632442b559c4bc1f354e263d1e1728a2177f..0000000000000000000000000000000000000000
--- a/lib/web/lib/FABridge.js
+++ /dev/null
@@ -1,613 +0,0 @@
-/*
-Copyright 2006 Adobe Systems Incorporated
-
-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.
-
-*/
-
-
-/*
- * The Bridge class, responsible for navigating AS instances
- */
-function FABridge(target,bridgeName)
-{
-    this.target = target;
-    this.remoteTypeCache = {};
-    this.remoteInstanceCache = {};
-    this.remoteFunctionCache = {};
-    this.localFunctionCache = {};
-    this.bridgeID = FABridge.nextBridgeID++;
-    this.name = bridgeName;
-    this.nextLocalFuncID = 0;
-    FABridge.instances[this.name] = this;
-    FABridge.idMap[this.bridgeID] = this;
-
-    return this;
-}
-
-// type codes for packed values
-FABridge.TYPE_ASINSTANCE =  1;
-FABridge.TYPE_ASFUNCTION =  2;
-
-FABridge.TYPE_JSFUNCTION =  3;
-FABridge.TYPE_ANONYMOUS =   4;
-
-FABridge.initCallbacks = {};
-FABridge.userTypes = {};
-
-FABridge.addToUserTypes = function()
-{
-    for (var i = 0; i < arguments.length; i++)
-    {
-        FABridge.userTypes[arguments[i]] = {
-            'typeName': arguments[i], 
-            'enriched': false
-        };
-    }
-}
-
-FABridge.argsToArray = function(args)
-{
-    var result = [];
-    for (var i = 0; i < args.length; i++)
-    {
-        result[i] = args[i];
-    }
-    return result;
-}
-
-function instanceFactory(objID)
-{
-    this.fb_instance_id = objID;
-    return this;
-}
-
-function FABridge__invokeJSFunction(args)
-{  
-    var funcID = args[0];
-    var throughArgs = args.concat();//FABridge.argsToArray(arguments);
-    throughArgs.shift();
-   
-    var bridge = FABridge.extractBridgeFromID(funcID);
-    return bridge.invokeLocalFunction(funcID, throughArgs);
-}
-
-FABridge.addInitializationCallback = function(bridgeName, callback)
-{
-    var inst = FABridge.instances[bridgeName];
-    if (inst != undefined)
-    {
-        callback.call(inst);
-        return;
-    }
-
-    var callbackList = FABridge.initCallbacks[bridgeName];
-    if(callbackList == null)
-    {
-        FABridge.initCallbacks[bridgeName] = callbackList = [];
-    }
-
-    callbackList.push(callback);
-}
-
-// updated for changes to SWFObject2
-function FABridge__bridgeInitialized(bridgeName) {
-    var objects = document.getElementsByTagName("object");
-    var ol = objects.length;
-    var activeObjects = [];
-    if (ol > 0) {
-        for (var i = 0; i < ol; i++) {
-            if (typeof objects[i].SetVariable != "undefined") {
-                activeObjects[activeObjects.length] = objects[i];
-            }
-        }
-    }
-    var embeds = document.getElementsByTagName("embed");
-    var el = embeds.length;
-    var activeEmbeds = [];
-    if (el > 0) {
-        for (var j = 0; j < el; j++) {
-            if (typeof embeds[j].SetVariable != "undefined") {
-                activeEmbeds[activeEmbeds.length] = embeds[j];
-            }
-        }
-    }
-    var aol = activeObjects.length;
-    var ael = activeEmbeds.length;
-    var searchStr = "bridgeName="+ bridgeName;
-    if ((aol == 1 && !ael) || (aol == 1 && ael == 1)) {
-        FABridge.attachBridge(activeObjects[0], bridgeName);     
-    }
-    else if (ael == 1 && !aol) {
-        FABridge.attachBridge(activeEmbeds[0], bridgeName);
-        }
-    else {
-                var flash_found = false;
-        if (aol > 1) {
-            for (var k = 0; k < aol; k++) {
-                 var params = activeObjects[k].childNodes;
-                 for (var l = 0; l < params.length; l++) {
-                    var param = params[l];
-                    if (param.nodeType == 1 && param.tagName.toLowerCase() == "param" && param["name"].toLowerCase() == "flashvars" && param["value"].indexOf(searchStr) >= 0) {
-                        FABridge.attachBridge(activeObjects[k], bridgeName);
-                            flash_found = true;
-                            break;
-                        }
-                    }
-                if (flash_found) {
-                    break;
-                }
-            }
-        }
-        if (!flash_found && ael > 1) {
-            for (var m = 0; m < ael; m++) {
-                var flashVars = activeEmbeds[m].attributes.getNamedItem("flashVars").nodeValue;
-                if (flashVars.indexOf(searchStr) >= 0) {
-                    FABridge.attachBridge(activeEmbeds[m], bridgeName);
-                    break;
-    }
-            }
-        }
-    }
-    return true;
-}
-
-// used to track multiple bridge instances, since callbacks from AS are global across the page.
-
-FABridge.nextBridgeID = 0;
-FABridge.instances = {};
-FABridge.idMap = {};
-FABridge.refCount = 0;
-
-FABridge.extractBridgeFromID = function(id)
-{
-    var bridgeID = (id >> 16);
-    return FABridge.idMap[bridgeID];
-}
-
-FABridge.attachBridge = function(instance, bridgeName)
-{
-
-    // reuse bridge if it exists
-//    var newBridgeInstance = new FABridge(instance, bridgeName);
-
-    // reuse bridge if it exists
-//    FABridge[bridgeName] = newBridgeInstance;
-
-    if (typeof FABridge[bridgeName] == 'undefined') {
-        FABridge[bridgeName] = new FABridge(instance, bridgeName);
-    }
-
-/*  FABridge[bridgeName] = function() {
-        return newBridgeInstance.root();
-    }
-*/
-    var callbacks = FABridge.initCallbacks[bridgeName];
-    if (callbacks == null)
-    {
-        return;
-    }
-    for (var i = 0; i < callbacks.length; i++)
-    {
-//        callbacks[i].call(newBridgeInstance);
-        callbacks[i].call(FABridge[bridgeName]);
-    }
-    
-    // reuse bridge if it exists
-//    delete FABridge.initCallbacks[bridgeName]
-}
-
-// some methods can't be proxied.  You can use the explicit get,set, and call methods if necessary.
-
-FABridge.blockedMethods =
-{
-    toString: true,
-    get: true,
-    set: true,
-    call: true
-};
-
-FABridge.prototype =
-{
-
-
-// bootstrapping
-
-    root: function()
-    {
-        return this.deserialize(this.target.getRoot());
-    },
-//clears all of the AS objects in the cache maps
-    releaseASObjects: function()
-    {
-        return this.target.releaseASObjects();
-    },
-//clears a specific object in AS from the type maps
-    releaseNamedASObject: function(value)
-    {
-        if(typeof(value) != "object")
-        {
-            return false;
-        }
-        else
-        {
-            var ret =  this.target.releaseNamedASObject(value.fb_instance_id);
-            return ret;
-        }
-    },
-//create a new AS Object
-    create: function(className)
-    {
-        return this.deserialize(this.target.create(className));
-    },
-
-
-    // utilities
-
-    makeID: function(token)
-    {
-        return (this.bridgeID << 16) + token;
-    },
-
-
-    // low level access to the flash object
-
-//get a named property from an AS object
-    getPropertyFromAS: function(objRef, propName)
-    {
-        if (FABridge.refCount > 0)
-        {
-            throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
-        }
-        else
-        {
-            FABridge.refCount++;
-            retVal = this.target.getPropFromAS(objRef, propName);
-            retVal = this.handleError(retVal);
-            FABridge.refCount--;
-            return retVal;
-        }
-    },
-//set a named property on an AS object
-    setPropertyInAS: function(objRef,propName, value)
-    {
-        if (FABridge.refCount > 0)
-        {
-            throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
-        }
-        else
-        {
-            FABridge.refCount++;
-            retVal = this.target.setPropInAS(objRef,propName, this.serialize(value));
-            retVal = this.handleError(retVal);
-            FABridge.refCount--;
-            return retVal;
-        }
-    },
-
-//call an AS function
-    callASFunction: function(funcID, args)
-    {
-        if (FABridge.refCount > 0)
-        {
-            throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
-        }
-        else
-        {
-            FABridge.refCount++;
-            retVal = this.target.invokeASFunction(funcID, this.serialize(args));
-            retVal = this.handleError(retVal);
-            FABridge.refCount--;
-            return retVal;
-        }
-    },
-//call a method on an AS object
-    callASMethod: function(objID, funcName, args)
-    {
-        if (FABridge.refCount > 0)
-        {
-            throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
-        }
-        else
-        {
-            FABridge.refCount++;
-            args = this.serialize(args);
-            retVal = this.target.invokeASMethod(objID, funcName, args);
-            retVal = this.handleError(retVal);
-            FABridge.refCount--;
-            return retVal;
-        }
-    },
-
-    // responders to remote calls from flash
-
-    //callback from flash that executes a local JS function
-    //used mostly when setting js functions as callbacks on events
-    invokeLocalFunction: function(funcID, args)
-    {
-        var result;
-        var func = this.localFunctionCache[funcID];
-
-        if(func != undefined)
-        {
-            result = this.serialize(func.apply(null, this.deserialize(args)));
-        }
-
-        return result;
-    },
-
-    // Object Types and Proxies
-    
-    // accepts an object reference, returns a type object matching the obj reference.
-    getTypeFromName: function(objTypeName)
-    {
-        return this.remoteTypeCache[objTypeName];
-    },
-    //create an AS proxy for the given object ID and type
-    createProxy: function(objID, typeName)
-    {
-        var objType = this.getTypeFromName(typeName);
-            instanceFactory.prototype = objType;
-            var instance = new instanceFactory(objID);
-        this.remoteInstanceCache[objID] = instance;
-        return instance;
-    },
-    //return the proxy associated with the given object ID
-    getProxy: function(objID)
-    {
-        return this.remoteInstanceCache[objID];
-    },
-
-    // accepts a type structure, returns a constructed type
-    addTypeDataToCache: function(typeData)
-    {
-        newType = new ASProxy(this, typeData.name);
-        var accessors = typeData.accessors;
-        for (var i = 0; i < accessors.length; i++)
-        {
-            this.addPropertyToType(newType, accessors[i]);
-        }
-
-        var methods = typeData.methods;
-        for (var i = 0; i < methods.length; i++)
-        {
-            if (FABridge.blockedMethods[methods[i]] == undefined)
-            {
-                this.addMethodToType(newType, methods[i]);
-            }
-        }
-
-
-        this.remoteTypeCache[newType.typeName] = newType;
-        return newType;
-    },
-
-    //add a property to a typename; used to define the properties that can be called on an AS proxied object
-    addPropertyToType: function(ty, propName)
-    {
-        var c = propName.charAt(0);
-        var setterName;
-        var getterName;
-        if(c >= "a" && c <= "z")
-        {
-            getterName = "get" + c.toUpperCase() + propName.substr(1);
-            setterName = "set" + c.toUpperCase() + propName.substr(1);
-        }
-        else
-        {
-            getterName = "get" + propName;
-            setterName = "set" + propName;
-        }
-        ty[setterName] = function(val)
-        {
-            this.bridge.setPropertyInAS(this.fb_instance_id, propName, val);
-        }
-        ty[getterName] = function()
-        {
-            return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));
-        }
-    },
-
-    //add a method to a typename; used to define the methods that can be callefd on an AS proxied object
-    addMethodToType: function(ty, methodName)
-    {
-        ty[methodName] = function()
-        {
-            return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id, methodName, FABridge.argsToArray(arguments)));
-        }
-    },
-
-    // Function Proxies
-
-    //returns the AS proxy for the specified function ID
-    getFunctionProxy: function(funcID)
-    {
-        var bridge = this;
-        if (this.remoteFunctionCache[funcID] == null)
-        {
-            this.remoteFunctionCache[funcID] = function()
-            {
-                bridge.callASFunction(funcID, FABridge.argsToArray(arguments));
-            }
-        }
-        return this.remoteFunctionCache[funcID];
-    },
-    
-    //reutrns the ID of the given function; if it doesnt exist it is created and added to the local cache
-    getFunctionID: function(func)
-    {
-        if (func.__bridge_id__ == undefined)
-        {
-            func.__bridge_id__ = this.makeID(this.nextLocalFuncID++);
-            this.localFunctionCache[func.__bridge_id__] = func;
-        }
-        return func.__bridge_id__;
-    },
-
-    // serialization / deserialization
-
-    serialize: function(value)
-    {
-        var result = {};
-
-        var t = typeof(value);
-        //primitives are kept as such
-        if (t == "number" || t == "string" || t == "boolean" || t == null || t == undefined)
-        {
-            result = value;
-        }
-        else if (value instanceof Array)
-        {
-            //arrays are serializesd recursively
-            result = [];
-            for (var i = 0; i < value.length; i++)
-            {
-                result[i] = this.serialize(value[i]);
-            }
-        }
-        else if (t == "function")
-        {
-            //js functions are assigned an ID and stored in the local cache 
-            result.type = FABridge.TYPE_JSFUNCTION;
-            result.value = this.getFunctionID(value);
-        }
-        else if (value instanceof ASProxy)
-        {
-            result.type = FABridge.TYPE_ASINSTANCE;
-            result.value = value.fb_instance_id;
-        }
-        else
-        {
-            result.type = FABridge.TYPE_ANONYMOUS;
-            result.value = value;
-        }
-
-        return result;
-    },
-
-    //on deserialization we always check the return for the specific error code that is used to marshall NPE's into JS errors
-    // the unpacking is done by returning the value on each pachet for objects/arrays 
-    deserialize: function(packedValue)
-    {
-
-        var result;
-
-        var t = typeof(packedValue);
-        if (t == "number" || t == "string" || t == "boolean" || packedValue == null || packedValue == undefined)
-        {
-            result = this.handleError(packedValue);
-        }
-        else if (packedValue instanceof Array)
-        {
-            result = [];
-            for (var i = 0; i < packedValue.length; i++)
-            {
-                result[i] = this.deserialize(packedValue[i]);
-            }
-        }
-        else if (t == "object")
-        {
-            for(var i = 0; i < packedValue.newTypes.length; i++)
-            {
-                this.addTypeDataToCache(packedValue.newTypes[i]);
-            }
-            for (var aRefID in packedValue.newRefs)
-            {
-                this.createProxy(aRefID, packedValue.newRefs[aRefID]);
-            }
-            if (packedValue.type == FABridge.TYPE_PRIMITIVE)
-            {
-                result = packedValue.value;
-            }
-            else if (packedValue.type == FABridge.TYPE_ASFUNCTION)
-            {
-                result = this.getFunctionProxy(packedValue.value);
-            }
-            else if (packedValue.type == FABridge.TYPE_ASINSTANCE)
-            {
-                result = this.getProxy(packedValue.value);
-            }
-            else if (packedValue.type == FABridge.TYPE_ANONYMOUS)
-            {
-                result = packedValue.value;
-            }
-        }
-        return result;
-    },
-    //increases the reference count for the given object
-    addRef: function(obj)
-    {
-        this.target.incRef(obj.fb_instance_id);
-    },
-    //decrease the reference count for the given object and release it if needed
-    release:function(obj)
-    {
-        this.target.releaseRef(obj.fb_instance_id);
-    },
-
-    // check the given value for the components of the hard-coded error code : __FLASHERROR
-    // used to marshall NPE's into flash
-    
-    handleError: function(value)
-    {
-        if (typeof(value)=="string" && value.indexOf("__FLASHERROR")==0)
-        {
-            var myErrorMessage = value.split("||");
-            if(FABridge.refCount > 0 )
-            {
-                FABridge.refCount--;
-            }
-            throw new Error(myErrorMessage[1]);
-            return value;
-        }
-        else
-        {
-            return value;
-        }   
-    }
-};
-
-// The root ASProxy class that facades a flash object
-
-ASProxy = function(bridge, typeName)
-{
-    this.bridge = bridge;
-    this.typeName = typeName;
-    return this;
-};
-//methods available on each ASProxy object
-ASProxy.prototype =
-{
-    get: function(propName)
-    {
-        return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));
-    },
-
-    set: function(propName, value)
-    {
-        this.bridge.setPropertyInAS(this.fb_instance_id, propName, value);
-    },
-
-    call: function(funcName, args)
-    {
-        this.bridge.callASMethod(this.fb_instance_id, funcName, args);
-    }, 
-    
-    addRef: function() {
-        this.bridge.addRef(this);
-    }, 
-    
-    release: function() {
-        this.bridge.release(this);
-    }
-};
diff --git a/lib/web/mage/accordion.js b/lib/web/mage/accordion.js
index fe378e33ec583a2836baa5d1e64341328baba60c..c59886f359cd0a3cb4a7a68264adf1bf8b15305d 100644
--- a/lib/web/mage/accordion.js
+++ b/lib/web/mage/accordion.js
@@ -21,9 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-
-(function ($, undefined) {
+define([
+    "jquery",
+    "mage/tabs"
+], function($){
     "use strict";
+
     $.widget("mage.accordion", $.mage.tabs, {
         options: {
             active : [0],
@@ -102,4 +105,4 @@
             });
         }
     });
-})(jQuery);
+});
diff --git a/lib/web/mage/adminhtml/accordion.js b/lib/web/mage/adminhtml/accordion.js
index 8e40a9e0abb80b635c4d38ff9d437c9c3829d4ce..1e270a3981f7f0f368cebeecef2cdde1fe24a1aa 100644
--- a/lib/web/mage/adminhtml/accordion.js
+++ b/lib/web/mage/adminhtml/accordion.js
@@ -20,118 +20,124 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var varienAccordion = new Class.create();
-varienAccordion.prototype = {
-    initialize : function(containerId, activeOnlyOne){
-        this.containerId = containerId;
-        this.activeOnlyOne = activeOnlyOne || false;
-        this.container   = $(this.containerId);
-        this.items       = $$('#'+this.containerId+' dt');
-        this.loader      = new varienLoader(true);
+define([
+    'prototype'
+], function(){
 
-        var links = $$('#'+this.containerId+' dt a');
-        for(var i in links){
-            if(links[i].href){
-                Event.observe(links[i],'click',this.clickItem.bind(this));
-                this.items[i].dd = this.items[i].next('dd');
-                this.items[i].link = links[i];
+    varienAccordion = new Class.create();
+    varienAccordion.prototype = {
+        initialize : function(containerId, activeOnlyOne){
+            this.containerId = containerId;
+            this.activeOnlyOne = activeOnlyOne || false;
+            this.container   = $(this.containerId);
+            this.items       = $$('#'+this.containerId+' dt');
+            this.loader      = new varienLoader(true);
+
+            var links = $$('#'+this.containerId+' dt a');
+            for(var i in links){
+                if(links[i].href){
+                    Event.observe(links[i],'click',this.clickItem.bind(this));
+                    this.items[i].dd = this.items[i].next('dd');
+                    this.items[i].link = links[i];
+                }
             }
-        }
 
-        this.initFromCookie();
-    },
-    initFromCookie : function () {
-        var activeItemId, visibility;
-        if (this.activeOnlyOne &&
-            (activeItemId = Cookie.read(this.cookiePrefix() + 'active-item')) !== null) {
-            this.hideAllItems();
-            this.showItem(this.getItemById(activeItemId));
-        } else if(!this.activeOnlyOne) {
-            this.items.each(function(item){
-                if((visibility = Cookie.read(this.cookiePrefix() + item.id)) !== null) {
-                    if(visibility == 0) {
-                        this.hideItem(item);
-                    } else {
-                        this.showItem(item);
+            this.initFromCookie();
+        },
+        initFromCookie : function () {
+            var activeItemId, visibility;
+            if (this.activeOnlyOne &&
+                (activeItemId = Cookie.read(this.cookiePrefix() + 'active-item')) !== null) {
+                this.hideAllItems();
+                this.showItem(this.getItemById(activeItemId));
+            } else if(!this.activeOnlyOne) {
+                this.items.each(function(item){
+                    if((visibility = Cookie.read(this.cookiePrefix() + item.id)) !== null) {
+                        if(visibility == 0) {
+                            this.hideItem(item);
+                        } else {
+                            this.showItem(item);
+                        }
                     }
+                }.bind(this));
+            }
+        },
+        cookiePrefix: function () {
+            return 'accordion-' + this.containerId + '-';
+        },
+        getItemById : function (itemId) {
+            var result = null;
+
+            this.items.each(function(item){
+                if (item.id == itemId) {
+                    result = item;
+                    throw $break;
                 }
-            }.bind(this));
-        }
-    },
-    cookiePrefix: function () {
-        return 'accordion-' + this.containerId + '-';
-    },
-    getItemById : function (itemId) {
-        var result = null;
+            });
 
-        this.items.each(function(item){
-            if (item.id == itemId) {
-                result = item;
-                throw $break;
+            return result;
+        },
+        clickItem : function(event){
+            var item = Event.findElement(event, 'dt');
+            if(this.activeOnlyOne){
+                this.hideAllItems();
+                this.showItem(item);
+                Cookie.write(this.cookiePrefix() + 'active-item', item.id, 30*24*60*60);
+            }
+            else{
+                if(this.isItemVisible(item)){
+                    this.hideItem(item);
+                    Cookie.write(this.cookiePrefix() + item.id, 0, 30*24*60*60);
+                }
+                else {
+                    this.showItem(item);
+                    Cookie.write(this.cookiePrefix() + item.id, 1, 30*24*60*60);
+                }
             }
-        });
+            Event.stop(event);
+        },
+        showItem : function(item){
+            if(item && item.link){
+                if(item.link.href){
+                    this.loadContent(item);
+                }
 
-        return result;
-    },
-    clickItem : function(event){
-        var item = Event.findElement(event, 'dt');
-        if(this.activeOnlyOne){
-            this.hideAllItems();
-            this.showItem(item);
-            Cookie.write(this.cookiePrefix() + 'active-item', item.id, 30*24*60*60);
-        }
-        else{
-            if(this.isItemVisible(item)){
-                this.hideItem(item);
-                Cookie.write(this.cookiePrefix() + item.id, 0, 30*24*60*60);
+                Element.addClassName(item, 'open');
+                Element.addClassName(item.dd, 'open');
             }
-            else {
-                this.showItem(item);
-                Cookie.write(this.cookiePrefix() + item.id, 1, 30*24*60*60);
+        },
+        hideItem : function(item){
+            Element.removeClassName(item, 'open');
+            Element.removeClassName(item.dd, 'open');
+        },
+        isItemVisible : function(item){
+            return Element.hasClassName(item, 'open');
+        },
+        loadContent : function(item){
+            if(item.link.href.indexOf('#') == item.link.href.length-1){
+                return;
             }
-        }
-        Event.stop(event);
-    },
-    showItem : function(item){
-        if(item && item.link){
-            if(item.link.href){
-                this.loadContent(item);
+            if (Element.hasClassName(item.link, 'ajax')) {
+                this.loadingItem = item;
+                this.loader.load(item.link.href, {updaterId : this.loadingItem.dd.id}, this.setItemContent.bind(this));
+                return;
             }
-
-            Element.addClassName(item, 'open');
-            Element.addClassName(item.dd, 'open');
-        }
-    },
-    hideItem : function(item){
-        Element.removeClassName(item, 'open');
-        Element.removeClassName(item.dd, 'open');
-    },
-    isItemVisible : function(item){
-        return Element.hasClassName(item, 'open');
-    },
-    loadContent : function(item){
-        if(item.link.href.indexOf('#') == item.link.href.length-1){
-            return;
-        }
-        if (Element.hasClassName(item.link, 'ajax')) {
-            this.loadingItem = item;
-            this.loader.load(item.link.href, {updaterId : this.loadingItem.dd.id}, this.setItemContent.bind(this));
-            return;
-        }
-        location.href = item.link.href;
-    },
-    setItemContent : function(content){
-        if (content.isJSON) {
-            return;
-        }
-        this.loadingItem.dd.innerHTML = content;
-    },
-    hideAllItems : function(){
-        for(var i in this.items){
-            if(this.items[i].id){
-                Element.removeClassName(this.items[i], 'open');
-                Element.removeClassName(this.items[i].dd, 'open');
+            location.href = item.link.href;
+        },
+        setItemContent : function(content){
+            if (content.isJSON) {
+                return;
+            }
+            this.loadingItem.dd.innerHTML = content;
+        },
+        hideAllItems : function(){
+            for(var i in this.items){
+                if(this.items[i].id){
+                    Element.removeClassName(this.items[i], 'open');
+                    Element.removeClassName(this.items[i].dd, 'open');
+                }
             }
         }
-    }
-};
+    };
+
+})
diff --git a/lib/web/mage/adminhtml/backup.js b/lib/web/mage/adminhtml/backup.js
index b79775cf7ac9140bccaee0399cbcf59ece668d85..3fbfd71e2d0d32bcef53fcf281a614459de7308f 100644
--- a/lib/web/mage/adminhtml/backup.js
+++ b/lib/web/mage/adminhtml/backup.js
@@ -20,175 +20,184 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var AdminBackup = new Class.create();
-AdminBackup.prototype = {
-    initialize : function(a, b){
-        this.reset();
-        this.rollbackUrl = this.backupUrl = '';
-        this.rollbackForm = jQuery('#rollback-form').mage('validation', {
-            submitHandler: jQuery.proxy(this.submitRollback, this)
-        });
-        this.backupForm = jQuery('#backup-form').mage('validation', {
-            submitHandler: jQuery.proxy(this.submitBackup, this)
-        });
-    },
-
-    reset: function() {
-        this.time = 0;
-        this.type = '';
-        $('use-ftp-checkbox-row').hide();
-        $('use_ftp').checked = false;
-        $('ftp-credentials-container').hide();
-        $$('#ftp-credentials-container input').each(function(item) {
-            item.removeClassName('required-entry');
-        });
-        $('backup_maintenance_mode').checked = false;
-        $('rollback_maintenance_mode').checked = false;
-        $('exclude_media').checked = false;
-        $('password').value = '';
-        $('backup_name').value = '';
-        $$('.validation-advice').invoke('remove');
-        $$('input').invoke('removeClassName', 'validation-failed');
-        $$('input').invoke('removeClassName', 'validation-passed');
-        $$('.backup-messages').invoke('hide');
-        $$('#ftp-credentials-container input').each(function(item) {
-            item.value = '';
-        });
-    },
-
-    backup: function(type) {
-        this.reset();
-        this.type = type;
-        this.showBackupWarning();
-        return false;
-    },
-
-    rollback: function(type, time) {
-        this.reset();
-        this.time = time;
-        this.type = type;
-        this.showRollbackWarning();
-        return false;
-    },
-
-    showBackupWarning: function() {
-        this.showPopup('backup-warning');
-    },
-
-    showRollbackWarning: function() {
-        this.showPopup('rollback-warning');
-    },
-
-    requestBackupOptions: function() {
-        this.hidePopups();
-        var action = this.type != 'snapshot' ? 'hide' : 'show';
-        $$('#exclude-media-checkbox-container').invoke(action);
-        this.showPopup('backup-options');
-    },
-
-    requestPassword: function() {
-        this.hidePopups();
-        this.type != 'db' ? $('use-ftp-checkbox-row').show() : $('use-ftp-checkbox-row').hide();
-        this.showPopup('rollback-request-password');
-    },
-
-    toggleFtpCredentialsForm: function() {
-        $('use_ftp').checked ? $('ftp-credentials-container').show()
-            : $('ftp-credentials-container').hide();
-        var divId = 'rollback-request-password';
-
-        $$('#ftp-credentials-container input').each(function(item) {
-            if (item.name == 'ftp_path') return;
-            $('use_ftp').checked ? item.addClassName('required-entry') : item.removeClassName('required-entry');
-        });
-
-        $(divId).show().setStyle({
-            'marginTop': -$(divId).getDimensions().height / 2 + 'px'
-        });
-    },
-
-    submitBackup: function () {
-        this.hidePopups();
-        var data = {
-            'type': this.type,
-            'maintenance_mode': $('backup_maintenance_mode').checked ? 1 : 0,
-            'backup_name': $('backup_name').value,
-            'exclude_media': $('exclude_media').checked ? 1 : 0
-        };
-
-        new Ajax.Request(this.backupUrl, {
-            onSuccess: function(transport) {
-                this.processResponse(transport, 'backup-options');
-            }.bind(this),
-            method: 'post',
-            parameters: data
-        });
-    },
-
-    submitRollback: function() {
-        var data = this.getPostData();
-        this.hidePopups();
-        new Ajax.Request(this.rollbackUrl, {
-            onSuccess: function(transport) {
-                this.processResponse(transport, 'rollback-request-password');
-            }.bind(this),
-            method: 'post',
-            parameters: data
-        });
-    },
-
-    processResponse: function(transport, popupId) {
-        if (!transport.responseText.isJSON()) {
-            return;
-        }
-
-        var json = transport.responseText.evalJSON();
-
-        if (!!json.error) {
-            this.displayError(popupId, json.error);
-            this.showPopup(popupId);
-            return;
-        }
-
-        if (!!json.redirect_url) {
-            setLocation(json.redirect_url);
-        }
-    },
-
-    displayError: function(parentContainer, message) {
-        var messageHtml = this.getErrorMessageHtml(message);
-        $$('#' + parentContainer + ' .backup-messages .messages').invoke('update', messageHtml);
-        $$('#' + parentContainer + ' .backup-messages').invoke('show');
-    },
-
-    getErrorMessageHtml: function(message) {
-        return '<div class="message error"><div>' + message + '</div></div>';
-    },
-
-    getPostData: function() {
-        var data = $('rollback-form').serialize(true);
-        data['time'] = this.time;
-        data['type'] = this.type;
-        return data;
-    },
-
-    showPopup: function(divId) {
-        $(divId).show().setStyle({
-            'marginTop': -$(divId).getDimensions().height / 2 + 'px'
-        });
-        var mask = $('popup-window-mask');
-        if (mask) {
-            $('popup-window-mask').setStyle({
-                height: $('html-body').getHeight() + 'px'
-            }).show();
-        }
-    },
-
-    hidePopups: function() {
-        $$('.backup-dialog').each(Element.hide);
-        var mask = $('popup-window-mask');
-        if (mask) {
-            mask.hide();
+define([
+    "jquery",
+    "mage/mage",
+    "prototype"
+], function(jQuery){
+
+    AdminBackup = new Class.create();
+    
+    AdminBackup.prototype = {
+        initialize : function(a, b){
+            this.reset();
+            this.rollbackUrl = this.backupUrl = '';
+            this.rollbackForm = jQuery('#rollback-form').mage('validation', {
+                submitHandler: jQuery.proxy(this.submitRollback, this)
+            });
+            this.backupForm = jQuery('#backup-form').mage('validation', {
+                submitHandler: jQuery.proxy(this.submitBackup, this)
+            });
+        },
+
+        reset: function() {
+            this.time = 0;
+            this.type = '';
+            $('use-ftp-checkbox-row').hide();
+            $('use_ftp').checked = false;
+            $('ftp-credentials-container').hide();
+            $$('#ftp-credentials-container input').each(function(item) {
+                item.removeClassName('required-entry');
+            });
+            $('backup_maintenance_mode').checked = false;
+            $('rollback_maintenance_mode').checked = false;
+            $('exclude_media').checked = false;
+            $('password').value = '';
+            $('backup_name').value = '';
+            $$('.validation-advice').invoke('remove');
+            $$('input').invoke('removeClassName', 'validation-failed');
+            $$('input').invoke('removeClassName', 'validation-passed');
+            $$('.backup-messages').invoke('hide');
+            $$('#ftp-credentials-container input').each(function(item) {
+                item.value = '';
+            });
+        },
+
+        backup: function(type) {
+            this.reset();
+            this.type = type;
+            this.showBackupWarning();
+            return false;
+        },
+
+        rollback: function(type, time) {
+            this.reset();
+            this.time = time;
+            this.type = type;
+            this.showRollbackWarning();
+            return false;
+        },
+
+        showBackupWarning: function() {
+            this.showPopup('backup-warning');
+        },
+
+        showRollbackWarning: function() {
+            this.showPopup('rollback-warning');
+        },
+
+        requestBackupOptions: function() {
+            this.hidePopups();
+            var action = this.type != 'snapshot' ? 'hide' : 'show';
+            $$('#exclude-media-checkbox-container').invoke(action);
+            this.showPopup('backup-options');
+        },
+
+        requestPassword: function() {
+            this.hidePopups();
+            this.type != 'db' ? $('use-ftp-checkbox-row').show() : $('use-ftp-checkbox-row').hide();
+            this.showPopup('rollback-request-password');
+        },
+
+        toggleFtpCredentialsForm: function() {
+            $('use_ftp').checked ? $('ftp-credentials-container').show()
+                : $('ftp-credentials-container').hide();
+            var divId = 'rollback-request-password';
+
+            $$('#ftp-credentials-container input').each(function(item) {
+                if (item.name == 'ftp_path') return;
+                $('use_ftp').checked ? item.addClassName('required-entry') : item.removeClassName('required-entry');
+            });
+
+            $(divId).show().setStyle({
+                'marginTop': -$(divId).getDimensions().height / 2 + 'px'
+            });
+        },
+
+        submitBackup: function () {
+            this.hidePopups();
+            var data = {
+                'type': this.type,
+                'maintenance_mode': $('backup_maintenance_mode').checked ? 1 : 0,
+                'backup_name': $('backup_name').value,
+                'exclude_media': $('exclude_media').checked ? 1 : 0
+            };
+
+            new Ajax.Request(this.backupUrl, {
+                onSuccess: function(transport) {
+                    this.processResponse(transport, 'backup-options');
+                }.bind(this),
+                method: 'post',
+                parameters: data
+            });
+        },
+
+        submitRollback: function() {
+            var data = this.getPostData();
+            this.hidePopups();
+            new Ajax.Request(this.rollbackUrl, {
+                onSuccess: function(transport) {
+                    this.processResponse(transport, 'rollback-request-password');
+                }.bind(this),
+                method: 'post',
+                parameters: data
+            });
+        },
+
+        processResponse: function(transport, popupId) {
+            if (!transport.responseText.isJSON()) {
+                return;
+            }
+
+            var json = transport.responseText.evalJSON();
+
+            if (!!json.error) {
+                this.displayError(popupId, json.error);
+                this.showPopup(popupId);
+                return;
+            }
+
+            if (!!json.redirect_url) {
+                setLocation(json.redirect_url);
+            }
+        },
+
+        displayError: function(parentContainer, message) {
+            var messageHtml = this.getErrorMessageHtml(message);
+            $$('#' + parentContainer + ' .backup-messages .messages').invoke('update', messageHtml);
+            $$('#' + parentContainer + ' .backup-messages').invoke('show');
+        },
+
+        getErrorMessageHtml: function(message) {
+            return '<div class="message error"><div>' + message + '</div></div>';
+        },
+
+        getPostData: function() {
+            var data = $('rollback-form').serialize(true);
+            data['time'] = this.time;
+            data['type'] = this.type;
+            return data;
+        },
+
+        showPopup: function(divId) {
+            $(divId).show().setStyle({
+                'marginTop': -$(divId).getDimensions().height / 2 + 'px'
+            });
+            var mask = $('popup-window-mask');
+            if (mask) {
+                $('popup-window-mask').setStyle({
+                    height: $('html-body').getHeight() + 'px'
+                }).show();
+            }
+        },
+
+        hidePopups: function() {
+            $$('.backup-dialog').each(Element.hide);
+            var mask = $('popup-window-mask');
+            if (mask) {
+                mask.hide();
+            }
         }
     }
-}
+
+});
\ No newline at end of file
diff --git a/lib/web/mage/adminhtml/browser.js b/lib/web/mage/adminhtml/browser.js
index f50d85d4081a7e177b33aa9bffa2241ca59990a6..a6bf0bc6b0e7a441488f604bf4a5de799a600fac 100644
--- a/lib/web/mage/adminhtml/browser.js
+++ b/lib/web/mage/adminhtml/browser.js
@@ -21,11 +21,14 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
-    $(function() {
-        $.mage.load('mediabrowser');
-    });
-    window.MediabrowserUtility = {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/jstree/jquery.jstree",
+    "mage/mage"
+], function($){
+    
+    MediabrowserUtility = {
         windowId: 'modal_dialog_message',
         getMaxZIndex: function() {
             var max = 0, i;
@@ -237,7 +240,7 @@
             if (typeof(tinyMCE) != 'undefined' && tinyMCE.get(this.options.targetElementId)) {
                 var opener = this.getMediaBrowserOpener() || window;
                 var targetElementId = tinyMceEditors.get(this.options.targetElementId).getMediaBrowserTargetElementId();
-                return jQuery(opener.document.getElementById(targetElementId));
+                return $(opener.document.getElementById(targetElementId));
             } else {
                 return $('#' + this.options.targetElementId);
             }
@@ -348,4 +351,4 @@
             breadcrumbs.insertAfter(this.element.find('#content_header'))
         }
     });
-})(jQuery);
+});
diff --git a/lib/web/mage/adminhtml/events.js b/lib/web/mage/adminhtml/events.js
index 7b364bf7c4c61e05b10d0412a38f420de22540a7..40a55cfe8bf4ecca0329ae443ecc1405af85e72f 100644
--- a/lib/web/mage/adminhtml/events.js
+++ b/lib/web/mage/adminhtml/events.js
@@ -20,116 +20,121 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-// from http://www.someelement.com/2007/03/eventpublisher-custom-events-la-pubsub.html
-varienEvents = Class.create();
+define([
+    'prototype'
+], function(){
 
-varienEvents.prototype = {
-    initialize: function() {
-        this.arrEvents = {};
-        this.eventPrefix = '';
-    },
+    // from http://www.someelement.com/2007/03/eventpublisher-custom-events-la-pubsub.html
+    varienEvents = Class.create();
 
-    /**
-    * Attaches a {handler} function to the publisher's {eventName} event for execution upon the event firing
-    * @param {String} eventName
-    * @param {Function} handler
-    * @param {Boolean} asynchFlag [optional] Defaults to false if omitted. Indicates whether to execute {handler} asynchronously (true) or not (false).
-    */
-    attachEventHandler : function(eventName, handler) {
-        if ((typeof handler == 'undefined') || (handler == null)) {
-            return;
-        }
-        eventName = eventName + this.eventPrefix;
-        // using an event cache array to track all handlers for proper cleanup
-        if (this.arrEvents[eventName] == null){
-            this.arrEvents[eventName] = [];
-        }
-        //create a custom object containing the handler method and the asynch flag
-        var asynchVar = arguments.length > 2 ? arguments[2] : false;
-        var handlerObj = {
-            method: handler,
-            asynch: asynchVar
-        };
-        this.arrEvents[eventName].push(handlerObj);
-    },
+    varienEvents.prototype = {
+        initialize: function() {
+            this.arrEvents = {};
+            this.eventPrefix = '';
+        },
 
-    /**
-    * Removes a single handler from a specific event
-    * @param {String} eventName The event name to clear the handler from
-    * @param {Function} handler A reference to the handler function to un-register from the event
-    */
-    removeEventHandler : function(eventName, handler) {
-        eventName = eventName + this.eventPrefix;
-        if (this.arrEvents[eventName] != null){
-            this.arrEvents[eventName] = this.arrEvents[eventName].reject(function(obj) { return obj.method == handler; });
-        }
-    },
+        /**
+        * Attaches a {handler} function to the publisher's {eventName} event for execution upon the event firing
+        * @param {String} eventName
+        * @param {Function} handler
+        * @param {Boolean} asynchFlag [optional] Defaults to false if omitted. Indicates whether to execute {handler} asynchronously (true) or not (false).
+        */
+        attachEventHandler : function(eventName, handler) {
+            if ((typeof handler == 'undefined') || (handler == null)) {
+                return;
+            }
+            eventName = eventName + this.eventPrefix;
+            // using an event cache array to track all handlers for proper cleanup
+            if (this.arrEvents[eventName] == null){
+                this.arrEvents[eventName] = [];
+            }
+            //create a custom object containing the handler method and the asynch flag
+            var asynchVar = arguments.length > 2 ? arguments[2] : false;
+            var handlerObj = {
+                method: handler,
+                asynch: asynchVar
+            };
+            this.arrEvents[eventName].push(handlerObj);
+        },
 
-    /**
-    * Removes all handlers from a single event
-    * @param {String} eventName The event name to clear handlers from
-    */
-    clearEventHandlers : function(eventName) {
-        eventName = eventName + this.eventPrefix;
-        this.arrEvents[eventName] = null;
-    },
+        /**
+        * Removes a single handler from a specific event
+        * @param {String} eventName The event name to clear the handler from
+        * @param {Function} handler A reference to the handler function to un-register from the event
+        */
+        removeEventHandler : function(eventName, handler) {
+            eventName = eventName + this.eventPrefix;
+            if (this.arrEvents[eventName] != null){
+                this.arrEvents[eventName] = this.arrEvents[eventName].reject(function(obj) { return obj.method == handler; });
+            }
+        },
+
+        /**
+        * Removes all handlers from a single event
+        * @param {String} eventName The event name to clear handlers from
+        */
+        clearEventHandlers : function(eventName) {
+            eventName = eventName + this.eventPrefix;
+            this.arrEvents[eventName] = null;
+        },
 
-    /**
-    * Removes all handlers from ALL events
-    */
-    clearAllEventHandlers : function() {
-        this.arrEvents = {};
-    },
+        /**
+        * Removes all handlers from ALL events
+        */
+        clearAllEventHandlers : function() {
+            this.arrEvents = {};
+        },
 
-    /**
-    * Fires the event {eventName}, resulting in all registered handlers to be executed.
-    * It also collects and returns results of all non-asynchronous handlers
-    * @param {String} eventName The name of the event to fire
-    * @params {Object} args [optional] Any object, will be passed into the handler function as the only argument
-    * @return {Array}
-    */
-    fireEvent : function(eventName) {
-        var evtName = eventName + this.eventPrefix;
-        var results = [];
-        var result;
-        if (this.arrEvents[evtName] != null) {
-            var len = this.arrEvents[evtName].length; //optimization
-            for (var i = 0; i < len; i++) {
-                try {
-                    if (arguments.length > 1) {
-                        if (this.arrEvents[evtName][i].asynch) {
-                            var eventArgs = arguments[1];
-                            var method = this.arrEvents[evtName][i].method.bind(this);
-                            setTimeout(function() { method(eventArgs) }.bind(this), 10);
+        /**
+        * Fires the event {eventName}, resulting in all registered handlers to be executed.
+        * It also collects and returns results of all non-asynchronous handlers
+        * @param {String} eventName The name of the event to fire
+        * @params {Object} args [optional] Any object, will be passed into the handler function as the only argument
+        * @return {Array}
+        */
+        fireEvent : function(eventName) {
+            var evtName = eventName + this.eventPrefix;
+            var results = [];
+            var result;
+            if (this.arrEvents[evtName] != null) {
+                var len = this.arrEvents[evtName].length; //optimization
+                for (var i = 0; i < len; i++) {
+                    try {
+                        if (arguments.length > 1) {
+                            if (this.arrEvents[evtName][i].asynch) {
+                                var eventArgs = arguments[1];
+                                var method = this.arrEvents[evtName][i].method.bind(this);
+                                setTimeout(function() { method(eventArgs) }.bind(this), 10);
+                            }
+                            else{
+                                result = this.arrEvents[evtName][i].method(arguments[1]);
+                            }
                         }
-                        else{
-                            result = this.arrEvents[evtName][i].method(arguments[1]);
+                        else {
+                            if (this.arrEvents[evtName][i].asynch) {
+                                var eventHandler = this.arrEvents[evtName][i].method;
+                                setTimeout(eventHandler, 1);
+                            }
+                            else if (this.arrEvents && this.arrEvents[evtName] && this.arrEvents[evtName][i] && this.arrEvents[evtName][i].method){
+                                result = this.arrEvents[evtName][i].method();
+                            }
                         }
+                        results.push(result);
                     }
-                    else {
-                        if (this.arrEvents[evtName][i].asynch) {
-                            var eventHandler = this.arrEvents[evtName][i].method;
-                            setTimeout(eventHandler, 1);
+                    catch (e) {
+                        if (this.id){
+                            alert("error: error in " + this.id + ".fireEvent():\n\nevent name: " + eventName + "\n\nerror message: " + e.message);
                         }
-                        else if (this.arrEvents && this.arrEvents[evtName] && this.arrEvents[evtName][i] && this.arrEvents[evtName][i].method){
-                            result = this.arrEvents[evtName][i].method();
+                        else {
+                            alert("error: error in [unknown object].fireEvent():\n\nevent name: " + eventName + "\n\nerror message: " + e.message);
                         }
                     }
-                    results.push(result);
-                }
-                catch (e) {
-                    if (this.id){
-                        alert("error: error in " + this.id + ".fireEvent():\n\nevent name: " + eventName + "\n\nerror message: " + e.message);
-                    }
-                    else {
-                        alert("error: error in [unknown object].fireEvent():\n\nevent name: " + eventName + "\n\nerror message: " + e.message);
-                    }
                 }
             }
+            return results;
         }
-        return results;
-    }
-};
+    };
 
-varienGlobalEvents = new varienEvents();
+    varienGlobalEvents = new varienEvents();
 
+});
\ No newline at end of file
diff --git a/lib/web/mage/adminhtml/flexuploader.js b/lib/web/mage/adminhtml/flexuploader.js
deleted file mode 100644
index 5beca229d0da5fff325a72ca86aed235869864af..0000000000000000000000000000000000000000
--- a/lib/web/mage/adminhtml/flexuploader.js
+++ /dev/null
@@ -1,364 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-
-if(!window.Flex) {
-    alert('Flex library not loaded');
-} else {
-    Flex.Uploader = Class.create();
-    Flex.Uploader.prototype = {
-        flex: null,
-        uploader:null,
-        filters:null,
-        containerId:null,
-        flexContainerId:null,
-        container:null,
-        files:null,
-        fileRowTemplate:null,
-        fileProgressTemplate:null,
-        templatesPattern: /(^|.|\r|\n)(\{\{(.*?)\}\})/,
-        onFilesComplete: false,
-        onFileProgress: true,
-        onFileRemove: false,
-        onContainerHideBefore:null,
-        initialize: function(containerId, uploaderSrc, config) {
-            this.containerId = containerId;
-            this.container   = $(containerId);
-
-            this.container.controller = this;
-
-            this.config = config;
-
-            this.flexContainerId = this.containerId + '-flash';
-            Element.insert(
-                // window.document.body,
-                this.containerId,
-                {'before':'<div id="'+this.flexContainerId+'" class="flex" style="position:relative;float:right;"></div>'}
-            );
-            flexWidth = 230;
-            if (this.config.width) {
-                flexWidth = this.config.width;
-            }
-            this.flex = new Flex.Object({
-                left: 100,
-                top: 300,
-                width:  flexWidth,
-                height: 20,
-                src:    uploaderSrc,
-                wmode: 'transparent'
-            });
-            // this.getInnerElement('browse').disabled = true;
-            // this.getInnerElement('upload').disabled = true;
-            this.fileRowTemplate = new Template(
-                this.getInnerElement('template').innerHTML,
-                this.templatesPattern
-            );
-
-            this.fileProgressTemplate = new Template(
-                this.getInnerElement('template-progress').innerHTML,
-                this.templatesPattern
-            );
-
-            this.flex.onBridgeInit = this.handleBridgeInit.bind(this);
-            if (this.flex.detectFlashVersion(9, 0, 28)) {
-                this.flex.apply(this.flexContainerId);
-            } else {
-                // this.getInnerElement('browse').hide();
-                // this.getInnerElement('upload').hide();
-                this.getInnerElement('install-flash').show();
-            }
-            this.onContainerHideBefore = this.handleContainerHideBefore.bind(this);
-        },
-        getInnerElement: function(elementName) {
-            return $(this.containerId + '-' + elementName);
-        },
-        getFileId: function(file) {
-            var id;
-            if(typeof file == 'object') {
-                id = file.id;
-            } else {
-                id = file;
-            }
-            return this.containerId + '-file-' + id;
-        },
-        getDeleteButton: function(file) {
-            return $(this.getFileId(file) + '-delete');
-        },
-        handleBridgeInit: function() {
-            this.uploader = this.flex.getBridge().getUpload();
-            if (this.config.filters) {
-                $H(this.config.filters).each(function(pair) {
-                    this.uploader.addTypeFilter(pair.key, pair.value.label, pair.value.files);
-                }.bind(this));
-                delete(this.config.filters);
-                this.uploader.setUseTypeFilter(true);
-            }
-
-            this.uploader.setConfig(this.config);
-            this.uploader.addEventListener('select',    this.handleSelect.bind(this));
-            this.uploader.addEventListener('complete',  this.handleComplete.bind(this));
-            this.uploader.addEventListener('progress',  this.handleProgress.bind(this));
-            this.uploader.addEventListener('error',     this.handleError.bind(this));
-            this.uploader.addEventListener('removeall', this.handleRemoveAll.bind(this));
-            // this.getInnerElement('browse').disabled = false;
-            // this.getInnerElement('upload').disabled = false;
-        },
-        browse: function() {
-            this.uploader.browse();
-        },
-        upload: function() {
-            this.uploader.upload();
-            this.files = this.uploader.getFilesInfo();
-            this.updateFiles();
-        },
-        removeFile: function(id) {
-            this.uploader.removeFile(id);
-            $(this.getFileId(id)).remove();
-            if (this.onFileRemove) {
-                this.onFileRemove(id);
-            }
-            this.files = this.uploader.getFilesInfo();
-            this.updateFiles();
-        },
-        removeAllFiles: function() {
-            this.files.each(function(file) {
-                this.removeFile(file.id);
-            }.bind(this));
-            this.files = this.uploader.getFilesInfo();
-            this.updateFiles();
-        },
-        handleSelect: function (event) {
-            this.files = event.getData().files;
-            this.checkFileSize();
-            this.updateFiles();
-            this.getInnerElement('upload').show();
-            if (this.onFileSelect) {
-                this.onFileSelect();
-            }
-        },
-        handleProgress: function (event) {
-            var file = event.getData().file;
-            this.updateFile(file);
-            if (this.onFileProgress) {
-                this.onFileProgress(file);
-            }
-        },
-        handleError: function (event) {
-            this.updateFile(event.getData().file);
-        },
-        handleComplete: function (event) {
-            this.files = event.getData().files;
-            this.updateFiles();
-            if (this.onFilesComplete) {
-                this.onFilesComplete(this.files);
-            }
-        },
-        handleRemoveAll: function (event) {
-            this.files.each(function(file) {
-                $(this.getFileId(file.id)).remove();
-            }.bind(this));
-            if (this.onFileRemoveAll) {
-                this.onFileRemoveAll();
-            }
-            this.files = this.uploader.getFilesInfo();
-            this.updateFiles();
-        },
-        handleRemove: function (event) {
-            this.files = this.uploader.getFilesInfo();
-            this.updateFiles();
-        },
-        updateFiles: function () {
-            this.files.each(function(file) {
-                this.updateFile(file);
-            }.bind(this));
-        },
-        updateFile:  function (file) {
-            if (!$(this.getFileId(file))) {
-                if (this.config.replace_browse_with_remove) {
-                    $(this.containerId+'-new').show();
-                    $(this.containerId+'-new').innerHTML = this.fileRowTemplate.evaluate(this.getFileVars(file));
-                    $(this.containerId+'-old').hide();
-                    this.flex.getBridge().hideBrowseButton();
-                } else {
-                    Element.insert(this.container, {bottom: this.fileRowTemplate.evaluate(this.getFileVars(file))});
-                }
-            }
-            if (file.status == 'full_complete' && file.response.isJSON()) {
-                var response = file.response.evalJSON();
-                if (typeof response == 'object') {
-                    if (typeof response.cookie == 'object') {
-                        var date = new Date();
-                        date.setTime(date.getTime()+(parseInt(response.cookie.lifetime)*1000));
-
-                        document.cookie = escape(response.cookie.name) + "="
-                            + escape(response.cookie.value)
-                            + "; expires=" + date.toGMTString()
-                            + (response.cookie.path.blank() ? "" : "; path=" + response.cookie.path)
-                            + (response.cookie.domain.blank() ? "" : "; domain=" + response.cookie.domain);
-                    }
-                    if (typeof response.error != 'undefined' && response.error != 0) {
-                        file.status = 'error';
-                        file.errorText = response.error;
-                    }
-                }
-            }
-
-            if (file.status == 'full_complete' && !file.response.isJSON()) {
-                file.status = 'error';
-            }
-
-            var progress = $(this.getFileId(file)).getElementsByClassName('progress-text')[0];
-            if ((file.status=='progress') || (file.status=='complete')) {
-                $(this.getFileId(file)).addClassName('progress');
-                $(this.getFileId(file)).removeClassName('new');
-                $(this.getFileId(file)).removeClassName('error');
-                if (file.progress && file.progress.total) {
-                    progress.update(this.fileProgressTemplate.evaluate(this.getFileProgressVars(file)));
-                } else {
-                    progress.update('');
-                }
-                if (! this.config.replace_browse_with_remove) {
-                    this.getDeleteButton(file).hide();
-                }
-            } else if (file.status=='error') {
-                $(this.getFileId(file)).addClassName('error');
-                $(this.getFileId(file)).removeClassName('progress');
-                $(this.getFileId(file)).removeClassName('new');
-                var errorText = file.errorText ? file.errorText : this.errorText(file);
-                if (this.config.replace_browse_with_remove) {
-                    this.flex.getBridge().hideBrowseButton();
-                } else {
-                    this.getDeleteButton(file).show();
-                }
-
-                progress.update(errorText);
-
-            } else if (file.status=='full_complete') {
-                $(this.getFileId(file)).addClassName('complete');
-                $(this.getFileId(file)).removeClassName('progress');
-                $(this.getFileId(file)).removeClassName('error');
-                if (this.config.replace_browse_with_remove) {
-                    this.flex.getBridge().hideRemoveButton();
-                }
-                progress.update(this.translate('Complete'));
-            }
-        },
-        getDebugStr: function(obj) {
-             return Object.toJSON(obj).replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;');
-        },
-        getFileVars: function(file) {
-            return {
-                id      : this.getFileId(file),
-                fileId  : file.id,
-                name    : file.name,
-                size    : this.formatSize(file.size)
-            };
-        },
-        getFileProgressVars: function(file) {
-            return {
-                total    : this.formatSize(file.progress.total),
-                uploaded : this.formatSize(file.progress.loaded),
-                percent  : this.round((file.progress.loaded/file.progress.total)*100)
-            };
-        },
-        formatSize: function(size) {
-            if (size > 1024 * 1024 * 1024 * 1024) {
-                return this.round(size / (1024 * 1024 * 1024 * 1024)) + ' ' + this.translate('TB');
-            } else if (size > 1024 * 1024 * 1024) {
-                return this.round(size / (1024 * 1024 * 1024)) + ' ' + this.translate('GB');
-            } else if (size > 1024 * 1024) {
-                return this.round(size / (1024 * 1024)) + ' ' + this.translate('MB');
-            } else if (size > 1024) {
-                return this.round(size / (1024)) + ' ' + this.translate('kB');
-            }
-            return size + ' ' + this.translate('B');
-        },
-        round: function(number) {
-            return Math.round(number*100)/100;
-        },
-        checkFileSize: function() {
-            newFiles = [];
-            hasTooBigFiles = false;
-            this.files.each(function(file){
-                if (file.size > maxUploadFileSizeInBytes) {
-                    hasTooBigFiles = true;
-                    this.uploader.removeFile(file.id)
-                } else {
-                    newFiles.push(file)
-                }
-            }.bind(this));
-            this.files = newFiles;
-            if (hasTooBigFiles) {
-                alert(
-                    this.translate('Maximum allowed file size for upload is')+' '+maxUploadFileSize+".\n"+this.translate('Please check your server PHP settings.')
-                );
-            }
-        },
-        translate: function(text) {
-            return jQuery.mage.__ ? jQuery.mage.__(text) : text;
-        },
-        errorText: function(file) {
-            var error = '';
-
-            switch(file.errorCode) {
-                case 1: // Size 0
-                    error = 'File size should be more than 0 bytes';
-                    break;
-                case 2: // Http error
-                    error = 'Upload HTTP Error';
-                    break;
-                case 3: // I/O error
-                    error = 'Upload I/O Error';
-                    break;
-                case 4: // Security error
-                    error = 'Upload Security Error';
-                    break;
-                case 5: // SSL self-signed certificate
-                    error = 'SSL Error: Invalid or self-signed certificate';
-                    break;
-            }
-
-            if(error) {
-                return this.translate(error);
-            }
-
-            return error;
-        },
-        handleContainerHideBefore: function(container) {
-            if (container && Element.descendantOf(this.container, container) && !this.checkAllComplete()) {
-                if (! confirm('There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to continue ?')) {
-                    return 'cannotchange';
-                } else {
-                    this.removeAllFiles();
-                }
-            }
-        },
-        checkAllComplete: function() {
-            if (this.files) {
-                return !this.files.any(function(file) {
-                    return (file.status !== 'full_complete')
-                });
-            }
-            return true;
-        }
-    }
-}
diff --git a/lib/web/mage/adminhtml/form.js b/lib/web/mage/adminhtml/form.js
index 6a94b4472624fb73d1e19b8fe4393f2f0a3bb801..557f1425e36e56cdff0ec754c7ba9d177d6c975d 100644
--- a/lib/web/mage/adminhtml/form.js
+++ b/lib/web/mage/adminhtml/form.js
@@ -21,6 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
+define([
+    "jquery",
+    "prototype",
+    "mage/adminhtml/events"
+], function(jQuery){
 /*
  * @TODO Need to be removed after refactoring all dependent of the form the components
  */
@@ -499,3 +504,8 @@ FormElementDependenceController.prototype = {
         }
     }
 };
+
+
+    window.varienWindowOnload = varienWindowOnload;
+    window.varienElementMethods = varienElementMethods;
+});
\ No newline at end of file
diff --git a/lib/web/mage/adminhtml/grid.js b/lib/web/mage/adminhtml/grid.js
index 9f839b3ef2b65c8f2a5a7a5333c1fa1b933cb893..09024c59d02603739b8b1838b181520a8b8de962 100644
--- a/lib/web/mage/adminhtml/grid.js
+++ b/lib/web/mage/adminhtml/grid.js
@@ -20,7 +20,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var varienGrid = new Class.create();
+
+// also depends on a mage/adminhtml/tools.js for Base64 encoding
+define([
+    "jquery",
+    "prototype",
+    "mage/adminhtml/form",
+    "mage/adminhtml/events" 
+], function(jQuery){
+
+
+window.varienGrid = new Class.create();
 
 varienGrid.prototype = {
     initialize:function (containerId, url, pageVar, sortVar, dirVar, filterVar) {
@@ -317,7 +327,7 @@ varienGrid.prototype = {
             if (filters[i].value && filters[i].value.length) elements.push(filters[i]);
         }
         if (!this.doFilterCallback || (this.doFilterCallback && this.doFilterCallback())) {
-            this.reload(this.addVarToUrl(this.filterVar, encode_base64(Form.serializeElements(elements))), callback);
+            this.reload(this.addVarToUrl(this.filterVar, Base64.encode(Form.serializeElements(elements))), callback);
         }
     },
     resetFilter:function (callback) {
@@ -365,8 +375,9 @@ function openGridRow(grid, event){
         setLocation(element.title);
     }
 }
+window.openGridRow = openGridRow;
 
-var varienGridMassaction = Class.create();
+window.varienGridMassaction = Class.create();
 varienGridMassaction.prototype = {
     /* Predefined vars */
     checkedValues: $H({}),
@@ -734,7 +745,7 @@ varienGridMassaction.prototype = {
     }
 };
 
-var varienGridAction = {
+window.varienGridAction = {
     execute: function(select) {
         if(!select.value || !select.value.isJSON()) {
             return;
@@ -756,7 +767,7 @@ var varienGridAction = {
     }
 };
 
-var varienStringArray = {
+window.varienStringArray = {
     remove: function(str, haystack)
     {
         haystack = ',' + haystack + ',';
@@ -806,7 +817,7 @@ var varienStringArray = {
     }
 };
 
-var serializerController = Class.create();
+window.serializerController = Class.create();
 serializerController.prototype = {
     oldCallbacks: {},
     initialize: function(hiddenDataHolder, predefinedData, inputsToManage, grid, reloadParamName){
@@ -933,7 +944,7 @@ serializerController.prototype = {
         if(this.multidimensionalMode){
             var clone = this.gridData.clone();
             clone.each(function(pair) {
-                clone.set(pair.key, encode_base64(Object.toQueryString(pair.value)));
+                clone.set(pair.key, Base64.encode(Object.toQueryString(pair.value)));
             });
             return clone.toQueryString();
         }
@@ -949,3 +960,5 @@ serializerController.prototype = {
         return _object;
     }
 };
+
+});
\ No newline at end of file
diff --git a/lib/web/mage/adminhtml/hash.js b/lib/web/mage/adminhtml/hash.js
deleted file mode 100644
index 3a357c2f4a7dc065a9072be962a871fdfb9509b3..0000000000000000000000000000000000000000
--- a/lib/web/mage/adminhtml/hash.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Caudium - An extensible World Wide Web server
- * Copyright C 2002 The Caudium Group
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * base64.js - a JavaScript implementation of the base64 algorithm,
- *             (mostly) as defined in RFC 2045.
- *
- * This is a direct JavaScript reimplementation of the original C code
- * as found in the Exim mail transport agent, by Philip Hazel.
- *
- * $Id: base64.js,v 1.7 2002/07/16 17:21:23 kazmer Exp $
- *
- */
-
-
-function encode_base64( what )
-{
-    var base64_encodetable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-    var result = "";
-    var len = what.length;
-    var x, y;
-    var ptr = 0;
-
-    while( len-- > 0 )
-    {
-        x = what.charCodeAt( ptr++ );
-        result += base64_encodetable.charAt( ( x >> 2 ) & 63 );
-
-        if( len-- <= 0 )
-        {
-            result += base64_encodetable.charAt( ( x << 4 ) & 63 );
-            result += "==";
-            break;
-        }
-
-        y = what.charCodeAt( ptr++ );
-        result += base64_encodetable.charAt( ( ( x << 4 ) | ( ( y >> 4 ) & 15 ) ) & 63 );
-
-        if ( len-- <= 0 )
-        {
-            result += base64_encodetable.charAt( ( y << 2 ) & 63 );
-            result += "=";
-            break;
-        }
-
-        x = what.charCodeAt( ptr++ );
-        result += base64_encodetable.charAt( ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 63 );
-        result += base64_encodetable.charAt( x & 63 );
-
-    }
-
-    return result;
-}
-
-
-function decode_base64( what )
-{
-    var base64_decodetable = new Array (
-        255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-        255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-        255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  62, 255, 255, 255,  63,
-         52,  53,  54,  55,  56,  57,  58,  59,  60,  61, 255, 255, 255, 255, 255, 255,
-        255,   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, 255, 255, 255, 255, 255,
-        255,  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, 255, 255, 255, 255, 255
-    );
-    var result = "";
-    var len = what.length;
-    var x, y;
-    var ptr = 0;
-
-    while( !isNaN( x = what.charCodeAt( ptr++ ) ) )
-    {
-        if( x == 13 || x == 10 )
-            continue;
-
-        if( ( x > 127 ) || (( x = base64_decodetable[x] ) == 255) )
-            return false;
-        if( ( isNaN( y = what.charCodeAt( ptr++ ) ) ) || (( y = base64_decodetable[y] ) == 255) )
-            return false;
-
-        result += String.fromCharCode( (x << 2) | (y >> 4) );
-
-        if( (x = what.charCodeAt( ptr++ )) == 61 )
-        {
-            if( (what.charCodeAt( ptr++ ) != 61) || (!isNaN(what.charCodeAt( ptr ) ) ) )
-                return false;
-        }
-        else
-        {
-            if( ( x > 127 ) || (( x = base64_decodetable[x] ) == 255) )
-                return false;
-            result += String.fromCharCode( (y << 4) | (x >> 2) );
-            if( (y = what.charCodeAt( ptr++ )) == 61 )
-            {
-                if( !isNaN(what.charCodeAt( ptr ) ) )
-                    return false;
-            }
-            else
-            {
-                if( (y > 127) || ((y = base64_decodetable[y]) == 255) )
-                    return false;
-                result += String.fromCharCode( (x << 6) | y );
-            }
-        }
-    }
-    return result;
-}
-
-function wrap76( what )
-{
-    var result = "";
-    var i;
-
-    for(i=0; i < what.length; i+=76)
-    {
-        result += what.substring(i, i+76) + String.fromCharCode(13) + String.fromCharCode(10);
-    }
-    return result;
-}
diff --git a/lib/web/mage/adminhtml/image.js b/lib/web/mage/adminhtml/image.js
deleted file mode 100644
index 6cf6934cad8b88664802388da06430283f44470c..0000000000000000000000000000000000000000
--- a/lib/web/mage/adminhtml/image.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-
-if(!window.Flex) {
-    alert('Flex library not loaded');
-} else {
-    Flex.ImageEditor = Class.create();
-    Flex.ImageEditor.prototype = {
-        flex: null,
-        filters:null,
-        containerId:null,
-        flexContainerId:null,
-        container:null,
-        initialize: function(containerId, movieSrc, config) {
-            this.containerId = containerId;
-            this.container   = $(containerId);
-
-            this.container.controller = this;
-
-            this.config = config;
-            this.flexContainerId = this.containerId + '-flash';
-            Element.insert(this.container, {bottom: '<div id="'+this.flexContainerId+'"></div>'});
-
-            this.flex = new Flex.Object({
-                width:  "1024",
-                height: "786",
-                src:    movieSrc,
-                wmode: 'transparent'
-            });
-
-
-            this.flex.onBridgeInit = this.handleBridgeInit.bind(this);
-            this.flex.apply(this.flexContainerId);
-        },
-        getInnerElement: function(elementName) {
-            return $(this.containerId + '-' + elementName);
-        },
-        handleBridgeInit: function() {
-            this.flex.getBridge().addEventListener('image_loaded', this.handleImageLoad.bind(this));
-            this.flex.getBridge().setImage(this.config.image);
-
-
-        },
-        handleImageLoad: function(event) {
-            alert('image_loaded:' + this.config.image);
-            this.hangleImageResize();
-        },
-        hangleImageResize: function() {
-            var size = this.flex.getBridge().getSize();
-            this.getInnerElement('width').value = size.width;
-            this.getInnerElement('height').value = size.height;
-
-        },
-        rotateCw: function() {
-            this.flex.getBridge().rotateFw();
-            this.hangleImageResize();
-        },
-        rotateCCw: function() {
-            this.flex.getBridge().rotateBw();
-            this.hangleImageResize();
-        },
-        resize: function() {
-            this.flex.getBridge().resize(parseFloat(this.getInnerElement('width').value), parseFloat(this.getInnerElement('height').value));
-        },
-        getImage: function() {
-            this.getInnerElement('b64').value = this.flex.getBridge().getBase64Image();
-        }
-    }
-}
diff --git a/lib/web/mage/adminhtml/tabs.js b/lib/web/mage/adminhtml/tabs.js
index a086961bf1e8ad03ec0806b936d45cb17e5560e3..693621022e35349f7fa6da866b7948e8c8c60f79 100644
--- a/lib/web/mage/adminhtml/tabs.js
+++ b/lib/web/mage/adminhtml/tabs.js
@@ -20,189 +20,229 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-var varienTabs = new Class.create();
+define([
+    'jquery',
+    'prototype',
+    'mage/adminhtml/events'
+], function(jQuery){
 
-varienTabs.prototype = {
-    initialize : function(containerId, destElementId,  activeTabId, shadowTabs){
-        this.containerId    = containerId;
-        this.destElementId  = destElementId;
-        this.activeTab = null;
+    varienTabs = new Class.create();
 
-        this.tabOnClick     = this.tabMouseClick.bindAsEventListener(this);
+    varienTabs.prototype = {
+        initialize : function(containerId, destElementId,  activeTabId, shadowTabs){
+            this.containerId    = containerId;
+            this.destElementId  = destElementId;
+            this.activeTab = null;
 
-        this.tabs = $$('#'+this.containerId+' li a.tab-item-link');
+            this.tabOnClick     = this.tabMouseClick.bindAsEventListener(this);
 
-        this.hideAllTabsContent();
-        for (var tab=0; tab<this.tabs.length; tab++) {
-            Event.observe(this.tabs[tab],'click',this.tabOnClick);
-            // move tab contents to destination element
-            if($(this.destElementId)){
-                var tabContentElement = $(this.getTabContentElementId(this.tabs[tab]));
-                if(tabContentElement && tabContentElement.parentNode.id != this.destElementId){
-                    $(this.destElementId).appendChild(tabContentElement);
-                    tabContentElement.container = this;
-                    tabContentElement.statusBar = this.tabs[tab];
-                    tabContentElement.tabObject  = this.tabs[tab];
-                    this.tabs[tab].contentMoved = true;
-                    this.tabs[tab].container = this;
-                    this.tabs[tab].show = function(){
-                        this.container.showTabContent(this);
-                    }
-                    if(varienGlobalEvents){
-                        varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
+            this.tabs = $$('#'+this.containerId+' li a.tab-item-link');
+
+            this.hideAllTabsContent();
+            for (var tab=0; tab<this.tabs.length; tab++) {
+                Event.observe(this.tabs[tab],'click',this.tabOnClick);
+                // move tab contents to destination element
+                if($(this.destElementId)){
+                    var tabContentElement = $(this.getTabContentElementId(this.tabs[tab]));
+                    if(tabContentElement && tabContentElement.parentNode.id != this.destElementId){
+                        $(this.destElementId).appendChild(tabContentElement);
+                        tabContentElement.container = this;
+                        tabContentElement.statusBar = this.tabs[tab];
+                        tabContentElement.tabObject  = this.tabs[tab];
+                        this.tabs[tab].contentMoved = true;
+                        this.tabs[tab].container = this;
+                        this.tabs[tab].show = function(){
+                            this.container.showTabContent(this);
+                        }
+                        if(varienGlobalEvents){
+                            varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
+                        }
                     }
                 }
+    /*
+                // this code is pretty slow in IE, so lets do it in tabs*.phtml
+                // mark ajax tabs as not loaded
+                if (Element.hasClassName($(this.tabs[tab].id), 'ajax')) {
+                    Element.addClassName($(this.tabs[tab].id), 'notloaded');
+                }
+    */
+                // bind shadow tabs
+                if (this.tabs[tab].id && shadowTabs && shadowTabs[this.tabs[tab].id]) {
+                    this.tabs[tab].shadowTabs = shadowTabs[this.tabs[tab].id];
+                }
             }
-/*
-            // this code is pretty slow in IE, so lets do it in tabs*.phtml
-            // mark ajax tabs as not loaded
-            if (Element.hasClassName($(this.tabs[tab].id), 'ajax')) {
-                Element.addClassName($(this.tabs[tab].id), 'notloaded');
-            }
-*/
-            // bind shadow tabs
-            if (this.tabs[tab].id && shadowTabs && shadowTabs[this.tabs[tab].id]) {
-                this.tabs[tab].shadowTabs = shadowTabs[this.tabs[tab].id];
-            }
-        }
 
-        this.displayFirst = activeTabId;
-        Event.observe(window,'load',this.moveTabContentInDest.bind(this));
-        Event.observe(window,'load',this.bindOnbeforeSubmit.bind(this));
-        Event.observe(window,'load',this.bindOnInvalid.bind(this));
-    },
+            this.displayFirst = activeTabId;
+            Event.observe(window,'load',this.moveTabContentInDest.bind(this));
+            Event.observe(window,'load',this.bindOnbeforeSubmit.bind(this));
+            Event.observe(window,'load',this.bindOnInvalid.bind(this));
+        },
 
-    bindOnInvalid: function() {
-        jQuery.each(this.tabs, jQuery.proxy(function(i, tab) {
-            jQuery('#' + this.getTabContentElementId(tab))
-                .on('highlight.validate', function() {
-                    jQuery(tab).addClass('error').find('.error').show();
-                })
-                .on('focusin', jQuery.proxy(function() {
-                    this.showTabContentImmediately(tab);
-                }, this));
-        }, this));
-    },
+        bindOnInvalid: function() {
+            jQuery.each(this.tabs, jQuery.proxy(function(i, tab) {
+                jQuery('#' + this.getTabContentElementId(tab))
+                    .on('highlight.validate', function() {
+                        jQuery(tab).addClass('error').find('.error').show();
+                    })
+                    .on('focusin', jQuery.proxy(function() {
+                        this.showTabContentImmediately(tab);
+                    }, this));
+            }, this));
+        },
 
-    bindOnbeforeSubmit: function() {
-        jQuery('#' + this.destElementId).on('beforeSubmit', jQuery.proxy(function(e, data) {
-            var tabsIdValue = this.activeTab.id;
-            if (this.tabsBlockPrefix) {
-                if (this.activeTab.id.startsWith(this.tabsBlockPrefix)) {
-                    tabsIdValue = tabsIdValue.substr(this.tabsBlockPrefix.length);
+        bindOnbeforeSubmit: function() {
+            jQuery('#' + this.destElementId).on('beforeSubmit', jQuery.proxy(function(e, data) {
+                var tabsIdValue = this.activeTab.id;
+                if (this.tabsBlockPrefix) {
+                    if (this.activeTab.id.startsWith(this.tabsBlockPrefix)) {
+                        tabsIdValue = tabsIdValue.substr(this.tabsBlockPrefix.length);
+                    }
                 }
-            }
-            jQuery(this.tabs).removeClass('error');
-            var options = {action: {args: {}}};
-            options.action.args[this.tabIdArgument || 'tab'] = tabsIdValue;
-            data = data ? jQuery.extend(data, options) : options;
-        }, this));
-    },
+                jQuery(this.tabs).removeClass('error');
+                var options = {action: {args: {}}};
+                options.action.args[this.tabIdArgument || 'tab'] = tabsIdValue;
+                data = data ? jQuery.extend(data, options) : options;
+            }, this));
+        },
 
-    setSkipDisplayFirstTab : function(){
-        this.displayFirst = null;
-    },
+        setSkipDisplayFirstTab : function(){
+            this.displayFirst = null;
+        },
 
-    moveTabContentInDest : function(){
-        for(var tab=0; tab<this.tabs.length; tab++){
-            if($(this.destElementId) &&  !this.tabs[tab].contentMoved){
-                var tabContentElement = $(this.getTabContentElementId(this.tabs[tab]));
-                if(tabContentElement && tabContentElement.parentNode.id != this.destElementId){
-                    $(this.destElementId).appendChild(tabContentElement);
-                    tabContentElement.container = this;
-                    tabContentElement.statusBar = this.tabs[tab];
-                    tabContentElement.tabObject  = this.tabs[tab];
-                    this.tabs[tab].container = this;
-                    this.tabs[tab].show = function(){
-                        this.container.showTabContent(this);
-                    }
-                    if(varienGlobalEvents){
-                        varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
+        moveTabContentInDest : function(){
+            for(var tab=0; tab<this.tabs.length; tab++){
+                if($(this.destElementId) &&  !this.tabs[tab].contentMoved){
+                    var tabContentElement = $(this.getTabContentElementId(this.tabs[tab]));
+                    if(tabContentElement && tabContentElement.parentNode.id != this.destElementId){
+                        $(this.destElementId).appendChild(tabContentElement);
+                        tabContentElement.container = this;
+                        tabContentElement.statusBar = this.tabs[tab];
+                        tabContentElement.tabObject  = this.tabs[tab];
+                        this.tabs[tab].container = this;
+                        this.tabs[tab].show = function(){
+                            this.container.showTabContent(this);
+                        }
+                        if(varienGlobalEvents){
+                            varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]});
+                        }
                     }
                 }
             }
-        }
-        if (this.displayFirst) {
-            this.showTabContent($(this.displayFirst));
-            this.displayFirst = null;
-        }
-    },
+            if (this.displayFirst) {
+                this.showTabContent($(this.displayFirst));
+                this.displayFirst = null;
+            }
+        },
 
-    getTabContentElementId : function(tab){
-        if(tab){
-            return tab.id+'_content';
-        }
-        return false;
-    },
+        getTabContentElementId : function(tab){
+            if(tab){
+                return tab.id+'_content';
+            }
+            return false;
+        },
 
-    tabMouseClick : function(event) {
-        var tab = Event.findElement(event, 'a');
+        tabMouseClick : function(event) {
+            var tab = Event.findElement(event, 'a');
 
-        // go directly to specified url or switch tab
-        if ((tab.href.indexOf('#') != tab.href.length-1)
-            && !(Element.hasClassName(tab, 'ajax'))
-        ) {
-            location.href = tab.href;
-        }
-        else {
-            this.showTabContent(tab);
-        }
-        Event.stop(event);
-    },
+            // go directly to specified url or switch tab
+            if ((tab.href.indexOf('#') != tab.href.length-1)
+                && !(Element.hasClassName(tab, 'ajax'))
+            ) {
+                location.href = tab.href;
+            }
+            else {
+                this.showTabContent(tab);
+            }
+            Event.stop(event);
+        },
 
-    hideAllTabsContent : function(){
-        for(var tab in this.tabs){
-            this.hideTabContent(this.tabs[tab]);
-        }
-    },
+        hideAllTabsContent : function(){
+            for(var tab in this.tabs){
+                this.hideTabContent(this.tabs[tab]);
+            }
+        },
 
-    // show tab, ready or not
-    showTabContentImmediately : function(tab) {
-        this.hideAllTabsContent();
-        var tabContentElement = $(this.getTabContentElementId(tab));
-        if (tabContentElement) {
-            Element.show(tabContentElement);
-            Element.addClassName(tab, 'active');
-            // load shadow tabs, if any
-            if (tab.shadowTabs && tab.shadowTabs.length) {
-                for (var k in tab.shadowTabs) {
-                    this.loadShadowTab($(tab.shadowTabs[k]));
+        // show tab, ready or not
+        showTabContentImmediately : function(tab) {
+            this.hideAllTabsContent();
+            var tabContentElement = $(this.getTabContentElementId(tab));
+            if (tabContentElement) {
+                Element.show(tabContentElement);
+                Element.addClassName(tab, 'active');
+                // load shadow tabs, if any
+                if (tab.shadowTabs && tab.shadowTabs.length) {
+                    for (var k in tab.shadowTabs) {
+                        this.loadShadowTab($(tab.shadowTabs[k]));
+                    }
+                }
+                if (!Element.hasClassName(tab, 'ajax only')) {
+                    Element.removeClassName(tab, 'notloaded');
                 }
+                this.activeTab = tab;
             }
-            if (!Element.hasClassName(tab, 'ajax only')) {
-                Element.removeClassName(tab, 'notloaded');
+            if (varienGlobalEvents) {
+                varienGlobalEvents.fireEvent('showTab', {tab:tab});
             }
-            this.activeTab = tab;
-        }
-        if (varienGlobalEvents) {
-            varienGlobalEvents.fireEvent('showTab', {tab:tab});
-        }
-    },
+        },
 
-    // the lazy show tab method
-    showTabContent : function(tab) {
-        var tabContentElement = $(this.getTabContentElementId(tab));
-        if (tabContentElement) {
-            if (this.activeTab != tab) {
-                if (varienGlobalEvents) {
-                    var defaultTab = this.tabs[0];
-                    var eventData = {
-                        from: this.activeTab ? this.activeTab.getAttribute('id') : null,
-                        to: tab ? tab.getAttribute('id') : null,
-                        first: defaultTab && tab && tab.getAttribute('id') == defaultTab.getAttribute('id')
-                    };
-                    if (varienGlobalEvents.fireEvent('tabChangeBefore', eventData) === false) {
-                        return;
-                    };
+        // the lazy show tab method
+        showTabContent : function(tab) {
+            var tabContentElement = $(this.getTabContentElementId(tab));
+            if (tabContentElement) {
+                if (this.activeTab != tab) {
+                    if (varienGlobalEvents) {
+                        var defaultTab = this.tabs[0];
+                        var eventData = {
+                            from: this.activeTab ? this.activeTab.getAttribute('id') : null,
+                            to: tab ? tab.getAttribute('id') : null,
+                            first: defaultTab && tab && tab.getAttribute('id') == defaultTab.getAttribute('id')
+                        };
+                        if (varienGlobalEvents.fireEvent('tabChangeBefore', eventData) === false) {
+                            return;
+                        };
+                    }
+                }
+                // wait for ajax request, if defined
+                var isAjax = Element.hasClassName(tab, 'ajax');
+                var isEmpty = tabContentElement.innerHTML=='' && tab.href.indexOf('#')!=tab.href.length-1;
+                var isNotLoaded = Element.hasClassName(tab, 'notloaded');
+
+                if ( isAjax && (isEmpty || isNotLoaded) )
+                {
+                    new Ajax.Request(tab.href, {
+                        parameters: {form_key: FORM_KEY},
+                        evalScripts: true,
+                        onSuccess: function(transport) {
+                            try {
+                                if (transport.responseText.isJSON()) {
+                                    var response = transport.responseText.evalJSON()
+                                    if (response.error) {
+                                        alert(response.message);
+                                    }
+                                    if(response.ajaxExpired && response.ajaxRedirect) {
+                                        setLocation(response.ajaxRedirect);
+                                    }
+                                } else {
+                                    $(tabContentElement.id).update(transport.responseText);
+                                    this.showTabContentImmediately(tab)
+                                }
+                            }
+                            catch (e) {
+                                $(tabContentElement.id).update(transport.responseText);
+                                this.showTabContentImmediately(tab)
+                            }
+                        }.bind(this)
+                    });
+                }
+                else {
+                    this.showTabContentImmediately(tab);
                 }
             }
-            // wait for ajax request, if defined
-            var isAjax = Element.hasClassName(tab, 'ajax');
-            var isEmpty = tabContentElement.innerHTML=='' && tab.href.indexOf('#')!=tab.href.length-1;
-            var isNotLoaded = Element.hasClassName(tab, 'notloaded');
+        },
 
-            if ( isAjax && (isEmpty || isNotLoaded) )
-            {
+        loadShadowTab : function(tab) {
+            var tabContentElement = $(this.getTabContentElementId(tab));
+            if (tabContentElement && Element.hasClassName(tab, 'ajax') && Element.hasClassName(tab, 'notloaded')) {
                 new Ajax.Request(tab.href, {
                     parameters: {form_key: FORM_KEY},
                     evalScripts: true,
@@ -218,64 +258,32 @@ varienTabs.prototype = {
                                 }
                             } else {
                                 $(tabContentElement.id).update(transport.responseText);
-                                this.showTabContentImmediately(tab)
+                                if (!Element.hasClassName(tab, 'ajax only')) {
+                                    Element.removeClassName(tab, 'notloaded');
+                                }
                             }
                         }
                         catch (e) {
                             $(tabContentElement.id).update(transport.responseText);
-                            this.showTabContentImmediately(tab)
+                            if (!Element.hasClassName(tab, 'ajax only')) {
+                                Element.removeClassName(tab, 'notloaded');
+                            }
                         }
                     }.bind(this)
                 });
             }
-            else {
-                this.showTabContentImmediately(tab);
-            }
-        }
-    },
+        },
 
-    loadShadowTab : function(tab) {
-        var tabContentElement = $(this.getTabContentElementId(tab));
-        if (tabContentElement && Element.hasClassName(tab, 'ajax') && Element.hasClassName(tab, 'notloaded')) {
-            new Ajax.Request(tab.href, {
-                parameters: {form_key: FORM_KEY},
-                evalScripts: true,
-                onSuccess: function(transport) {
-                    try {
-                        if (transport.responseText.isJSON()) {
-                            var response = transport.responseText.evalJSON()
-                            if (response.error) {
-                                alert(response.message);
-                            }
-                            if(response.ajaxExpired && response.ajaxRedirect) {
-                                setLocation(response.ajaxRedirect);
-                            }
-                        } else {
-                            $(tabContentElement.id).update(transport.responseText);
-                            if (!Element.hasClassName(tab, 'ajax only')) {
-                                Element.removeClassName(tab, 'notloaded');
-                            }
-                        }
-                    }
-                    catch (e) {
-                        $(tabContentElement.id).update(transport.responseText);
-                        if (!Element.hasClassName(tab, 'ajax only')) {
-                            Element.removeClassName(tab, 'notloaded');
-                        }
-                    }
-                }.bind(this)
-            });
+        hideTabContent : function(tab){
+            var tabContentElement = $(this.getTabContentElementId(tab));
+            if($(this.destElementId) && tabContentElement){
+               Element.hide(tabContentElement);
+               Element.removeClassName(tab, 'active');
+            }
+            if(varienGlobalEvents){
+                varienGlobalEvents.fireEvent('hideTab', {tab:tab});
+            }
         }
-    },
+    };
 
-    hideTabContent : function(tab){
-        var tabContentElement = $(this.getTabContentElementId(tab));
-        if($(this.destElementId) && tabContentElement){
-           Element.hide(tabContentElement);
-           Element.removeClassName(tab, 'active');
-        }
-        if(varienGlobalEvents){
-            varienGlobalEvents.fireEvent('hideTab', {tab:tab});
-        }
-    }
-};
+});
\ No newline at end of file
diff --git a/lib/web/mage/adminhtml/tools.js b/lib/web/mage/adminhtml/tools.js
index b13a990dbf984d12828c7eb04da530b5d4cd1694..8a969fb42712079f09538e2cdb210e318a63a142 100644
--- a/lib/web/mage/adminhtml/tools.js
+++ b/lib/web/mage/adminhtml/tools.js
@@ -185,22 +185,6 @@ function submitAndReloadArea(area, url) {
 }
 
 /********** MESSAGES ***********/
-/*
-Event.observe(window, 'load', function() {
-    $$('.messages .error-msg').each(function(el) {
-        new Effect.Highlight(el, {startcolor:'#E13422', endcolor:'#fdf9f8', duration:1});
-    });
-    $$('.messages .warning-msg').each(function(el) {
-        new Effect.Highlight(el, {startcolor:'#E13422', endcolor:'#fdf9f8', duration:1});
-    });
-    $$('.messages .notice-msg').each(function(el) {
-        new Effect.Highlight(el, {startcolor:'#E5B82C', endcolor:'#fbf7e9', duration:1});
-    });
-    $$('.messages .success-msg').each(function(el) {
-        new Effect.Highlight(el, {startcolor:'#507477', endcolor:'#f2fafb', duration:1});
-    });
-});
-*/
 function syncOnchangeValue(baseElem, distElem){
     var compare = {baseElem:baseElem, distElem:distElem}
     Event.observe(baseElem, 'change', function(){
@@ -363,6 +347,10 @@ var Base64 = {
         var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
         var i = 0;
 
+        if( typeof window.btoa === "function" ){
+            return window.btoa(input);
+        }
+
         input = Base64._utf8_encode(input);
 
         while (i < input.length) {
@@ -396,6 +384,10 @@ var Base64 = {
         var enc1, enc2, enc3, enc4;
         var i = 0;
 
+        if( typeof window.atob === "function" ){
+            return window.atob(input);
+        }
+
         input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
         while (i < input.length) {
diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
index 9a7c41e5c99821f4f5100a887dc92594f5568f68..f9b00e891277456a761616caee683de5a04f700e 100644
--- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
+++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
@@ -20,346 +20,356 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+define([
+    'jquery',
+    'mage/translate',
+    'prototype',
+    'mage/adminhtml/events',
+    'mage/adminhtml/browser'
+], function(jQuery){
 
-var tinyMceWysiwygSetup = Class.create();
-tinyMceWysiwygSetup.prototype =
-{
-    mediaBrowserOpener: null,
-    mediaBrowserTargetElementId: null,
+    tinyMceWysiwygSetup = Class.create();
 
-    initialize: function(htmlId, config)
+    tinyMceWysiwygSetup.prototype =
     {
-        this.id = htmlId;
-        this.config = config;
-        varienGlobalEvents.attachEventHandler('tinymceChange', this.onChangeContent.bind(this));
-        this.notifyFirebug();
-        if(typeof tinyMceEditors == 'undefined') {
-            tinyMceEditors = $H({});
-        }
-        tinyMceEditors.set(this.id, this);
-    },
-
-    notifyFirebug: function() {
-        if (firebugEnabled() && $('fb' + this.id) == undefined) {
-            var noticeHtml = '<div class="messages message-firebug" id="fb' + this.id + '"><div class="message notice">';
-                noticeHtml+= '<div>';
-                noticeHtml+= '<b>' + this.config.firebug_warning_title + ':</b> ';
-                noticeHtml+= this.config.firebug_warning_text;
-                noticeHtml+= ' <a id="hidefb' + this.id + '" href="">' + this.config.firebug_warning_anchor + '</a>';
-                noticeHtml+= '</div>';
-                noticeHtml+= '</div></div>';
-            $('buttons' + this.id).insert({before: noticeHtml});
-            Event.observe($('hidefb' + this.id), "click", function(e) {
-                $('fb' + this.id).remove();
-                Event.stop(e);
-            }.bind(this));
-        }
-    },
-
-    setup: function(mode)
-    {
-        if (this.config.widget_plugin_src) {
-            tinymce.PluginManager.load('magentowidget', this.config.widget_plugin_src);
-        }
-
-        if (this.config.plugins) {
-            (this.config.plugins).each(function(plugin){
-                tinymce.PluginManager.load(plugin.name, plugin.src);
-            });
-        }
-
-        tinyMCE.init(this.getSettings(mode));
-    },
-
-    getSettings: function(mode)
-    {
-        var plugins = 'inlinepopups,safari,pagebreak,style,layer,table,advhr,advimage,emotions,iespell,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras';
-
-        if (this.config.widget_plugin_src) {
-            plugins = 'magentowidget,' + plugins;
-        }
-
-        var magentoPluginsOptions = $H({});
-        var magentoPlugins = '';
-
-        if (this.config.plugins) {
-            (this.config.plugins).each(function(plugin){
-                magentoPlugins = plugin.name + ',' + magentoPlugins;
-                magentoPluginsOptions.set(plugin.name, plugin.options);
-            });
-            if (magentoPlugins) {
-                plugins = '-' + magentoPlugins + plugins;
+        mediaBrowserOpener: null,
+        mediaBrowserTargetElementId: null,
+
+        initialize: function(htmlId, config)
+        {
+            this.id = htmlId;
+            this.config = config;
+            varienGlobalEvents.attachEventHandler('tinymceChange', this.onChangeContent.bind(this));
+            this.notifyFirebug();
+            if(typeof tinyMceEditors == 'undefined') {
+                tinyMceEditors = $H({});
             }
-        }
+            tinyMceEditors.set(this.id, this);
+        },
+
+        notifyFirebug: function() {
+            if (firebugEnabled() && $('fb' + this.id) == undefined) {
+                var noticeHtml = '<div class="messages message-firebug" id="fb' + this.id + '"><div class="message notice">';
+                    noticeHtml+= '<div>';
+                    noticeHtml+= '<b>' + this.config.firebug_warning_title + ':</b> ';
+                    noticeHtml+= this.config.firebug_warning_text;
+                    noticeHtml+= ' <a id="hidefb' + this.id + '" href="">' + this.config.firebug_warning_anchor + '</a>';
+                    noticeHtml+= '</div>';
+                    noticeHtml+= '</div></div>';
+                $('buttons' + this.id).insert({before: noticeHtml});
+                Event.observe($('hidefb' + this.id), "click", function(e) {
+                    $('fb' + this.id).remove();
+                    Event.stop(e);
+                }.bind(this));
+            }
+        },
 
-        var settings = {
-            mode : (mode != undefined ? mode : 'none'),
-            elements : this.id,
-            theme : 'advanced',
-            plugins : plugins,
-            theme_advanced_buttons1 : magentoPlugins + 'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
-            theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
-            theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
-            theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
-            theme_advanced_toolbar_location : 'top',
-            theme_advanced_toolbar_align : 'left',
-            theme_advanced_statusbar_location : 'bottom',
-            theme_advanced_resizing : true,
-            theme_advanced_resize_horizontal : false,
-            convert_urls : false,
-            relative_urls : false,
-            content_css: this.config.content_css,
-            custom_popup_css: this.config.popup_css,
-            magentowidget_url: this.config.widget_window_url,
-            magentoPluginsOptions: magentoPluginsOptions,
-            doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
-
-            setup : function(ed) {
-                ed.onSubmit.add(function(ed, e) {
-                    varienGlobalEvents.fireEvent('tinymceSubmit', e);
-                });
+        setup: function(mode)
+        {
+            if (this.config.widget_plugin_src) {
+                tinymce.PluginManager.load('magentowidget', this.config.widget_plugin_src);
+            }
 
-                ed.onPaste.add(function(ed, e, o) {
-                    varienGlobalEvents.fireEvent('tinymcePaste', o);
+            if (this.config.plugins) {
+                (this.config.plugins).each(function(plugin){
+                    tinymce.PluginManager.load(plugin.name, plugin.src);
                 });
+            }
 
-                ed.onBeforeSetContent.add(function(ed, o) {
-                    varienGlobalEvents.fireEvent('tinymceBeforeSetContent', o);
-                });
+            tinyMCE.init(this.getSettings(mode));
+        },
 
-                ed.onSetContent.add(function(ed, o) {
-                    varienGlobalEvents.fireEvent('tinymceSetContent', o);
-                });
+        getSettings: function(mode)
+        {
+            var plugins = 'inlinepopups,safari,pagebreak,style,layer,table,advhr,advimage,emotions,iespell,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras';
 
-                ed.onSaveContent.add(function(ed, o) {
-                    varienGlobalEvents.fireEvent('tinymceSaveContent', o);
-                });
+            if (this.config.widget_plugin_src) {
+                plugins = 'magentowidget,' + plugins;
+            }
 
-                ed.onChange.add(function(ed, l) {
-                    varienGlobalEvents.fireEvent('tinymceChange', l);
-                });
+            var magentoPluginsOptions = $H({});
+            var magentoPlugins = '';
 
-                ed.onExecCommand.add(function(ed, cmd, ui, val) {
-                    varienGlobalEvents.fireEvent('tinymceExecCommand', cmd);
+            if (this.config.plugins) {
+                (this.config.plugins).each(function(plugin){
+                    magentoPlugins = plugin.name + ',' + magentoPlugins;
+                    magentoPluginsOptions.set(plugin.name, plugin.options);
                 });
+                if (magentoPlugins) {
+                    plugins = '-' + magentoPlugins + plugins;
+                }
             }
-        };
-
-        // Set the document base URL
-        if (this.config.document_base_url) {
-            settings.document_base_url = this.config.document_base_url;
-        }
 
-        if (this.config.files_browser_window_url) {
-            settings.file_browser_callback = function(fieldName, url, objectType, w) {
-                varienGlobalEvents.fireEvent("open_browser_callback", {win:w, type:objectType, field:fieldName});
+            var settings = {
+                mode : (mode != undefined ? mode : 'none'),
+                elements : this.id,
+                theme : 'advanced',
+                plugins : plugins,
+                theme_advanced_buttons1 : magentoPlugins + 'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
+                theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
+                theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
+                theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
+                theme_advanced_toolbar_location : 'top',
+                theme_advanced_toolbar_align : 'left',
+                theme_advanced_statusbar_location : 'bottom',
+                theme_advanced_resizing : true,
+                theme_advanced_resize_horizontal : false,
+                convert_urls : false,
+                relative_urls : false,
+                content_css: this.config.content_css,
+                custom_popup_css: this.config.popup_css,
+                magentowidget_url: this.config.widget_window_url,
+                magentoPluginsOptions: magentoPluginsOptions,
+                doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
+
+                setup : function(ed) {
+                    ed.onSubmit.add(function(ed, e) {
+                        varienGlobalEvents.fireEvent('tinymceSubmit', e);
+                    });
+
+                    ed.onPaste.add(function(ed, e, o) {
+                        varienGlobalEvents.fireEvent('tinymcePaste', o);
+                    });
+
+                    ed.onBeforeSetContent.add(function(ed, o) {
+                        varienGlobalEvents.fireEvent('tinymceBeforeSetContent', o);
+                    });
+
+                    ed.onSetContent.add(function(ed, o) {
+                        varienGlobalEvents.fireEvent('tinymceSetContent', o);
+                    });
+
+                    ed.onSaveContent.add(function(ed, o) {
+                        varienGlobalEvents.fireEvent('tinymceSaveContent', o);
+                    });
+
+                    ed.onChange.add(function(ed, l) {
+                        varienGlobalEvents.fireEvent('tinymceChange', l);
+                    });
+
+                    ed.onExecCommand.add(function(ed, cmd, ui, val) {
+                        varienGlobalEvents.fireEvent('tinymceExecCommand', cmd);
+                    });
+                }
             };
-        }
 
-        if (this.config.width) {
-            settings.width = this.config.width;
-        }
+            // Set the document base URL
+            if (this.config.document_base_url) {
+                settings.document_base_url = this.config.document_base_url;
+            }
 
-        if (this.config.height) {
-            settings.height = this.config.height;
-        }
+            if (this.config.files_browser_window_url) {
+                settings.file_browser_callback = function(fieldName, url, objectType, w) {
+                    varienGlobalEvents.fireEvent("open_browser_callback", {win:w, type:objectType, field:fieldName});
+                };
+            }
 
-        if (this.config.settings) {
-            Object.extend(settings, this.config.settings)
-        }
+            if (this.config.width) {
+                settings.width = this.config.width;
+            }
 
-        return settings;
-    },
+            if (this.config.height) {
+                settings.height = this.config.height;
+            }
 
-    openFileBrowser: function(o) {
-        var typeTitle;
-        var storeId = this.config.store_id !== null ? this.config.store_id : 0;
-        var wUrl = this.config.files_browser_window_url +
-                   'target_element_id/' + this.id + '/' +
-                   'store/' + storeId + '/';
+            if (this.config.settings) {
+                Object.extend(settings, this.config.settings)
+            }
 
-        this.mediaBrowserOpener = o.win;
-        this.mediaBrowserTargetElementId = o.field;
+            return settings;
+        },
 
-        if (typeof(o.type) != 'undefined' && o.type != "") {
-            typeTitle = 'image' == o.type ? this.translate('Insert Image...') : this.translate('Insert Media...');
-            wUrl = wUrl + "type/" + o.type + "/";
-        } else {
-            typeTitle = this.translate('Insert File...');
-        }
+        openFileBrowser: function(o) {
+            var typeTitle;
+            var storeId = this.config.store_id !== null ? this.config.store_id : 0;
+            var wUrl = this.config.files_browser_window_url +
+                       'target_element_id/' + this.id + '/' +
+                       'store/' + storeId + '/';
+
+            this.mediaBrowserOpener = o.win;
+            this.mediaBrowserTargetElementId = o.field;
 
-        MediabrowserUtility.openDialog(wUrl, false, false, typeTitle, {
-            onBeforeShow: function(win) {
-                win.element.setStyle({zIndex: 1100});
+            if (typeof(o.type) != 'undefined' && o.type != "") {
+                typeTitle = 'image' == o.type ? this.translate('Insert Image...') : this.translate('Insert Media...');
+                wUrl = wUrl + "type/" + o.type + "/";
+            } else {
+                typeTitle = this.translate('Insert File...');
             }
-        });
-    },
-
-    translate: function(string) {
-        return jQuery.mage.__ ? jQuery.mage.__(string) : string;
-    },
-
-    getMediaBrowserOpener: function() {
-        return this.mediaBrowserOpener;
-    },
-
-    getMediaBrowserTargetElementId: function() {
-        return this.mediaBrowserTargetElementId;
-    },
-
-    getToggleButton: function() {
-        return $('toggle' + this.id);
-    },
-
-    getPluginButtons: function() {
-        return $$('#buttons' + this.id + ' > button.plugin');
-    },
-
-    turnOn: function(mode) {
-        this.closePopups();
-        this.setup(mode);
-        tinyMCE.execCommand('mceAddControl', false, this.id);
-        this.getPluginButtons().each(function(e) {
-            e.hide();
-        });
-        return this;
-    },
-
-    turnOff: function() {
-        this.closePopups();
-        tinyMCE.execCommand('mceRemoveControl', false, this.id);
-        this.getPluginButtons().each(function(e) {
-            e.show();
-        });
-        if (Prototype.Browser.IE) {
-            // workaround for IE textarea redraw bug
-            window.setTimeout(function() {
-                if ($(this.id)) {
-                    $(this.id).value = $(this.id).value;
+
+            MediabrowserUtility.openDialog(wUrl, false, false, typeTitle, {
+                onBeforeShow: function(win) {
+                    win.element.setStyle({zIndex: 1100});
                 }
-            }.bind(this), 0);
-        }
-        return this;
-    },
-
-    closePopups: function() {
-        if (typeof closeEditorPopup == 'function') {
-            // close all popups to avoid problems with updating parent content area
-            closeEditorPopup('widget_window' + this.id);
-            closeEditorPopup('browser_window' + this.id);
-        }
-    },
-
-    toggle: function() {
-        if (!tinyMCE.get(this.id)) {
-            this.turnOn();
-            return true;
-        } else {
-            this.turnOff();
-            return false;
-        }
-    },
+            });
+        },
+
+        translate: function(string) {
+            return jQuery.mage.__ ? jQuery.mage.__(string) : string;
+        },
+
+        getMediaBrowserOpener: function() {
+            return this.mediaBrowserOpener;
+        },
+
+        getMediaBrowserTargetElementId: function() {
+            return this.mediaBrowserTargetElementId;
+        },
+
+        getToggleButton: function() {
+            return $('toggle' + this.id);
+        },
+
+        getPluginButtons: function() {
+            return $$('#buttons' + this.id + ' > button.plugin');
+        },
+
+        turnOn: function(mode) {
+            this.closePopups();
+            this.setup(mode);
+            tinyMCE.execCommand('mceAddControl', false, this.id);
+            this.getPluginButtons().each(function(e) {
+                e.hide();
+            });
+            return this;
+        },
+
+        turnOff: function() {
+            this.closePopups();
+            tinyMCE.execCommand('mceRemoveControl', false, this.id);
+            this.getPluginButtons().each(function(e) {
+                e.show();
+            });
+            if (Prototype.Browser.IE) {
+                // workaround for IE textarea redraw bug
+                window.setTimeout(function() {
+                    if ($(this.id)) {
+                        $(this.id).value = $(this.id).value;
+                    }
+                }.bind(this), 0);
+            }
+            return this;
+        },
+
+        closePopups: function() {
+            if (typeof closeEditorPopup == 'function') {
+                // close all popups to avoid problems with updating parent content area
+                closeEditorPopup('widget_window' + this.id);
+                closeEditorPopup('browser_window' + this.id);
+            }
+        },
+
+        toggle: function() {
+            if (!tinyMCE.get(this.id)) {
+                this.turnOn();
+                return true;
+            } else {
+                this.turnOff();
+                return false;
+            }
+        },
 
-    onFormValidation: function() {
-        if (tinyMCE.get(this.id)) {
-            $(this.id).value = tinyMCE.get(this.id).getContent();
-        }
-    },
+        onFormValidation: function() {
+            if (tinyMCE.get(this.id)) {
+                $(this.id).value = tinyMCE.get(this.id).getContent();
+            }
+        },
 
-    onChangeContent: function() {
-        // Add "changed" to tab class if it exists
-        if (tinyMCE.get(this.id)) {
-            jQuery('#' + this.id).val(tinyMCE.get(this.id).getContent()).trigger('change');
-        }
-        if(this.config.tab_id) {
-            var tab = $$('a[id$=' + this.config.tab_id + ']')[0];
-            if ($(tab) != undefined && $(tab).hasClassName('tab-item-link')) {
-                $(tab).addClassName('changed');
+        onChangeContent: function() {
+            // Add "changed" to tab class if it exists
+            if (tinyMCE.get(this.id)) {
+                jQuery('#' + this.id).val(tinyMCE.get(this.id).getContent()).trigger('change');
             }
-        }
-    },
-
-    // retrieve directives URL with substituted directive value
-    makeDirectiveUrl: function(directive) {
-        return this.config.directives_url.replace('directive', 'directive/___directive/' + directive);
-    },
-
-    encodeDirectives: function(content) {
-        // collect all HTML tags with attributes that contain directives
-        return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".+?)>/i, function(match) {
-            var attributesString = match[2];
-            // process tag attributes string
-            attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function(m) {
-                return m[1] + '="' + m[2] + this.makeDirectiveUrl(Base64.mageEncode(m[3])) + m[4] + '"';
-            }.bind(this));
+            if(this.config.tab_id) {
+                var tab = $$('a[id$=' + this.config.tab_id + ']')[0];
+                if ($(tab) != undefined && $(tab).hasClassName('tab-item-link')) {
+                    $(tab).addClassName('changed');
+                }
+            }
+        },
 
-            return '<' + match[1] + attributesString + '>';
+        // retrieve directives URL with substituted directive value
+        makeDirectiveUrl: function(directive) {
+            return this.config.directives_url.replace('directive', 'directive/___directive/' + directive);
+        },
 
-        }.bind(this));
-    },
+        encodeDirectives: function(content) {
+            // collect all HTML tags with attributes that contain directives
+            return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".+?)>/i, function(match) {
+                var attributesString = match[2];
+                // process tag attributes string
+                attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function(m) {
+                    return m[1] + '="' + m[2] + this.makeDirectiveUrl(Base64.mageEncode(m[3])) + m[4] + '"';
+                }.bind(this));
 
-    encodeWidgets: function(content) {
-        return content.gsub(/\{\{widget(.*?)\}\}/i, function(match){
-            var attributes = this.parseAttributesString(match[1]);
-            if (attributes.type) {
-                var imageSrc = this.config.widget_placeholders[attributes.type];
-                var imageHtml = '<img';
-                    imageHtml+= ' id="' + Base64.idEncode(match[0]) + '"';
-                    imageHtml+= ' src="' + imageSrc + '"';
-                    imageHtml+= ' title="' + match[0].replace(/\{\{/g, '{').replace(/\}\}/g, '}').replace(/\"/g, '&quot;') + '"';
-                    imageHtml+= '>';
+                return '<' + match[1] + attributesString + '>';
 
-                return imageHtml;
-            }
-        }.bind(this));
-    },
-
-    decodeDirectives: function(content) {
-        // escape special chars in directives url to use it in regular expression
-        var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1');
-        var reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+)'));
-        return content.gsub(reg, function(match) {
-            return Base64.mageDecode(match[1]);
-        }.bind(this));
-    },
-
-    decodeWidgets: function(content) {
-        return content.gsub(/<img([^>]+id=\"[^>]+)>/i, function(match) {
-            var attributes = this.parseAttributesString(match[1]);
-            if(attributes.id) {
-                var widgetCode = Base64.idDecode(attributes.id);
-                if (widgetCode.indexOf('{{widget') != -1) {
-                    return widgetCode;
+            }.bind(this));
+        },
+
+        encodeWidgets: function(content) {
+            return content.gsub(/\{\{widget(.*?)\}\}/i, function(match){
+                var attributes = this.parseAttributesString(match[1]);
+                if (attributes.type) {
+                    var imageSrc = this.config.widget_placeholders[attributes.type];
+                    var imageHtml = '<img';
+                        imageHtml+= ' id="' + Base64.idEncode(match[0]) + '"';
+                        imageHtml+= ' src="' + imageSrc + '"';
+                        imageHtml+= ' title="' + match[0].replace(/\{\{/g, '{').replace(/\}\}/g, '}').replace(/\"/g, '&quot;') + '"';
+                        imageHtml+= '>';
+
+                    return imageHtml;
+                }
+            }.bind(this));
+        },
+
+        decodeDirectives: function(content) {
+            // escape special chars in directives url to use it in regular expression
+            var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1');
+            var reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+)'));
+            return content.gsub(reg, function(match) {
+                return Base64.mageDecode(match[1]);
+            }.bind(this));
+        },
+
+        decodeWidgets: function(content) {
+            return content.gsub(/<img([^>]+id=\"[^>]+)>/i, function(match) {
+                var attributes = this.parseAttributesString(match[1]);
+                if(attributes.id) {
+                    var widgetCode = Base64.idDecode(attributes.id);
+                    if (widgetCode.indexOf('{{widget') != -1) {
+                        return widgetCode;
+                    }
+                    return match[0];
                 }
                 return match[0];
+            }.bind(this));
+        },
+
+        parseAttributesString: function(attributes) {
+            var result = {};
+            attributes.gsub(/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/, function(match){
+                result[match[1]] = match[2];
+            });
+            return result;
+        },
+
+        beforeSetContent: function(o) {
+            if (this.config.add_widgets) {
+                o.content = this.encodeWidgets(o.content);
+                o.content = this.encodeDirectives(o.content);
+            } else if (this.config.add_directives) {
+                o.content = this.encodeDirectives(o.content);
+            }
+        },
+
+        saveContent: function(o) {
+            if (this.config.add_widgets) {
+                o.content = this.decodeWidgets(o.content);
+                o.content = this.decodeDirectives(o.content);
+            } else if (this.config.add_directives) {
+                o.content = this.decodeDirectives(o.content);
             }
-            return match[0];
-        }.bind(this));
-    },
-
-    parseAttributesString: function(attributes) {
-        var result = {};
-        attributes.gsub(/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/, function(match){
-            result[match[1]] = match[2];
-        });
-        return result;
-    },
-
-    beforeSetContent: function(o) {
-        if (this.config.add_widgets) {
-            o.content = this.encodeWidgets(o.content);
-            o.content = this.encodeDirectives(o.content);
-        } else if (this.config.add_directives) {
-            o.content = this.encodeDirectives(o.content);
-        }
-    },
-
-    saveContent: function(o) {
-        if (this.config.add_widgets) {
-            o.content = this.decodeWidgets(o.content);
-            o.content = this.decodeDirectives(o.content);
-        } else if (this.config.add_directives) {
-            o.content = this.decodeDirectives(o.content);
         }
-    }
-};
+    };
+
+});
diff --git a/lib/web/mage/adminhtml/wysiwyg/widget.js b/lib/web/mage/adminhtml/wysiwyg/widget.js
index c16436a23766db142eb9ee2f8aae8f7e8b449329..4d4d1cae6c03e0656fa7846eb14775c5fdfe11f1 100644
--- a/lib/web/mage/adminhtml/wysiwyg/widget.js
+++ b/lib/web/mage/adminhtml/wysiwyg/widget.js
@@ -21,400 +21,414 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-var widgetTools = {
-    getDivHtml: function(id, html) {
-        if (!html) html = '';
-        return '<div id="' + id + '">' + html + '</div>';
-    },
-
-    onAjaxSuccess: function(transport) {
-        if (transport.responseText.isJSON()) {
-            var response = transport.responseText.evalJSON()
-            if (response.error) {
-                throw response;
-            } else if (response.ajaxExpired && response.ajaxRedirect) {
-                setLocation(response.ajaxRedirect);
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/translate",
+    "mage/mage",
+    "mage/validation",
+    "mage/adminhtml/events",
+    "prototype"
+], function(jQuery){
+
+    var widgetTools = {
+        getDivHtml: function(id, html) {
+            if (!html) html = '';
+            return '<div id="' + id + '">' + html + '</div>';
+        },
+
+        onAjaxSuccess: function(transport) {
+            if (transport.responseText.isJSON()) {
+                var response = transport.responseText.evalJSON()
+                if (response.error) {
+                    throw response;
+                } else if (response.ajaxExpired && response.ajaxRedirect) {
+                    setLocation(response.ajaxRedirect);
+                }
             }
-        }
-    },
-
-    dialogOpened : false,
-
-    getMaxZIndex: function() {
-        var max = 0, i;
-        var cn = document.body.childNodes;
-        for (i = 0; i < cn.length; i++) {
-            var el = cn[i];
-            var zIndex = el.nodeType == 1 ? parseInt(el.style.zIndex, 10) || 0 : 0;
-            if (zIndex < 10000) {
-                max = Math.max(max, zIndex);
+        },
+
+        dialogOpened : false,
+
+        getMaxZIndex: function() {
+            var max = 0, i;
+            var cn = document.body.childNodes;
+            for (i = 0; i < cn.length; i++) {
+                var el = cn[i];
+                var zIndex = el.nodeType == 1 ? parseInt(el.style.zIndex, 10) || 0 : 0;
+                if (zIndex < 10000) {
+                    max = Math.max(max, zIndex);
+                }
             }
-        }
-        return max + 10;
-    },
+            return max + 10;
+        },
 
-    openDialog: function(widgetUrl) {
-        if (this.dialogOpened) {
-            return
-        }
-        var oThis = this;
-        this.dialogWindow = jQuery('<div/>').dialog({
-            autoOpen:   false,
-            title:      jQuery.mage.__('Insert Widget...'),
-            modal:      true,
-            resizable:  false,
-            width:      950,
-            zIndex:     this.getMaxZIndex(),
-            dialogClass: 'popup-window',
-            open: function () {
-                var dialog = jQuery(this).addClass('loading magento_message')
-                new Ajax.Updater($(this), widgetUrl, {evalScripts: true, onComplete: function () {
-                        dialog.removeClass('loading');
-                    }
-                });
-            },
-            close: function(event, ui) {
-                jQuery(this).dialog('destroy').remove();
-                oThis.dialogOpened = false;
+        openDialog: function(widgetUrl) {
+            if (this.dialogOpened) {
+                return
             }
-        });
-        this.dialogOpened = true;
-        this.dialogWindow.dialog('open');
-    }
-}
-
-var WysiwygWidget = {};
-WysiwygWidget.Widget = Class.create();
-WysiwygWidget.Widget.prototype = {
-
-    initialize: function(formEl, widgetEl, widgetOptionsEl, optionsSourceUrl, widgetTargetId) {
-        $(formEl).insert({bottom: widgetTools.getDivHtml(widgetOptionsEl)});
-        jQuery('#' + formEl).mage('validation', {
-            ignore: ".skip-submit",
-            errorClass: 'mage-error'
-        });
-        this.formEl = formEl;
-        this.widgetEl = $(widgetEl);
-        this.widgetOptionsEl = $(widgetOptionsEl);
-        this.optionsUrl = optionsSourceUrl;
-        this.optionValues = new Hash({});
-        this.widgetTargetId = widgetTargetId;
-        if (typeof(tinyMCE) != "undefined" && tinyMCE.activeEditor) {
-            this.bMark = tinyMCE.activeEditor.selection.getBookmark();
+            var oThis = this;
+            this.dialogWindow = jQuery('<div/>').dialog({
+                autoOpen:   false,
+                title:      jQuery.mage.__('Insert Widget...'),
+                modal:      true,
+                resizable:  false,
+                width:      950,
+                zIndex:     this.getMaxZIndex(),
+                dialogClass: 'popup-window',
+                open: function () {
+                    var dialog = jQuery(this).addClass('loading magento_message')
+                    new Ajax.Updater($(this), widgetUrl, {evalScripts: true, onComplete: function () {
+                            dialog.removeClass('loading');
+                        }
+                    });
+                },
+                close: function(event, ui) {
+                    jQuery(this).dialog('destroy').remove();
+                    oThis.dialogOpened = false;
+                }
+            });
+            this.dialogOpened = true;
+            this.dialogWindow.dialog('open');
         }
+    };
 
-        Event.observe(this.widgetEl, "change", this.loadOptions.bind(this));
+    var WysiwygWidget = {};
+    WysiwygWidget.Widget = Class.create();
+    WysiwygWidget.Widget.prototype = {
 
-        this.initOptionValues();
-    },
-
-    getOptionsContainerId: function() {
-        return this.widgetOptionsEl.id + '_' + this.widgetEl.value.gsub(/\//, '_');
-    },
-
-    switchOptionsContainer: function(containerId) {
-        $$('#' + this.widgetOptionsEl.id + ' div[id^=' + this.widgetOptionsEl.id + ']').each(function(e) {
-            this.disableOptionsContainer(e.id);
-        }.bind(this));
-        if(containerId != undefined) {
-            this.enableOptionsContainer(containerId);
-        }
-        this._showWidgetDescription();
-    },
-
-    enableOptionsContainer: function(containerId) {
-        $$('#' + containerId + ' .widget-option').each(function(e) {
-            e.removeClassName('skip-submit');
-            if (e.hasClassName('obligatory')) {
-                e.removeClassName('obligatory');
-                e.addClassName('required-entry');
+        initialize: function(formEl, widgetEl, widgetOptionsEl, optionsSourceUrl, widgetTargetId) {
+            $(formEl).insert({bottom: widgetTools.getDivHtml(widgetOptionsEl)});
+            jQuery('#' + formEl).mage('validation', {
+                ignore: ".skip-submit",
+                errorClass: 'mage-error'
+            });
+            this.formEl = formEl;
+            this.widgetEl = $(widgetEl);
+            this.widgetOptionsEl = $(widgetOptionsEl);
+            this.optionsUrl = optionsSourceUrl;
+            this.optionValues = new Hash({});
+            this.widgetTargetId = widgetTargetId;
+            if (typeof(tinyMCE) != "undefined" && tinyMCE.activeEditor) {
+                this.bMark = tinyMCE.activeEditor.selection.getBookmark();
             }
-        });
-        $(containerId).removeClassName('no-display');
-    },
 
-    disableOptionsContainer: function(containerId) {
-        if ($(containerId).hasClassName('no-display')) {
-            return;
-        }
-        $$('#' + containerId + ' .widget-option').each(function(e) {
-            // Avoid submitting fields of unactive container
-            if (!e.hasClassName('skip-submit')) {
-                e.addClassName('skip-submit');
-            }
-            // Form validation workaround for unactive container
-            if (e.hasClassName('required-entry')) {
-                e.removeClassName('required-entry');
-                e.addClassName('obligatory');
-            }
-        });
-        $(containerId).addClassName('no-display');
-    },
+            Event.observe(this.widgetEl, "change", this.loadOptions.bind(this));
 
-    // Assign widget options values when existing widget selected in WYSIWYG
-    initOptionValues: function() {
+            this.initOptionValues();
+        },
 
-        if (!this.wysiwygExists()) {
-            return false;
-        }
+        getOptionsContainerId: function() {
+            return this.widgetOptionsEl.id + '_' + this.widgetEl.value.gsub(/\//, '_');
+        },
 
-        var e = this.getWysiwygNode();
-        if (e != undefined && e.id) {
-            var widgetCode = Base64.idDecode(e.id);
-            if (widgetCode.indexOf('{{widget') != -1) {
-                this.optionValues = new Hash({});
-                widgetCode.gsub(/([a-z0-9\_]+)\s*\=\s*[\"]{1}([^\"]+)[\"]{1}/i, function(match){
-                    if (match[1] == 'type') {
-                        this.widgetEl.value = match[2];
-                    } else {
-                        this.optionValues.set(match[1], match[2]);
-                    }
-                }.bind(this));
+        switchOptionsContainer: function(containerId) {
+            $$('#' + this.widgetOptionsEl.id + ' div[id^=' + this.widgetOptionsEl.id + ']').each(function(e) {
+                this.disableOptionsContainer(e.id);
+            }.bind(this));
+            if(containerId != undefined) {
+                this.enableOptionsContainer(containerId);
+            }
+            this._showWidgetDescription();
+        },
+
+        enableOptionsContainer: function(containerId) {
+            $$('#' + containerId + ' .widget-option').each(function(e) {
+                e.removeClassName('skip-submit');
+                if (e.hasClassName('obligatory')) {
+                    e.removeClassName('obligatory');
+                    e.addClassName('required-entry');
+                }
+            });
+            $(containerId).removeClassName('no-display');
+        },
 
-                this.loadOptions();
+        disableOptionsContainer: function(containerId) {
+            if ($(containerId).hasClassName('no-display')) {
+                return;
             }
-        }
-    },
+            $$('#' + containerId + ' .widget-option').each(function(e) {
+                // Avoid submitting fields of unactive container
+                if (!e.hasClassName('skip-submit')) {
+                    e.addClassName('skip-submit');
+                }
+                // Form validation workaround for unactive container
+                if (e.hasClassName('required-entry')) {
+                    e.removeClassName('required-entry');
+                    e.addClassName('obligatory');
+                }
+            });
+            $(containerId).addClassName('no-display');
+        },
 
-    loadOptions: function() {
-        if (!this.widgetEl.value) {
-            this.switchOptionsContainer();
-            return;
-        }
+        // Assign widget options values when existing widget selected in WYSIWYG
+        initOptionValues: function() {
 
-        var optionsContainerId = this.getOptionsContainerId();
-        if ($(optionsContainerId) != undefined) {
-            this.switchOptionsContainer(optionsContainerId);
-            return;
-        }
+            if (!this.wysiwygExists()) {
+                return false;
+            }
 
-        this._showWidgetDescription();
-
-        var params = {widget_type: this.widgetEl.value, values: this.optionValues};
-        new Ajax.Request(this.optionsUrl,
-            {
-                parameters: {widget: Object.toJSON(params)},
-                onSuccess: function(transport) {
-                    try {
-                        widgetTools.onAjaxSuccess(transport);
-                        this.switchOptionsContainer();
-                        if ($(optionsContainerId) == undefined) {
-                            this.widgetOptionsEl.insert({bottom: widgetTools.getDivHtml(optionsContainerId, transport.responseText)});
+            var e = this.getWysiwygNode();
+            if (e != undefined && e.id) {
+                var widgetCode = Base64.idDecode(e.id);
+                if (widgetCode.indexOf('{{widget') != -1) {
+                    this.optionValues = new Hash({});
+                    widgetCode.gsub(/([a-z0-9\_]+)\s*\=\s*[\"]{1}([^\"]+)[\"]{1}/i, function(match){
+                        if (match[1] == 'type') {
+                            this.widgetEl.value = match[2];
                         } else {
-                            this.switchOptionsContainer(optionsContainerId);
+                            this.optionValues.set(match[1], match[2]);
                         }
-                    } catch(e) {
-                        alert(e.message);
-                    }
-                }.bind(this)
-            }
-        );
-    },
-
-    _showWidgetDescription: function() {
-        var noteCnt = this.widgetEl.next().down('small');
-        var descrCnt = $('widget-description-' + this.widgetEl.selectedIndex);
-        if(noteCnt != undefined) {
-            var description = (descrCnt != undefined ? descrCnt.innerHTML : '');
-            noteCnt.update(descrCnt.innerHTML);
-        }
-    },
-
-    validateField: function() {
-        jQuery(this.widgetEl).valid();
-    },
-
-    insertWidget: function() {
-        jQuery('#' + this.formEl).validate({
-            ignore: ".skip-submit",
-            errorClass: 'mage-error'
-        });
-
-        var validationResult = jQuery('#' + this.formEl).valid();
-        if (validationResult) {
-            var formElements = [];
-            var i = 0;
-            Form.getElements($(this.formEl)).each(function(e) {
-                if(!e.hasClassName('skip-submit')) {
-                    formElements[i] = e;
-                    i++;
+                    }.bind(this));
+
+                    this.loadOptions();
                 }
-            });
+            }
+        },
 
-            // Add as_is flag to parameters if wysiwyg editor doesn't exist
-            var params = Form.serializeElements(formElements);
-            if (!this.wysiwygExists()) {
-                params = params + '&as_is=1';
+        loadOptions: function() {
+            if (!this.widgetEl.value) {
+                this.switchOptionsContainer();
+                return;
+            }
+
+            var optionsContainerId = this.getOptionsContainerId();
+            if ($(optionsContainerId) != undefined) {
+                this.switchOptionsContainer(optionsContainerId);
+                return;
             }
 
-            new Ajax.Request($(this.formEl).action,
+            this._showWidgetDescription();
+
+            var params = {widget_type: this.widgetEl.value, values: this.optionValues};
+            new Ajax.Request(this.optionsUrl,
                 {
-                    parameters: params,
-                    onComplete: function(transport) {
+                    parameters: {widget: Object.toJSON(params)},
+                    onSuccess: function(transport) {
                         try {
                             widgetTools.onAjaxSuccess(transport);
-                            widgetTools.dialogWindow.dialog('close');
-
-                            if (typeof(tinyMCE) != "undefined" && tinyMCE.activeEditor) {
-                                tinyMCE.activeEditor.focus();
-                                if (this.bMark) {
-                                    tinyMCE.activeEditor.selection.moveToBookmark(this.bMark);
-                                }
+                            this.switchOptionsContainer();
+                            if ($(optionsContainerId) == undefined) {
+                                this.widgetOptionsEl.insert({bottom: widgetTools.getDivHtml(optionsContainerId, transport.responseText)});
+                            } else {
+                                this.switchOptionsContainer(optionsContainerId);
                             }
-
-                            this.updateContent(transport.responseText);
                         } catch(e) {
                             alert(e.message);
                         }
                     }.bind(this)
+                }
+            );
+        },
+
+        _showWidgetDescription: function() {
+            var noteCnt = this.widgetEl.next().down('small');
+            var descrCnt = $('widget-description-' + this.widgetEl.selectedIndex);
+            if(noteCnt != undefined) {
+                var description = (descrCnt != undefined ? descrCnt.innerHTML : '');
+                noteCnt.update(descrCnt.innerHTML);
+            }
+        },
+
+        validateField: function() {
+            jQuery(this.widgetEl).valid();
+        },
+
+        insertWidget: function() {
+            jQuery('#' + this.formEl).validate({
+                ignore: ".skip-submit",
+                errorClass: 'mage-error'
+            });
+
+            var validationResult = jQuery('#' + this.formEl).valid();
+            if (validationResult) {
+                var formElements = [];
+                var i = 0;
+                Form.getElements($(this.formEl)).each(function(e) {
+                    if(!e.hasClassName('skip-submit')) {
+                        formElements[i] = e;
+                        i++;
+                    }
                 });
-        }
-    },
-
-    updateContent: function(content) {
-        if (this.wysiwygExists()) {
-            this.getWysiwyg().execCommand("mceInsertContent", false, content);
-        } else {
-            var textarea = document.getElementById(this.widgetTargetId);
-            updateElementAtCursor(textarea, content);
-            varienGlobalEvents.fireEvent('tinymceChange');
-        }
-    },
 
-    wysiwygExists: function() {
-        return (typeof tinyMCE != 'undefined') && tinyMCE.get(this.widgetTargetId);
-    },
+                // Add as_is flag to parameters if wysiwyg editor doesn't exist
+                var params = Form.serializeElements(formElements);
+                if (!this.wysiwygExists()) {
+                    params = params + '&as_is=1';
+                }
+
+                new Ajax.Request($(this.formEl).action,
+                    {
+                        parameters: params,
+                        onComplete: function(transport) {
+                            try {
+                                widgetTools.onAjaxSuccess(transport);
+                                widgetTools.dialogWindow.dialog('close');
+
+                                if (typeof(tinyMCE) != "undefined" && tinyMCE.activeEditor) {
+                                    tinyMCE.activeEditor.focus();
+                                    if (this.bMark) {
+                                        tinyMCE.activeEditor.selection.moveToBookmark(this.bMark);
+                                    }
+                                }
+
+                                this.updateContent(transport.responseText);
+                            } catch(e) {
+                                alert(e.message);
+                            }
+                        }.bind(this)
+                    });
+            }
+        },
+
+        updateContent: function(content) {
+            if (this.wysiwygExists()) {
+                this.getWysiwyg().execCommand("mceInsertContent", false, content);
+            } else {
+                var textarea = document.getElementById(this.widgetTargetId);
+                updateElementAtCursor(textarea, content);
+                varienGlobalEvents.fireEvent('tinymceChange');
+            }
+        },
+
+        wysiwygExists: function() {
+            return (typeof tinyMCE != 'undefined') && tinyMCE.get(this.widgetTargetId);
+        },
 
-    getWysiwyg: function() {
-        return tinyMCE.activeEditor;
-    },
+        getWysiwyg: function() {
+            return tinyMCE.activeEditor;
+        },
 
-    getWysiwygNode: function() {
-        return tinyMCE.activeEditor.selection.getNode();
+        getWysiwygNode: function() {
+            return tinyMCE.activeEditor.selection.getNode();
+        }
     }
-}
 
-WysiwygWidget.chooser = Class.create();
-WysiwygWidget.chooser.prototype = {
+    WysiwygWidget.chooser = Class.create();
+    WysiwygWidget.chooser.prototype = {
 
-    // HTML element A, on which click event fired when choose a selection
-    chooserId: null,
+        // HTML element A, on which click event fired when choose a selection
+        chooserId: null,
 
-    // Source URL for Ajax requests
-    chooserUrl: null,
+        // Source URL for Ajax requests
+        chooserUrl: null,
 
-    // Chooser config
-    config: null,
+        // Chooser config
+        config: null,
 
-    // Chooser dialog window
-    dialogWindow: null,
+        // Chooser dialog window
+        dialogWindow: null,
 
-    // Chooser content for dialog window
-    dialogContent: null,
+        // Chooser content for dialog window
+        dialogContent: null,
 
-    overlayShowEffectOptions: null,
-    overlayHideEffectOptions: null,
+        overlayShowEffectOptions: null,
+        overlayHideEffectOptions: null,
 
-    initialize: function(chooserId, chooserUrl, config) {
-        this.chooserId = chooserId;
-        this.chooserUrl = chooserUrl;
-        this.config = config;
-    },
+        initialize: function(chooserId, chooserUrl, config) {
+            this.chooserId = chooserId;
+            this.chooserUrl = chooserUrl;
+            this.config = config;
+        },
 
-    getResponseContainerId: function() {
-        return 'responseCnt' + this.chooserId;
-    },
+        getResponseContainerId: function() {
+            return 'responseCnt' + this.chooserId;
+        },
 
-    getChooserControl: function() {
-        return $(this.chooserId + 'control');
-    },
+        getChooserControl: function() {
+            return $(this.chooserId + 'control');
+        },
 
-    getElement: function() {
-        return $(this.chooserId + 'value');
-    },
+        getElement: function() {
+            return $(this.chooserId + 'value');
+        },
 
-    getElementLabel: function() {
-        return $(this.chooserId + 'label');
-    },
+        getElementLabel: function() {
+            return $(this.chooserId + 'label');
+        },
 
-    open: function() {
-        $(this.getResponseContainerId()).show();
-    },
+        open: function() {
+            $(this.getResponseContainerId()).show();
+        },
 
-    close: function() {
-        $(this.getResponseContainerId()).hide();
-        this.closeDialogWindow();
-    },
+        close: function() {
+            $(this.getResponseContainerId()).hide();
+            this.closeDialogWindow();
+        },
 
-    choose: function(event) {
-        // Open dialog window with previously loaded dialog content
-        if (this.dialogContent) {
-            this.openDialogWindow(this.dialogContent);
-            return;
-        }
-        // Show or hide chooser content if it was already loaded
-        var responseContainerId = this.getResponseContainerId();
-
-        // Otherwise load content from server
-        new Ajax.Request(this.chooserUrl,
-            {
-                parameters: {element_value: this.getElementValue(), element_label: this.getElementLabelText()},
-                onSuccess: function(transport) {
-                    try {
-                        widgetTools.onAjaxSuccess(transport);
-                        this.dialogContent = widgetTools.getDivHtml(responseContainerId, transport.responseText);
-                        this.openDialogWindow(this.dialogContent);
-                    } catch(e) {
-                        alert(e.message);
-                    }
-                }.bind(this)
-            }
-        );
-    },
-
-    openDialogWindow: function(content) {
-        this.dialogWindow = jQuery('<div/>').dialog({
-            autoOpen:   false,
-            title:      this.config.buttons.open,
-            modal:      true,
-            resizable:  false,
-            zIndex:     widgetTools.getMaxZIndex(),
-            width:      900,
-            dialogClass: 'popup-window',
-            open: function () {
-                jQuery(this).addClass('magento_message');
-            },
-            close: function(event, ui) {
-                jQuery(this).dialog('destroy').remove();
+        choose: function(event) {
+            // Open dialog window with previously loaded dialog content
+            if (this.dialogContent) {
+                this.openDialogWindow(this.dialogContent);
+                return;
             }
-        });
+            // Show or hide chooser content if it was already loaded
+            var responseContainerId = this.getResponseContainerId();
+
+            // Otherwise load content from server
+            new Ajax.Request(this.chooserUrl,
+                {
+                    parameters: {element_value: this.getElementValue(), element_label: this.getElementLabelText()},
+                    onSuccess: function(transport) {
+                        try {
+                            widgetTools.onAjaxSuccess(transport);
+                            this.dialogContent = widgetTools.getDivHtml(responseContainerId, transport.responseText);
+                            this.openDialogWindow(this.dialogContent);
+                        } catch(e) {
+                            alert(e.message);
+                        }
+                    }.bind(this)
+                }
+            );
+        },
+
+        openDialogWindow: function(content) {
+            this.dialogWindow = jQuery('<div/>').dialog({
+                autoOpen:   false,
+                title:      this.config.buttons.open,
+                modal:      true,
+                resizable:  false,
+                zIndex:     widgetTools.getMaxZIndex(),
+                width:      900,
+                dialogClass: 'popup-window',
+                open: function () {
+                    jQuery(this).addClass('magento_message');
+                },
+                close: function(event, ui) {
+                    jQuery(this).dialog('destroy').remove();
+                }
+            });
 
-        this.dialogWindow.dialog('open').append(content);
-    },
+            this.dialogWindow.dialog('open').append(content);
+        },
 
-    closeDialogWindow: function(dialogWindow) {
-        if (!dialogWindow) {
-            dialogWindow = this.dialogWindow;
-        }
-        if (dialogWindow) {
-            this.dialogWindow.dialog('destroy').remove();
-        }
-        this.dialogWindow = null;
-    },
+        closeDialogWindow: function(dialogWindow) {
+            if (!dialogWindow) {
+                dialogWindow = this.dialogWindow;
+            }
+            if (dialogWindow) {
+                this.dialogWindow.dialog('destroy').remove();
+            }
+            this.dialogWindow = null;
+        },
 
-    getElementValue: function(value) {
-        return this.getElement().value;
-    },
+        getElementValue: function(value) {
+            return this.getElement().value;
+        },
 
-    getElementLabelText: function(value) {
-        return this.getElementLabel().innerHTML;
-    },
+        getElementLabelText: function(value) {
+            return this.getElementLabel().innerHTML;
+        },
 
-    setElementValue: function(value) {
-        this.getElement().value = value;
-    },
+        setElementValue: function(value) {
+            this.getElement().value = value;
+        },
 
-    setElementLabel: function(value) {
-        this.getElementLabel().innerHTML = value;
-    }
-};
+        setElementLabel: function(value) {
+            this.getElementLabel().innerHTML = value;
+        }
+    };
+
+    window.WysiwygWidget = WysiwygWidget;
+    window.widgetTools = widgetTools;
+});
\ No newline at end of file
diff --git a/lib/web/mage/backend/action-link.js b/lib/web/mage/backend/action-link.js
index 111916097852481f4277fadd1a4f58820e20f72e..8c3689db9a398509b3ec0c9fa45814e3108f059c 100644
--- a/lib/web/mage/backend/action-link.js
+++ b/lib/web/mage/backend/action-link.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.actionLink', {
         /**
          * Button creation
@@ -85,4 +89,5 @@
                 .trigger(this.options.event, this.options.eventData ? [this.options.eventData] : [{}]);
         }
     });
-})(jQuery);
+
+});
diff --git a/lib/web/mage/backend/ajax-setup.js b/lib/web/mage/backend/ajax-setup.js
index c3a00e52c14b165bda41b43065a7e1da66ad5b3c..960fe951a5fb5079d703271823b4e27debce38c6 100644
--- a/lib/web/mage/backend/ajax-setup.js
+++ b/lib/web/mage/backend/ajax-setup.js
@@ -22,7 +22,11 @@
  */
 /*jshint browser:true jquery:true */
 /*global window:true FORM_KEY:true SessionError:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+    
     $.ajaxSetup({
         /*
          * @type {string}
@@ -63,7 +67,7 @@
         complete: function(jqXHR){
             if (jqXHR.readyState === 4) {
                 try {
-                    var jsonObject = jQuery.parseJSON(jqXHR.responseText);
+                    var jsonObject = $.parseJSON(jqXHR.responseText);
                     if (jsonObject.ajaxExpired && jsonObject.ajaxRedirect) {
                         window.location.replace(jsonObject.ajaxRedirect);
                         throw new SessionError('session expired');
@@ -76,4 +80,4 @@
             }
         }
     });
-})(jQuery);
+});
diff --git a/lib/web/mage/backend/bootstrap.js b/lib/web/mage/backend/bootstrap.js
index e64cbc365759ed7c67beb29032d77f6bb29c4219..06b119bcf050021a0add11f9bd4d4af680c6a480 100644
--- a/lib/web/mage/backend/bootstrap.js
+++ b/lib/web/mage/backend/bootstrap.js
@@ -22,8 +22,12 @@
  */
 /*jshint jquery:true browser:true */
 /*global FORM_KEY:true*/
-(function ($) {
+define([
+    "jquery",
+    "mage/mage"
+], function($){
     'use strict';
+
     $.ajaxSetup({
         /*
          * @type {string}
@@ -65,7 +69,7 @@
         complete: function(jqXHR) {
             if (jqXHR.readyState === 4) {
                 try {
-                    var jsonObject = jQuery.parseJSON(jqXHR.responseText);
+                    var jsonObject = $.parseJSON(jqXHR.responseText);
                     if (jsonObject.ajaxExpired && jsonObject.ajaxRedirect) {
                         window.location.replace(jsonObject.ajaxRedirect);
                     }
@@ -90,4 +94,4 @@
     };
 
     $(bootstrap);
-})(jQuery);
+});
diff --git a/lib/web/mage/backend/button.js b/lib/web/mage/backend/button.js
index 429133da57ef76a0fc58b4c7512b051d5ac692bf..b5c82ccd8bb19d1152f420cf266fd3db010ca943 100644
--- a/lib/web/mage/backend/button.js
+++ b/lib/web/mage/backend/button.js
@@ -20,9 +20,18 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-/*jshint jquery:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     'use strict';
+    
     $.widget('ui.button', $.ui.button, {
         options: {
             eventData: {}
@@ -52,4 +61,4 @@
                 }, this.options));
         }
     });
-})(jQuery);
+}));
diff --git a/lib/web/mage/backend/components.js b/lib/web/mage/backend/components.js
new file mode 100644
index 0000000000000000000000000000000000000000..5eee23d01f289812d0aec050f156fb0f6b071be9
--- /dev/null
+++ b/lib/web/mage/backend/components.js
@@ -0,0 +1,76 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+define([], function() {
+    var components = {
+        categoryForm: 'Magento_Catalog/catalog/category/form',
+        newCategoryDialog: 'Magento_Catalog/js/new-category-dialog',
+        requireCookie: 'Magento_Core/js/require-cookie',
+
+        addressTabs: 'Magento_Customer/edit/tab/js/addresses',
+        dataItemDeleteButton: 'Magento_Customer/edit/tab/js/addresses',
+        groupedProduct: 'Magento_GroupedProduct/js/grouped-product',
+        observableInputs: 'Magento_Customer/edit/tab/js/addresses',
+        translateInline: 'mage/translate-inline',
+
+        //Backend\view\adminhtml\templates\page\js\components.phtml
+        form: 'mage/backend/form',
+        button: 'mage/backend/button',
+        accordion: 'mage/accordion',
+        actionLink: 'mage/backend/action-link',
+        validation: 'mage/backend/validation',
+        notification: 'mage/backend/notification',
+        loader: 'mage/loader_old',
+        loaderAjax: 'mage/loader_old',
+        floatingHeader: 'mage/backend/floating-header',
+        suggest: 'mage/backend/suggest',
+        mediabrowser: 'jquery/jstree/jquery.jstree',
+        rolesTree: 'Magento_User/js/roles-tree',
+        folderTree: 'Magento_Cms/js/folder-tree',
+        categoryTree: 'Magento_Catalog/js/category-tree',
+        tabs: 'mage/backend/tabs',
+        treeSuggest: 'mage/backend/tree-suggest',
+        baseImage: 'baseImage',
+
+        //DesignEditor\view\adminhtml\templates\editor\toolbar\buttons\edit
+        'vde-edit-button': 'Magento_DesignEditor/js/theme-revert',
+
+        //Sales\view\adminhtml\templates\page\js\components.phtml
+        orderEditDialog: 'Magento_Sales/order/edit/message',
+
+        variationsAttributes: 'Magento_ConfigurableProduct/catalog/product-variation',
+        calendar: 'mage/calendar',
+        productGallery: 'Magento_Catalog/js/product-gallery',
+        configurableAttribute: 'Magento_ConfigurableProduct/catalog/product/attribute',
+        systemMessageDialog: 'Magento_AdminNotification/system/notification',
+        fptAttribute: 'Magento_Weee/js/fpt-attribute',
+        dropdown: 'mage/dropdown_old',
+        collapsable: 'js/theme',
+        collapsible: 'mage/collapsible',
+        menu: 'mage/backend/menu',
+        themeEdit: 'Magento_DesignEditor/js/theme-edit',
+        integration: 'Magento_Integration/js/integration'
+    };
+
+    return components;
+});
\ No newline at end of file
diff --git a/lib/web/mage/backend/editablemultiselect.js b/lib/web/mage/backend/editablemultiselect.js
index 4131befa5e586a5f16cafa6eda14cd0894ca2e47..ee89bead1f626d011a028682e89ce20e0db6fff2 100644
--- a/lib/web/mage/backend/editablemultiselect.js
+++ b/lib/web/mage/backend/editablemultiselect.js
@@ -20,7 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function($) {
+define([
+    "jquery",
+    "jquery/editableMultiselect/js/jquery.editable",
+    "jquery/editableMultiselect/js/jquery.multiselect"
+], function($){
+
 
     /**
      * Editable multiselect wrapper for multiselects
@@ -68,16 +73,16 @@
 
             if (!this.isEntityEditable) {
                 // Override default layout of editable multiselect
-                mselectOptions['layout'] = '<section class="block %mselectListClass%">'
-                    + '<div class="block-content"><div class="%mselectItemsWrapperClass%">'
-                    + '%items%'
-                    + '</div></div>'
-                    + '<div class="%mselectInputContainerClass%">'
-                    + '<input type="text" class="%mselectInputClass%" title="%inputTitle%"/>'
-                    + '<span class="%mselectButtonCancelClass%" title="%cancelText%"></span>'
-                    + '<span class="%mselectButtonSaveClass%" title="Add"></span>'
-                    + '</div>'
-                    + '</section>';
+                mselectOptions.layout = '<section class="block %mselectListClass%">' +
+                    '<div class="block-content"><div class="%mselectItemsWrapperClass%">' +
+                    '%items%' +
+                    '</div></div>' +
+                    '<div class="%mselectInputContainerClass%">' +
+                    '<input type="text" class="%mselectInputClass%" title="%inputTitle%"/>' +
+                    '<span class="%mselectButtonCancelClass%" title="%cancelText%"></span>' +
+                    '<span class="%mselectButtonSaveClass%" title="Add"></span>' +
+                    '</div>' +
+                    '</section>';
             }
 
             $('#' + this.targetSelectId).multiselect(mselectOptions);
@@ -202,8 +207,8 @@
                 success: function(result, status) {
                     if (result.success) {
                         // Add item to initial select element
-                        select.append('<option value="' + result[entityIdName] + '" selected="selected">'
-                            + result[entityValueName] + '</option>');
+                        select.append('<option value="' + result[entityIdName] + '" selected="selected">' +
+                            result[entityValueName] + '</option>');
                         // Add editable multiselect item
                         var mselectItemHtml = $(options.item.replace(/%value%|%label%/gi, result[entityValueName])
                                 .replace(/%mselectDisabledClass%|%iseditable%|%isremovable%/gi, '')
@@ -214,12 +219,14 @@
                                 .end(),
                             sectionBlock = select.nextAll('section.block:first'),
                             itemsWrapper = sectionBlock.find('.' + options.mselectItemsWrapperClass + '');
-                        itemsWrapper.children('.' + options.mselectListItemClass + '').length
-                            ? itemsWrapper.children('.' + options.mselectListItemClass + ':last').after(mselectItemHtml)
-                            : itemsWrapper.prepend(mselectItemHtml);
+                        if( itemsWrapper.children('.' + options.mselectListItemClass + '').length ) {
+                            itemsWrapper.children('.' + options.mselectListItemClass + ':last').after(mselectItemHtml);
+                        } else {
+                            itemsWrapper.prepend(mselectItemHtml);
+                        }
                         // Trigger blur event on input field, that is used to add new value, to hide it
-                        var inputSelector = '.' + options.mselectInputContainerClass + ' [type=text].'
-                            + options.mselectInputClass + '';
+                        var inputSelector = '.' + options.mselectInputContainerClass + ' [type=text].' +
+                            options.mselectInputClass + '';
                         sectionBlock.find(inputSelector).trigger('blur');
                     } else {
                         alert(result.error_message);
@@ -264,4 +271,4 @@
             $.ajax(ajaxOptions);
         };
     };
-})(jQuery);
+});
\ No newline at end of file
diff --git a/lib/web/mage/backend/floating-header.js b/lib/web/mage/backend/floating-header.js
index f336cb1189877f0eae732d6ee32f374da6bdd08f..16bed8cd6ba48deb6884ee1a9587bf8fc58171cc 100644
--- a/lib/web/mage/backend/floating-header.js
+++ b/lib/web/mage/backend/floating-header.js
@@ -20,9 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-/*jshint browser:true jquery:true */
-(function($) {
+/*jshint browser:true*/
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+        
     $.widget('mage.floatingHeader', {
         options: {
             placeholderAttrs: {
@@ -93,4 +97,5 @@
             this._off($(window));
         }
     });
-})(jQuery);
+
+});
diff --git a/lib/web/mage/backend/form.js b/lib/web/mage/backend/form.js
index 38f638e272bc5a7636c42147a60d770623724581..9d98e864c24a2ea27d18c8f1f624d8e7662790e1 100644
--- a/lib/web/mage/backend/form.js
+++ b/lib/web/mage/backend/form.js
@@ -20,21 +20,34 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-/*jshint jquery:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+
     $.widget("mage.form", {
         options: {
             handlersData: {
                 save: {},
                 saveAndContinueEdit: {
                     action: {
-                        args: {back: 'edit'}
+                        args: {
+                            back: 'edit'
+                        }
                     }
                 },
                 saveAndNew: {
                     action: {
-                        args: {back: 'new'}
+                        args: {
+                            back: 'new'
+                        }
                     }
                 },
                 preview: {
@@ -162,7 +175,7 @@
         _processData: function(data) {
             $.each(data, $.proxy(function(attrName, attrValue) {
                 this._storeAttribute(attrName);
-                if(attrName === 'action') {
+                if (attrName === 'action') {
                     data[attrName] = this._getActionUrl(attrValue);
                 }
             }, this));
@@ -177,11 +190,10 @@
          */
         _beforeSubmit: function(handlerName, data) {
             var submitData = {};
-            var event = new jQuery.Event('beforeSubmit');
+            var event = new $.Event('beforeSubmit');
             this.element.trigger(event, [submitData, handlerName]);
             data = $.extend(
-                true,
-                {},
+                true, {},
                 this.options.handlersData[handlerName] || {},
                 submitData,
                 data
@@ -202,4 +214,4 @@
             }
         }
     });
-})(jQuery);
+}));
diff --git a/lib/web/mage/backend/menu.js b/lib/web/mage/backend/menu.js
index 764cd1c8964879a5bbb6cb484fb389b90468ca66..91853fcff3b75f575844c0f186fb7c8332b32fac 100644
--- a/lib/web/mage/backend/menu.js
+++ b/lib/web/mage/backend/menu.js
@@ -21,609 +21,616 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function( $, undefined ) {
-
-$.widget('mage.menu', {
-    widgetEventPrefix: "menu",
-	version: "1.10.1",
-	defaultElement: "<ul>",
-	delay: 300,
-	options: {
-		icons: {
-			submenu: "ui-icon-carat-1-e"
-		},
-		menus: "ul",
-		position: {
-			my: "left top",
-			at: "right top"
-		},
-		role: "menu",
-
-		// callbacks
-		blur: null,
-		focus: null,
-		select: null
-	},
-
-	_create: function() {
-		this.activeMenu = this.element;
-		// flag used to prevent firing of the click handler
-		// as the event bubbles up through nested menus
-		this.mouseHandled = false;
-		this.element
-			.uniqueId()
-			.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
-			.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
-			.attr({
-				role: this.options.role,
-				tabIndex: 0
-			})
-			// need to catch all clicks on disabled menu
-			// not possible through _on
-			.bind( "click" + this.eventNamespace, $.proxy(function( event ) {
-				if ( this.options.disabled ) {
-					event.preventDefault();
-				}
-			}, this ));
-
-		if ( this.options.disabled ) {
-			this.element
-				.addClass( "ui-state-disabled" )
-				.attr( "aria-disabled", "true" );
-		}
-
-		this._on({
-			// Prevent focus from sticking to links inside menu after clicking
-			// them (focus should always stay on UL during navigation).
-			"mousedown .ui-menu-item > a": function( event ) {
-				event.preventDefault();
-			},
-			"click .ui-state-disabled > a": function( event ) {
-				event.preventDefault();
-			},
-			"click .ui-menu-item:has(a)": function( event ) {
-				var target = $( event.target ).closest( ".ui-menu-item" );
-				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
-					this.mouseHandled = true;
-
-					this.select( event );
-					// Open submenu on click
-					if ( target.has( ".ui-menu" ).length ) {
-						this.expand( event );
-					} else if ( !this.element.is( ":focus" ) ) {
-						// Redirect focus to the menu
-						this.element.trigger( "focus", [ true ] );
-
-						// If the active item is on the top level, let it stay active.
-						// Otherwise, blur the active item since it is no longer visible.
-						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
-							clearTimeout( this.timer );
-						}
-					}
-				}
-			},
-			"mouseenter .ui-menu-item": function( event ) {
-				var target = $( event.currentTarget );
-				// Remove ui-state-active class from siblings of the newly focused menu item
-				// to avoid a jump caused by adjacent elements both having a class with a border
-				target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
-				this.focus( event, target );
-			},
-			mouseleave: "collapseAll",
-			"mouseleave .ui-menu": "collapseAll",
-			focus: function( event, keepActiveItem ) {
-				// If there's already an active item, keep it active
-				// If not, activate the first item
-				var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
-
-				if ( !keepActiveItem ) {
-					this.focus( event, item );
-				}
-			},
-			blur: function( event ) {
-				this._delay(function() {
-					if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
-						this.collapseAll( event );
-					}
-				});
-			},
-			keydown: "_keydown"
-		});
-
-		this.refresh();
-
-		// Clicks outside of a menu collapse any open menus
-		this._on( this.document, {
-			click: function( event ) {
-				if ( !$( event.target ).closest( ".ui-menu" ).length ) {
-					this.collapseAll( event );
-				}
-
-				// Reset the mouseHandled flag
-				this.mouseHandled = false;
-			}
-		});
-	},
-
-	_destroy: function() {
-		// Destroy (sub)menus
-		this.element
-			.removeAttr( "aria-activedescendant" )
-			.find( ".ui-menu" ).addBack()
-				.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
-				.removeAttr( "role" )
-				.removeAttr( "tabIndex" )
-				.removeAttr( "aria-labelledby" )
-				.removeAttr( "aria-expanded" )
-				.removeAttr( "aria-hidden" )
-				.removeAttr( "aria-disabled" )
-				.removeUniqueId()
-				.show();
-
-		// Destroy menu items
-		this.element.find( ".ui-menu-item" )
-			.removeClass( "ui-menu-item" )
-			.removeAttr( "role" )
-			.removeAttr( "aria-disabled" )
-			.children( "a" )
-				.removeUniqueId()
-				.removeClass( "ui-corner-all ui-state-hover" )
-				.removeAttr( "tabIndex" )
-				.removeAttr( "role" )
-				.removeAttr( "aria-haspopup" )
-				.children().each( function() {
-					var elem = $( this );
-					if ( elem.data( "ui-menu-submenu-carat" ) ) {
-						elem.remove();
-					}
-				});
-
-		// Destroy menu dividers
-		this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
-	},
-
-	_keydown: function( event ) {
-		var match, prev, character, skip, regex,
-			preventDefault = true;
-
-		function escape( value ) {
-			return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
-		}
-
-		switch ( event.keyCode ) {
-		case $.ui.keyCode.PAGE_UP:
-			this.previousPage( event );
-			break;
-		case $.ui.keyCode.PAGE_DOWN:
-			this.nextPage( event );
-			break;
-		case $.ui.keyCode.HOME:
-			this._move( "first", "first", event );
-			break;
-		case $.ui.keyCode.END:
-			this._move( "last", "last", event );
-			break;
-		case $.ui.keyCode.UP:
-			this.previous( event );
-			break;
-		case $.ui.keyCode.DOWN:
-			this.next( event );
-			break;
-		case $.ui.keyCode.LEFT:
-			this.collapse( event );
-			break;
-		case $.ui.keyCode.RIGHT:
-			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
-				this.expand( event );
-			}
-			break;
-		case $.ui.keyCode.ENTER:
-		case $.ui.keyCode.SPACE:
-			this._activate( event );
-			break;
-		case $.ui.keyCode.ESCAPE:
-			this.collapse( event );
-			break;
-		default:
-			preventDefault = false;
-			prev = this.previousFilter || "";
-			character = String.fromCharCode( event.keyCode );
-			skip = false;
-
-			clearTimeout( this.filterTimer );
-
-			if ( character === prev ) {
-				skip = true;
-			} else {
-				character = prev + character;
-			}
-
-			regex = new RegExp( "^" + escape( character ), "i" );
-			match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
-				return regex.test( $( this ).children( "a" ).text() );
-			});
-			match = skip && match.index( this.active.next() ) !== -1 ?
-				this.active.nextAll( ".ui-menu-item" ) :
-				match;
-
-			// If no matches on the current filter, reset to the last character pressed
-			// to move down the menu to the first item that starts with that character
-			if ( !match.length ) {
-				character = String.fromCharCode( event.keyCode );
-				regex = new RegExp( "^" + escape( character ), "i" );
-				match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
-					return regex.test( $( this ).children( "a" ).text() );
-				});
-			}
-
-			if ( match.length ) {
-				this.focus( event, match );
-				if ( match.length > 1 ) {
-					this.previousFilter = character;
-					this.filterTimer = this._delay(function() {
-						delete this.previousFilter;
-					}, 1000 );
-				} else {
-					delete this.previousFilter;
-				}
-			} else {
-				delete this.previousFilter;
-			}
-		}
-
-		if ( preventDefault ) {
-			event.preventDefault();
-		}
-	},
-
-	_activate: function( event ) {
-		if ( !this.active.is( ".ui-state-disabled" ) ) {
-			if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
-				this.expand( event );
-			} else {
-				this.select( event );
-			}
-		}
-	},
-
-	refresh: function() {
-		var menus,
-			icon = this.options.icons.submenu,
-			submenus = this.element.find( this.options.menus );
-
-		// Initialize nested menus
-		submenus.filter( ":not(.ui-menu)" )
-			.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
-			.hide()
-			.attr({
-				role: this.options.role,
-				"aria-hidden": "true",
-				"aria-expanded": "false"
-			})
-			.each(function() {
-				var menu = $( this ),
-					item = menu.prev( "a" ),
-					submenuCarat = $( "<span>" )
-						.addClass( "ui-menu-icon ui-icon " + icon )
-						.data( "ui-menu-submenu-carat", true );
-
-				item
-					.attr( "aria-haspopup", "true" )
-					.prepend( submenuCarat );
-				menu.attr( "aria-labelledby", item.attr( "id" ) );
-			});
-
-		menus = submenus.add( this.element );
-
-		// Don't refresh list items that are already adapted
-		menus.children( ":not(.ui-menu-item):has(a)" )
-			.addClass( "ui-menu-item" )
-			.attr( "role", "presentation" )
-			.children( "a" )
-				.uniqueId()
-				.addClass( "ui-corner-all" )
-				.attr({
-					tabIndex: -1,
-					role: this._itemRole()
-				});
-
-		// Initialize unlinked menu-items containing spaces and/or dashes only as dividers
-		menus.children( ":not(.ui-menu-item)" ).each(function() {
-			var item = $( this );
-			// hyphen, em dash, en dash
-			if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {
-				item.addClass( "ui-widget-content ui-menu-divider" );
-			}
-		});
-
-		// Add aria-disabled attribute to any disabled menu item
-		menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
-
-		// If the active item has been removed, blur the menu
-		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
-			this.blur();
-		}
-	},
-
-	_itemRole: function() {
-		return {
-			menu: "menuitem",
-			listbox: "option"
-		}[ this.options.role ];
-	},
-
-	_setOption: function( key, value ) {
-		if ( key === "icons" ) {
-			this.element.find( ".ui-menu-icon" )
-				.removeClass( this.options.icons.submenu )
-				.addClass( value.submenu );
-		}
-		this._super( key, value );
-	},
-
-	focus: function( event, item ) {
-		var nested, focused;
-		this.blur( event, event && event.type === "focus" );
-
-		this._scrollIntoView( item );
-
-		this.active = item.first();
-		focused = this.active.children( "a" ).addClass( "ui-state-focus" );
-		// Only update aria-activedescendant if there's a role
-		// otherwise we assume focus is managed elsewhere
-		if ( this.options.role ) {
-			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
-		}
-
-		// Highlight active parent menu item, if any
-		this.active
-			.parent()
-			.closest( ".ui-menu-item" )
-			.children( "a:first" )
-			.addClass( "ui-state-active" );
-
-		if ( event && event.type === "keydown" ) {
-			this._close();
-		} else {
-			this.timer = this._delay(function() {
-				this._close();
-			}, this.delay );
-		}
-
-		nested = item.children( ".ui-menu" );
-		if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
-			this._startOpening(nested);
-		}
-		this.activeMenu = item.parent();
-
-		this._trigger( "focus", event, { item: item } );
-	},
-
-	_scrollIntoView: function( item ) {
-		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
-		if ( this._hasScroll() ) {
-			borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
-			paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
-			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
-			scroll = this.activeMenu.scrollTop();
-			elementHeight = this.activeMenu.height();
-			itemHeight = item.height();
-
-			if ( offset < 0 ) {
-				this.activeMenu.scrollTop( scroll + offset );
-			} else if ( offset + itemHeight > elementHeight ) {
-				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
-			}
-		}
-	},
-
-	blur: function( event, fromFocus ) {
-		if ( !fromFocus ) {
-			clearTimeout( this.timer );
-		}
-
-		if ( !this.active ) {
-			return;
-		}
-
-		this.active.children( "a" ).removeClass( "ui-state-focus" );
-		this.active = null;
-
-		this._trigger( "blur", event, { item: this.active } );
-	},
-
-	_startOpening: function( submenu ) {
-		clearTimeout( this.timer );
-
-		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
-		// shift in the submenu position when mousing over the carat icon
-		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
-			return;
-		}
-
-		this.timer = this._delay(function() {
-			this._close();
-			this._open( submenu );
-		}, this.delay );
-	},
-
-	_open: function( submenu ) {
-		var position = $.extend({
-			of: this.active
-		}, this.options.position );
-
-		clearTimeout( this.timer );
-		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
-			.hide()
-			.attr( "aria-hidden", "true" );
-
-		submenu
-			.show()
-			.removeAttr( "aria-hidden" )
-			.attr( "aria-expanded", "true" )
-			.position( position );
-	},
-
-	collapseAll: function( event, all ) {
-		clearTimeout( this.timer );
-		this.timer = this._delay(function() {
-			// If we were passed an event, look for the submenu that contains the event
-			var currentMenu = all ? this.element :
-				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
-
-			// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
-			if ( !currentMenu.length ) {
-				currentMenu = this.element;
-			}
-
-			this._close( currentMenu );
-
-			this.blur( event );
-			this.activeMenu = currentMenu;
-		}, this.delay );
-	},
-
-	// With no arguments, closes the currently active menu - if nothing is active
-	// it closes all menus.  If passed an argument, it will search for menus BELOW
-	_close: function( startMenu ) {
-		if ( !startMenu ) {
-			startMenu = this.active ? this.active.parent() : this.element;
-		}
-
-		startMenu
-			.find( ".ui-menu" )
-				.hide()
-				.attr( "aria-hidden", "true" )
-				.attr( "aria-expanded", "false" )
-			.end()
-			.find( "a.ui-state-active" )
-				.removeClass( "ui-state-active" );
-	},
-
-	collapse: function( event ) {
-		var newItem = this.active &&
-			this.active.parent().closest( ".ui-menu-item", this.element );
-		if ( newItem && newItem.length ) {
-			this._close();
-			this.focus( event, newItem );
-		}
-	},
-
-	expand: function( event ) {
-		var newItem = this.active &&
-			this.active
-				.children( ".ui-menu " )
-				.children( ".ui-menu-item" )
-				.first();
-
-		if ( newItem && newItem.length ) {
-			this._open( newItem.parent() );
-
-			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
-			this._delay(function() {
-				this.focus( event, newItem );
-			});
-		}
-	},
-
-	next: function( event ) {
-		this._move( "next", "first", event );
-	},
-
-	previous: function( event ) {
-		this._move( "prev", "last", event );
-	},
-
-	isFirstItem: function() {
-		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
-	},
-
-	isLastItem: function() {
-		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
-	},
-
-	_move: function( direction, filter, event ) {
-		var next;
-		if ( this.active ) {
-			if ( direction === "first" || direction === "last" ) {
-				next = this.active
-					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
-					.eq( -1 );
-			} else {
-				next = this.active
-					[ direction + "All" ]( ".ui-menu-item" )
-					.eq( 0 );
-			}
-		}
-		if ( !next || !next.length || !this.active ) {
-			next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
-		}
-
-		this.focus( event, next );
-	},
-
-	nextPage: function( event ) {
-		var item, base, height;
-
-		if ( !this.active ) {
-			this.next( event );
-			return;
-		}
-		if ( this.isLastItem() ) {
-			return;
-		}
-		if ( this._hasScroll() ) {
-			base = this.active.offset().top;
-			height = this.element.height();
-			this.active.nextAll( ".ui-menu-item" ).each(function() {
-				item = $( this );
-				return item.offset().top - base - height < 0;
-			});
-
-			this.focus( event, item );
-		} else {
-			this.focus( event, this.activeMenu.children( ".ui-menu-item" )
-				[ !this.active ? "first" : "last" ]() );
-		}
-	},
-
-	previousPage: function( event ) {
-		var item, base, height;
-		if ( !this.active ) {
-			this.next( event );
-			return;
-		}
-		if ( this.isFirstItem() ) {
-			return;
-		}
-		if ( this._hasScroll() ) {
-			base = this.active.offset().top;
-			height = this.element.height();
-			this.active.prevAll( ".ui-menu-item" ).each(function() {
-				item = $( this );
-				return item.offset().top - base + height > 0;
-			});
-
-			this.focus( event, item );
-		} else {
-			this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
-		}
-	},
-
-	_hasScroll: function() {
-		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
-	},
-
-	select: function( event ) {
-		// TODO: It should never be possible to not have an active item at this
-		// point, but the tests don't trigger mouseenter before click.
-		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
-		var ui = { item: this.active };
-		if ( !this.active.has( ".ui-menu" ).length ) {
-			this.collapseAll( event, true );
-		}
-		this._trigger( "select", event, ui );
-	}
-});
-
-}( jQuery ));
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
+    $.widget('mage.menu', {
+        widgetEventPrefix: "menu",
+        version: "1.10.1",
+        defaultElement: "<ul>",
+        delay: 300,
+        options: {
+            icons: {
+                submenu: "ui-icon-carat-1-e"
+            },
+            menus: "ul",
+            position: {
+                my: "left top",
+                at: "right top"
+            },
+            role: "menu",
+
+            // callbacks
+            blur: null,
+            focus: null,
+            select: null
+        },
+
+        _create: function () {
+            this.activeMenu = this.element;
+            // flag used to prevent firing of the click handler
+            // as the event bubbles up through nested menus
+            this.mouseHandled = false;
+            this.element
+                .uniqueId()
+                .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
+                .toggleClass("ui-menu-icons", !!this.element.find(".ui-icon").length)
+                .attr({
+                    role: this.options.role,
+                    tabIndex: 0
+                })
+                // need to catch all clicks on disabled menu
+                // not possible through _on
+                .bind("click" + this.eventNamespace, $.proxy(function (event) {
+                    if (this.options.disabled) {
+                        event.preventDefault();
+                    }
+                }, this));
+
+            if (this.options.disabled) {
+                this.element
+                    .addClass("ui-state-disabled")
+                    .attr("aria-disabled", "true");
+            }
+
+            this._on({
+                // Prevent focus from sticking to links inside menu after clicking
+                // them (focus should always stay on UL during navigation).
+                "mousedown .ui-menu-item > a": function (event) {
+                    event.preventDefault();
+                },
+                "click .ui-state-disabled > a": function (event) {
+                    event.preventDefault();
+                },
+                "click .ui-menu-item:has(a)": function (event) {
+                    var target = $(event.target).closest(".ui-menu-item");
+                    if (!this.mouseHandled && target.not(".ui-state-disabled").length) {
+                        this.mouseHandled = true;
+
+                        this.select(event);
+                        // Open submenu on click
+                        if (target.has(".ui-menu").length) {
+                            this.expand(event);
+                        } else if (!this.element.is(":focus")) {
+                            // Redirect focus to the menu
+                            this.element.trigger("focus", [true]);
+
+                            // If the active item is on the top level, let it stay active.
+                            // Otherwise, blur the active item since it is no longer visible.
+                            if (this.active && this.active.parents(".ui-menu").length === 1) {
+                                clearTimeout(this.timer);
+                            }
+                        }
+                    }
+                },
+                "mouseenter .ui-menu-item": function (event) {
+                    var target = $(event.currentTarget);
+                    // Remove ui-state-active class from siblings of the newly focused menu item
+                    // to avoid a jump caused by adjacent elements both having a class with a border
+                    target.siblings().children(".ui-state-active").removeClass("ui-state-active");
+                    this.focus(event, target);
+                },
+                mouseleave: "collapseAll",
+                "mouseleave .ui-menu": "collapseAll",
+                focus: function (event, keepActiveItem) {
+                    // If there's already an active item, keep it active
+                    // If not, activate the first item
+                    var item = this.active || this.element.children(".ui-menu-item").eq(0);
+
+                    if (!keepActiveItem) {
+                        this.focus(event, item);
+                    }
+                },
+                blur: function (event) {
+                    this._delay(function () {
+                        if (!$.contains(this.element[0], this.document[0].activeElement)) {
+                            this.collapseAll(event);
+                        }
+                    });
+                },
+                keydown: "_keydown"
+            });
+
+            this.refresh();
+
+            // Clicks outside of a menu collapse any open menus
+            this._on(this.document, {
+                click: function (event) {
+                    if (!$(event.target).closest(".ui-menu").length) {
+                        this.collapseAll(event);
+                    }
+
+                    // Reset the mouseHandled flag
+                    this.mouseHandled = false;
+                }
+            });
+        },
+
+        _destroy: function () {
+            // Destroy (sub)menus
+            this.element
+                .removeAttr("aria-activedescendant")
+                .find(".ui-menu").addBack()
+                .removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons")
+                .removeAttr("role")
+                .removeAttr("tabIndex")
+                .removeAttr("aria-labelledby")
+                .removeAttr("aria-expanded")
+                .removeAttr("aria-hidden")
+                .removeAttr("aria-disabled")
+                .removeUniqueId()
+                .show();
+
+            // Destroy menu items
+            this.element.find(".ui-menu-item")
+                .removeClass("ui-menu-item")
+                .removeAttr("role")
+                .removeAttr("aria-disabled")
+                .children("a")
+                .removeUniqueId()
+                .removeClass("ui-corner-all ui-state-hover")
+                .removeAttr("tabIndex")
+                .removeAttr("role")
+                .removeAttr("aria-haspopup")
+                .children().each(function () {
+                    var elem = $(this);
+                    if (elem.data("ui-menu-submenu-carat")) {
+                        elem.remove();
+                    }
+                });
+
+            // Destroy menu dividers
+            this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content");
+        },
+
+        _keydown: function (event) {
+            var match, prev, character, skip, regex,
+                preventDefault = true;
+
+            function escape(value) {
+                return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+            }
+
+            switch (event.keyCode) {
+                case $.ui.keyCode.PAGE_UP:
+                    this.previousPage(event);
+                    break;
+                case $.ui.keyCode.PAGE_DOWN:
+                    this.nextPage(event);
+                    break;
+                case $.ui.keyCode.HOME:
+                    this._move("first", "first", event);
+                    break;
+                case $.ui.keyCode.END:
+                    this._move("last", "last", event);
+                    break;
+                case $.ui.keyCode.UP:
+                    this.previous(event);
+                    break;
+                case $.ui.keyCode.DOWN:
+                    this.next(event);
+                    break;
+                case $.ui.keyCode.LEFT:
+                    this.collapse(event);
+                    break;
+                case $.ui.keyCode.RIGHT:
+                    if (this.active && !this.active.is(".ui-state-disabled")) {
+                        this.expand(event);
+                    }
+                    break;
+                case $.ui.keyCode.ENTER:
+                case $.ui.keyCode.SPACE:
+                    this._activate(event);
+                    break;
+                case $.ui.keyCode.ESCAPE:
+                    this.collapse(event);
+                    break;
+                default:
+                    preventDefault = false;
+                    prev = this.previousFilter || "";
+                    character = String.fromCharCode(event.keyCode);
+                    skip = false;
+
+                    clearTimeout(this.filterTimer);
+
+                    if (character === prev) {
+                        skip = true;
+                    } else {
+                        character = prev + character;
+                    }
+
+                    regex = new RegExp("^" + escape(character), "i");
+                    match = this.activeMenu.children(".ui-menu-item").filter(function () {
+                        return regex.test($(this).children("a").text());
+                    });
+                    match = skip && match.index(this.active.next()) !== -1 ?
+                        this.active.nextAll(".ui-menu-item") :
+                        match;
+
+                    // If no matches on the current filter, reset to the last character pressed
+                    // to move down the menu to the first item that starts with that character
+                    if (!match.length) {
+                        character = String.fromCharCode(event.keyCode);
+                        regex = new RegExp("^" + escape(character), "i");
+                        match = this.activeMenu.children(".ui-menu-item").filter(function () {
+                            return regex.test($(this).children("a").text());
+                        });
+                    }
+
+                    if (match.length) {
+                        this.focus(event, match);
+                        if (match.length > 1) {
+                            this.previousFilter = character;
+                            this.filterTimer = this._delay(function () {
+                                delete this.previousFilter;
+                            }, 1000);
+                        } else {
+                            delete this.previousFilter;
+                        }
+                    } else {
+                        delete this.previousFilter;
+                    }
+            }
+
+            if (preventDefault) {
+                event.preventDefault();
+            }
+        },
+
+        _activate: function (event) {
+            if (!this.active.is(".ui-state-disabled")) {
+                if (this.active.children("a[aria-haspopup='true']").length) {
+                    this.expand(event);
+                } else {
+                    this.select(event);
+                }
+            }
+        },
+
+        refresh: function () {
+            var menus,
+                icon = this.options.icons.submenu,
+                submenus = this.element.find(this.options.menus);
+
+            // Initialize nested menus
+            submenus.filter(":not(.ui-menu)")
+                .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
+                .hide()
+                .attr({
+                    role: this.options.role,
+                    "aria-hidden": "true",
+                    "aria-expanded": "false"
+                })
+                .each(function () {
+                    var menu = $(this),
+                        item = menu.prev("a"),
+                        submenuCarat = $("<span>")
+                            .addClass("ui-menu-icon ui-icon " + icon)
+                            .data("ui-menu-submenu-carat", true);
+
+                    item
+                        .attr("aria-haspopup", "true")
+                        .prepend(submenuCarat);
+                    menu.attr("aria-labelledby", item.attr("id"));
+                });
+
+            menus = submenus.add(this.element);
+
+            // Don't refresh list items that are already adapted
+            menus.children(":not(.ui-menu-item):has(a)")
+                .addClass("ui-menu-item")
+                .attr("role", "presentation")
+                .children("a")
+                .uniqueId()
+                .addClass("ui-corner-all")
+                .attr({
+                    tabIndex: -1,
+                    role: this._itemRole()
+                });
+
+            // Initialize unlinked menu-items containing spaces and/or dashes only as dividers
+            menus.children(":not(.ui-menu-item)").each(function () {
+                var item = $(this);
+                // hyphen, em dash, en dash
+                if (!/[^\-\u2014\u2013\s]/.test(item.text())) {
+                    item.addClass("ui-widget-content ui-menu-divider");
+                }
+            });
+
+            // Add aria-disabled attribute to any disabled menu item
+            menus.children(".ui-state-disabled").attr("aria-disabled", "true");
+
+            // If the active item has been removed, blur the menu
+            if (this.active && !$.contains(this.element[0], this.active[0])) {
+                this.blur();
+            }
+        },
+
+        _itemRole: function () {
+            return {
+                menu: "menuitem",
+                listbox: "option"
+            }[this.options.role];
+        },
+
+        _setOption: function (key, value) {
+            if (key === "icons") {
+                this.element.find(".ui-menu-icon")
+                    .removeClass(this.options.icons.submenu)
+                    .addClass(value.submenu);
+            }
+            this._super(key, value);
+        },
+
+        focus: function (event, item) {
+            var nested, focused;
+            this.blur(event, event && event.type === "focus");
+
+            this._scrollIntoView(item);
+
+            this.active = item.first();
+            focused = this.active.children("a").addClass("ui-state-focus");
+            // Only update aria-activedescendant if there's a role
+            // otherwise we assume focus is managed elsewhere
+            if (this.options.role) {
+                this.element.attr("aria-activedescendant", focused.attr("id"));
+            }
+
+            // Highlight active parent menu item, if any
+            this.active
+                .parent()
+                .closest(".ui-menu-item")
+                .children("a:first")
+                .addClass("ui-state-active");
+
+            if (event && event.type === "keydown") {
+                this._close();
+            } else {
+                this.timer = this._delay(function () {
+                    this._close();
+                }, this.delay);
+            }
+
+            nested = item.children(".ui-menu");
+            if (nested.length && ( /^mouse/.test(event.type) )) {
+                this._startOpening(nested);
+            }
+            this.activeMenu = item.parent();
+
+            this._trigger("focus", event, {item: item});
+        },
+
+        _scrollIntoView: function (item) {
+            var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+            if (this._hasScroll()) {
+                borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0;
+                paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0;
+                offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+                scroll = this.activeMenu.scrollTop();
+                elementHeight = this.activeMenu.height();
+                itemHeight = item.height();
+
+                if (offset < 0) {
+                    this.activeMenu.scrollTop(scroll + offset);
+                } else if (offset + itemHeight > elementHeight) {
+                    this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight);
+                }
+            }
+        },
+
+        blur: function (event, fromFocus) {
+            if (!fromFocus) {
+                clearTimeout(this.timer);
+            }
+
+            if (!this.active) {
+                return;
+            }
+
+            this.active.children("a").removeClass("ui-state-focus");
+            this.active = null;
+
+            this._trigger("blur", event, {item: this.active});
+        },
+
+        _startOpening: function (submenu) {
+            clearTimeout(this.timer);
+
+            // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+            // shift in the submenu position when mousing over the carat icon
+            if (submenu.attr("aria-hidden") !== "true") {
+                return;
+            }
+
+            this.timer = this._delay(function () {
+                this._close();
+                this._open(submenu);
+            }, this.delay);
+        },
+
+        _open: function (submenu) {
+            var position = $.extend({
+                of: this.active
+            }, this.options.position);
+
+            clearTimeout(this.timer);
+            this.element.find(".ui-menu").not(submenu.parents(".ui-menu"))
+                .hide()
+                .attr("aria-hidden", "true");
+
+            submenu
+                .show()
+                .removeAttr("aria-hidden")
+                .attr("aria-expanded", "true")
+                .position(position);
+        },
+
+        collapseAll: function (event, all) {
+            clearTimeout(this.timer);
+            this.timer = this._delay(function () {
+                // If we were passed an event, look for the submenu that contains the event
+                var currentMenu = all ? this.element :
+                    $(event && event.target).closest(this.element.find(".ui-menu"));
+
+                // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+                if (!currentMenu.length) {
+                    currentMenu = this.element;
+                }
+
+                this._close(currentMenu);
+
+                this.blur(event);
+                this.activeMenu = currentMenu;
+            }, this.delay);
+        },
+
+        // With no arguments, closes the currently active menu - if nothing is active
+        // it closes all menus.  If passed an argument, it will search for menus BELOW
+        _close: function (startMenu) {
+            if (!startMenu) {
+                startMenu = this.active ? this.active.parent() : this.element;
+            }
+
+            startMenu
+                .find(".ui-menu")
+                .hide()
+                .attr("aria-hidden", "true")
+                .attr("aria-expanded", "false")
+                .end()
+                .find("a.ui-state-active")
+                .removeClass("ui-state-active");
+        },
+
+        collapse: function (event) {
+            var newItem = this.active &&
+                this.active.parent().closest(".ui-menu-item", this.element);
+            if (newItem && newItem.length) {
+                this._close();
+                this.focus(event, newItem);
+            }
+        },
+
+        expand: function (event) {
+            var newItem = this.active &&
+                this.active
+                    .children(".ui-menu ")
+                    .children(".ui-menu-item")
+                    .first();
+
+            if (newItem && newItem.length) {
+                this._open(newItem.parent());
+
+                // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+                this._delay(function () {
+                    this.focus(event, newItem);
+                });
+            }
+        },
+
+        next: function (event) {
+            this._move("next", "first", event);
+        },
+
+        previous: function (event) {
+            this._move("prev", "last", event);
+        },
+
+        isFirstItem: function () {
+            return this.active && !this.active.prevAll(".ui-menu-item").length;
+        },
+
+        isLastItem: function () {
+            return this.active && !this.active.nextAll(".ui-menu-item").length;
+        },
+
+        _move: function (direction, filter, event) {
+            var next;
+            if (this.active) {
+                if (direction === "first" || direction === "last") {
+                    next = this.active
+                        [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item")
+                        .eq(-1);
+                } else {
+                    next = this.active
+                        [direction + "All"](".ui-menu-item")
+                        .eq(0);
+                }
+            }
+            if (!next || !next.length || !this.active) {
+                next = this.activeMenu.children(".ui-menu-item")[filter]();
+            }
+
+            this.focus(event, next);
+        },
+
+        nextPage: function (event) {
+            var item, base, height;
+
+            if (!this.active) {
+                this.next(event);
+                return;
+            }
+            if (this.isLastItem()) {
+                return;
+            }
+            if (this._hasScroll()) {
+                base = this.active.offset().top;
+                height = this.element.height();
+                this.active.nextAll(".ui-menu-item").each(function () {
+                    item = $(this);
+                    return item.offset().top - base - height < 0;
+                });
+
+                this.focus(event, item);
+            } else {
+                this.focus(event, this.activeMenu.children(".ui-menu-item")
+                    [!this.active ? "first" : "last"]());
+            }
+        },
+
+        previousPage: function (event) {
+            var item, base, height;
+            if (!this.active) {
+                this.next(event);
+                return;
+            }
+            if (this.isFirstItem()) {
+                return;
+            }
+            if (this._hasScroll()) {
+                base = this.active.offset().top;
+                height = this.element.height();
+                this.active.prevAll(".ui-menu-item").each(function () {
+                    item = $(this);
+                    return item.offset().top - base + height > 0;
+                });
+
+                this.focus(event, item);
+            } else {
+                this.focus(event, this.activeMenu.children(".ui-menu-item").first());
+            }
+        },
+
+        _hasScroll: function () {
+            return this.element.outerHeight() < this.element.prop("scrollHeight");
+        },
+
+        select: function (event) {
+            // TODO: It should never be possible to not have an active item at this
+            // point, but the tests don't trigger mouseenter before click.
+            this.active = this.active || $(event.target).closest(".ui-menu-item");
+            var ui = {item: this.active};
+            if (!this.active.has(".ui-menu").length) {
+                this.collapseAll(event, true);
+            }
+            this._trigger("select", event, ui);
+        }
+    });
+}));
\ No newline at end of file
diff --git a/lib/web/mage/backend/notification.js b/lib/web/mage/backend/notification.js
index cc91d5ff3968acc33d2d7b3515d2cf2331068616..c1c07c4fb2e505140deb5729fa5c6f773305c34e 100644
--- a/lib/web/mage/backend/notification.js
+++ b/lib/web/mage/backend/notification.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true browser:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+
     $.widget("mage.notification", {
         options: {
             templates: {
@@ -56,4 +61,5 @@
             } catch(e) {}
         }
     });
-})(jQuery);
+
+});
diff --git a/lib/web/mage/backend/suggest.js b/lib/web/mage/backend/suggest.js
index 102da0d944e207a24498a3077aa0c5b00220f839..2629e08e71413d95f74316a4c477958d5dd4a9a3 100644
--- a/lib/web/mage/backend/suggest.js
+++ b/lib/web/mage/backend/suggest.js
@@ -21,9 +21,21 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true browser:true*/
-
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template",
+            "mage/backend/menu",
+            "mage/translate"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     'use strict';
+
     /**
      * Implement base functionality
      */
@@ -1024,4 +1036,4 @@
                 }, this));
         }
     });
-})(jQuery);
+}));
\ No newline at end of file
diff --git a/lib/web/mage/backend/tabs.js b/lib/web/mage/backend/tabs.js
index 3ee936d2ed64f160c5f196f21b9b37f716d15ba0..fc623ea06cbbfc9f45c1f10c9a90bf0ac9cb29cf 100644
--- a/lib/web/mage/backend/tabs.js
+++ b/lib/web/mage/backend/tabs.js
@@ -22,8 +22,18 @@
  */
 /*jshint jquery:true browser:true*/
 /*global FORM_KEY:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     'use strict';
+
     // mage.tabs base functionality
     $.widget('mage.tabs', $.ui.tabs, {
         options: {
@@ -358,4 +368,4 @@
             }
         }
     });
-})(jQuery);
+}));
diff --git a/lib/web/mage/backend/tree-suggest.js b/lib/web/mage/backend/tree-suggest.js
index dbb0c1d7deb96567bd4d6b731433fd1f352ef088..1e548faa3b04707779fe7e326c69c2321949a326 100644
--- a/lib/web/mage/backend/tree-suggest.js
+++ b/lib/web/mage/backend/tree-suggest.js
@@ -21,8 +21,21 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true browser:true*/
-(function($) {
-    'use strict';
+(function (factory) {
+    if (typeof define === "function" && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template",
+            "jquery/jstree/jquery.jstree",
+            "mage/backend/suggest"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
+    "use strict";
+
     $.extend(true, $, {
         // @TODO: Move method 'treeToList' in file with utility functions
         mage: {
@@ -210,4 +223,4 @@
             this._superApply([e, items, context]);
         }
     });
-})(jQuery);
+}));
\ No newline at end of file
diff --git a/lib/web/mage/backend/validation.js b/lib/web/mage/backend/validation.js
index 507f35d9ba488f95ce463c52d7193e8144e3536f..ae008f7aff7c8dc2c78ddacb46568b838c80ca13 100644
--- a/lib/web/mage/backend/validation.js
+++ b/lib/web/mage/backend/validation.js
@@ -22,7 +22,19 @@
  */
 /*jshint jquery:true browser:true*/
 /*global BASE_URL:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/validate",
+            "mage/translate",
+            "mage/validation"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     $.extend(true, $.validator.prototype, {
         /**
          * Focus invalid fields
@@ -161,4 +173,4 @@
             }
         }
     });
-})(jQuery);
+}));
diff --git a/lib/web/mage/bootstrap.js b/lib/web/mage/bootstrap.js
index f4e14334b10a54fba891faca589cc1e8eb4c71d3..c6cbc1f460202696c65339b33fd8b3df330e08fe 100644
--- a/lib/web/mage/bootstrap.js
+++ b/lib/web/mage/bootstrap.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true browser:true */
-jQuery(function ($, console) {
+define([
+    "jquery",
+    "mage/mage"
+], function($){
     'use strict';
+    
     $.ajaxSetup({
         cache: false
     });
@@ -36,4 +40,5 @@ jQuery(function ($, console) {
     };
 
     $(bootstrap);
+
 });
diff --git a/lib/web/mage/calendar.js b/lib/web/mage/calendar.js
index fc352f3bbff3b1cb18c203f3b361fe443df810c7..dc3743ab14a32f3daaef960af3f992b993ef9f7e 100644
--- a/lib/web/mage/calendar.js
+++ b/lib/web/mage/calendar.js
@@ -21,8 +21,17 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function($) {
-
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/jquery-ui-timepicker-addon"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     /**
      * Widget calendar
      */
@@ -231,4 +240,4 @@
         $.datepicker._selectDate.call(this, el);
         $(el).blur();   // To ensure that user can re-select date field without clicking outside it first.
     };
-})(jQuery);
+}));
diff --git a/lib/web/mage/collapsible.js b/lib/web/mage/collapsible.js
index cdf942464352904aea7f09cc777c115235620388..048e4cc7759d99292301a990160ff82f8235861d 100644
--- a/lib/web/mage/collapsible.js
+++ b/lib/web/mage/collapsible.js
@@ -20,11 +20,12 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-
-(function ($, undefined) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
-
+    
     var hideProps = {},
         showProps = {};
 
@@ -406,4 +407,4 @@
         }
 
     });
-})(jQuery);
+});
diff --git a/lib/web/mage/components.js b/lib/web/mage/components.js
new file mode 100644
index 0000000000000000000000000000000000000000..cbd757e331f8c9f7ef9806cd4bfe26cd0bc72ae1
--- /dev/null
+++ b/lib/web/mage/components.js
@@ -0,0 +1,132 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+define([], function() {
+    var components = {
+        productListToolbarForm: 'Magento_Catalog/js/product/list/toolbar',
+        productSummary: 'Magento_Bundle/js/product-summary',
+        toggleAdvanced: 'mage/toggle',
+        translateInline: 'mage/translate-inline',
+
+        //Authorizenet\view\frontend\templates\js\components.phtml
+        authorizenetAuthenticate: 'Magento_Authorizenet/authorizenet-authenticate',
+
+        //Bundle\view\frontend\templates\js\components.phtml
+        sticky: 'mage/sticky',
+        bundleOption: 'Magento_Bundle/bundle',
+        slide: 'Magento_Bundle/js/slide',
+
+        //Captcha\view\frontend\templates\js\components.phtml
+        captcha: 'Magento_Captcha/captcha',
+
+        //Catalog\view\frontend\templates\js\components.phtml
+        tabs: 'mage/tabs',
+        catalogSearch: 'Magento_CatalogSearch/form-mini',
+        compareItems: 'Magento_Catalog/js/compare',
+        compareList: 'Magento_Catalog/js/list',
+        fileOption: 'Magento_Catalog/js/file-option',
+        relatedProducts: 'Magento_Catalog/js/related-products',
+        upsellProducts: 'Magento_Catalog/js/upsell-products',
+        discountCode: 'Magento_Checkout/js/discount-codes',
+        catalogGallery: 'Magento_Catalog/js/gallery',
+        orderOverview: 'Magento_Checkout/js/overview',
+        rowBuilder: 'Magento_Theme/js/row-builder',
+        address: 'Magento_Customer/address',
+        priceOption: 'Magento_Catalog/js/price-option',
+        requireCookie: 'Magento_Core/js/require-cookie',
+        addToCart: 'Magento_Catalog/js/msrp',
+        tierPrice: 'Magento_Catalog/js/tier-price',
+        dateOption: 'Magento_Catalog/js/date-option',
+        zoom: 'mage/zoom',
+        gallery: 'mage/gallery',
+        galleryFullScreen: 'mage/gallery-fullscreen',
+
+        //Checkout\view\frontend\templates\js\components.phtml
+        paymentAuthentication: 'Magento_Checkout/js/payment-authentication',
+        collapsible: 'mage/collapsible',
+        dropdownDialog: 'mage/dropdown',
+        accordion: 'mage/accordion',
+        checkoutBalance: 'Magento_Customer/js/checkout-balance',
+        shoppingCart: 'Magento_Checkout/js/shopping-cart',
+        regionUpdater: 'Magento_Checkout/js/region-updater',
+        creditCardType: 'Magento_Payment/cc-type',
+        loader: 'mage/loader',
+        tooltip: 'mage/tooltip',
+        opcOrderReview: 'Magento_Checkout/js/opc-order-review',
+        sidebar: 'Magento_Checkout/js/sidebar',
+        payment: 'Magento_Checkout/js/payment',
+
+        //ConfigurableProduct\view\frontend\templates\js\components.phtml
+        configurable: 'Magento_ConfigurableProduct/js/configurable',
+
+        //Customer\view\frontend\templates\js\components.phtml
+        setPassword: 'Magento_Customer/set-password',
+
+        //Downloadable\view\frontend\templates\js\components.phtml
+        downloadable: 'Magento_Downloadable/downloadable',
+
+        //Multishipping\view\frontend\templates\js\components.phtml
+        multiShipping: 'Magento_Multishipping/js/multi-shipping',
+
+        //Newsletter\view\frontend\templates\js\components.phtml
+        newsletter: 'Magento_Newsletter/newsletter',
+
+        //PageCache\view\frontend\templates\js\components.phtml
+        formKey: 'Magento_PageCache/js/form-key',
+        pageCache: 'Magento_PageCache/js/page-cache',
+
+        //Paypal\view\frontend\templates\js\components.phtml
+        opcheckoutPaypalIframe: 'Magento_Paypal/js/opcheckout',
+        orderReview: 'Magento_Paypal/order-review',
+
+        //Reports\view\frontend\templates\js\components.phtml
+        recentlyViewedProducts: 'Magento_Reports/js/recently-viewed',
+
+        //Sales\view\frontend\templates\js\components.phtml
+        extraOptions: 'Magento_GiftMessage/extra-options',
+        giftMessage: 'Magento_Sales/gift-message',
+        giftOptions: 'Magento_GiftMessage/gift-options',
+        ordersReturns: 'Magento_Sales/orders-returns',
+
+        //Theme\view\frontend\templates\js\components.phtml
+        deletableItem: 'mage/deletable-item',
+        itemTable: 'mage/item-table',
+        fieldsetControls: 'mage/fieldset-controls',
+        fieldsetResetControl: 'mage/fieldset-controls',
+        redirectUrl: 'mage/redirect-url',
+        cookieBlock: 'Magento_Theme/js/notices',
+
+        //Wishlist\view\frontend\templates\js\components.phtml
+        wishlist: 'Magento_Wishlist/wishlist',
+        addToWishlist: 'Magento_Wishlist/js/add-to-wishlist',
+        wishlistSearch: 'Magento_Wishlist/js/search',
+
+        loaderAjax: 'mage/loader',
+        directpost: 'Magento_Authorizenet/js/direct-post',
+        menu: 'mage/menu',
+        popupWindow: 'mage/popup-window',
+        centinelAuthenticate: 'Magento_Centinel/centinel-authenticate'
+    };
+
+    return components;
+});
diff --git a/lib/web/mage/cookies.js b/lib/web/mage/cookies.js
index 19b8e1c30b1b61f76236de5124156cbdfbd6b40a..914f0a9cfe518b243162dc74b227e6dbe4215fae 100644
--- a/lib/web/mage/cookies.js
+++ b/lib/web/mage/cookies.js
@@ -21,7 +21,16 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint eqnull:true browser:true jquery:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "mage/mage"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     $.extend(true, $, {
         mage: {
             cookies: (function() {
@@ -120,4 +129,4 @@
             }())
         }
     });
-})(jQuery);
+}));
\ No newline at end of file
diff --git a/lib/web/mage/dataPost.js b/lib/web/mage/dataPost.js
index 195a3634806b6840585c2b9e5682d747ca5a24ca..3fc16c0de4bb47d3001c391749debda12748c732 100644
--- a/lib/web/mage/dataPost.js
+++ b/lib/web/mage/dataPost.js
@@ -22,7 +22,12 @@
  */
 /*jshint browser:true jquery:true*/
 /*global confirm:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+    
     $.widget('mage.dataPost', {
         options: {
             formTemplate: '<form action="${action}" method="post">{{each data}}<input name="${$index}" value="${$value}">{{/each}}</form>',
@@ -52,5 +57,6 @@
             $.tmpl(this.options.formTemplate, params).appendTo('body').hide().submit();
         }
     });
+
     $(document).dataPost();
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/lib/web/mage/decorate.js b/lib/web/mage/decorate.js
index b2d1105465a33486aad92147165bcd1a1d6f4327..219b68948642664157f1d260d4fe3efef3589afd 100644
--- a/lib/web/mage/decorate.js
+++ b/lib/web/mage/decorate.js
@@ -21,7 +21,17 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function ($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "mage/translate"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
+
     var methods = {
         /**
          * Decorate a list (e.g. a <ul> containing <li>) recursively if specified.
@@ -122,4 +132,5 @@
             $.error($.mage.__('Method ' +  method + ' does not exist on jQuery.decorate'));
         }
     };
-})(jQuery);
+
+}));
diff --git a/lib/web/mage/deletable-item.js b/lib/web/mage/deletable-item.js
index ebe10e3b56f31ae083831c408f37a851ebef78ea..4151c20ee9d4dc8dc50cb535ec734cac7e6336ae 100644
--- a/lib/web/mage/deletable-item.js
+++ b/lib/web/mage/deletable-item.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     /**
      * This widget is used to tag a DOM element as deletable. By default, it will use the click event on the item with a
      * data role of delete to trigger the deletion.
@@ -87,4 +91,4 @@
             this.element.find(this.options.deleteSelector).removeClass(this.options.hiddenClass);
         }
     });
-})(jQuery);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/lib/web/mage/dialog.js b/lib/web/mage/dialog.js
index 3306576f86810f4aff68d8937c143416c78ce704..087c491941994cbcc18feca68cd09c7e35f7cf0a 100644
--- a/lib/web/mage/dialog.js
+++ b/lib/web/mage/dialog.js
@@ -20,11 +20,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-(function($) {
-	"use strict";
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+    "use strict";
+
     /**
      * Dialog Widget - this widget is a wrapper for the jQuery UI Dialog
      */
-    $.widget('mage.dialog', $.ui.dialog, {
-    });
-})(jQuery);
\ No newline at end of file
+    $.widget('mage.dialog', $.ui.dialog, {});
+});
\ No newline at end of file
diff --git a/lib/web/mage/dropdown.js b/lib/web/mage/dropdown.js
index 55c0a217b2460024acb12deb9a91f55e0c156eec..6e07d8aaa45f85190d7ea380ff4a142b101a8797 100644
--- a/lib/web/mage/dropdown.js
+++ b/lib/web/mage/dropdown.js
@@ -21,9 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-
-(function($,undefined) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     'use strict';
+
     var timer = null;
     /**
      * Dropdown Widget - this widget is a wrapper for the jQuery UI Dialog
@@ -199,4 +202,5 @@
             }
         }
     });
-})(jQuery);
+
+});
diff --git a/lib/web/mage/dropdown_old.js b/lib/web/mage/dropdown_old.js
index f2b6bd5c2f20054c8c7e4d3cb7fd66b95c78f2c4..10cd004a9c0d6aa37a724ee52a81c4adfe1af0dc 100644
--- a/lib/web/mage/dropdown_old.js
+++ b/lib/web/mage/dropdown_old.js
@@ -21,7 +21,10 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-;(function($, document) {
+define([
+    "jquery"
+], function($){
+
     'use strict';
     var ESC_KEY_CODE = '27';
 
@@ -82,4 +85,5 @@
     $(document).ready(function() {
         $('[data-toggle=dropdown]').dropdown();
     });
-})(window.jQuery, document);
+
+});
diff --git a/lib/web/mage/dropdowns.js b/lib/web/mage/dropdowns.js
index 289b2da43354374c1e122657e1c4f9d1ce89984e..29a7b4f7e58965b8204a070d39c452ec79a73ff4 100644
--- a/lib/web/mage/dropdowns.js
+++ b/lib/web/mage/dropdowns.js
@@ -20,7 +20,9 @@
  * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-;(function($, document) {
+define([
+    "jquery"
+], function($){
     'use strict';
 
     $.fn.dropdown = function(options) {
@@ -101,4 +103,4 @@
     $(document).ready(function() {
         $('[data-toggle="dropdown"]').dropdown();
     });
-})(window.jQuery, document);
+});
\ No newline at end of file
diff --git a/lib/web/mage/edit-trigger.js b/lib/web/mage/edit-trigger.js
index dbc911296ba91d20fb6e54bc125416ff62ebad10..a57ebb402443d62d0138179dcd8edccb6d143384 100644
--- a/lib/web/mage/edit-trigger.js
+++ b/lib/web/mage/edit-trigger.js
@@ -21,7 +21,19 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function($){
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
+    "use strict";
+
     $.widget("mage.editTrigger", {
         options: {
             img: '',
@@ -177,4 +189,4 @@
             }
         }
     }));
-})(jQuery);
+}));
\ No newline at end of file
diff --git a/lib/web/mage/fieldset-controls.js b/lib/web/mage/fieldset-controls.js
index ed1060b50973d48d36b38b42b44715ad42ef3f62..3f18b4d11a6a1edee97f1c095c4c2eeae11081b7 100644
--- a/lib/web/mage/fieldset-controls.js
+++ b/lib/web/mage/fieldset-controls.js
@@ -21,7 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+    "use strict";
+
     /**
      * This widget will allow a control with the fieldsetResetControl widget attached to reset a set of input fields.
      * The input fields to reset are defined by the inputSelector selector. The widget will store a clone of the fields
@@ -72,6 +77,7 @@
             }, this));
         }
     });
+    
     $.widget('mage.fieldsetResetControl', {
         _create: function() {
             this._bind();
@@ -86,4 +92,5 @@
             $(this.element).trigger('fieldsetReset');
         }
     });
-})(jQuery);
+
+});
diff --git a/lib/web/mage/flex.js b/lib/web/mage/flex.js
deleted file mode 100644
index 4bb244d969b293829afc5f6b3b11c9fd9103e449..0000000000000000000000000000000000000000
--- a/lib/web/mage/flex.js
+++ /dev/null
@@ -1,425 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-
-/**
- * Flex maintance object
- *
- *
- */
-Flex = {};
-Flex.currentID = 0;
-Flex.uniqId = function() {
-    return 'flexMovieUID'+( ++Flex.currentID );
-};
-
-/**
- * Check flash player version for required version
- *
- * @param Number major
- * @param Number minor
- * @param Number revision
- * @return Boolean
- */
-Flex.checkFlashPlayerVersion = function(major, minor, revision) {
-    var version = Flex.getFlashPlayerVersion();
-
-    if (version === false) {
-        return false;
-    }
-
-    var requestedVersion = Flex.transformVersionToFloat([major, minor, revision], 5);
-    var currentVersion = Flex.transformVersionToFloat(version, 5);
-
-    return requestedVersion <= currentVersion;
-};
-
-/**
- * Get flash player version in internet explorer
- * by creating of test ActiveXObjects
- *
- * @return String|Boolean
- */
-Flex._getFlashPlayerVersionAsActiveX = function () {
-    var versions = [
-        {'default': '7.0.0', 'code':'ShockwaveFlash.ShockwaveFlash.7', 'variable':true},
-        {'default': '6.0.0', 'code':'ShockwaveFlash.ShockwaveFlash.6', 'variable':true, 'acceess':true},
-        {'default': '3.0.0', 'code':'ShockwaveFlash.ShockwaveFlash.3', 'variable':false},
-        {'default': '2.0.0', 'code':'ShockwaveFlash.ShockwaveFlash', 'variable':false},
-    ];
-
-    var detector = function (options) {
-        var activeXObject = new ActiveXObject(options.code);
-        if (options.access && options.variable) {
-            activeXObject.AllowScriptAccess = 'always';
-        }
-
-        if (options.variable) {
-            return activeXObject.GetVariable('$version');
-        }
-
-        return options['default'];
-    }
-
-    var version = false;
-
-    for (var i = 0, l = versions.length; i < l; i++) {
-        try {
-            version = detector(versions[i]);
-            return version;
-        } catch (e) {}
-    }
-
-    return false;
-};
-
-/**
- * Transforms version string like 1.0.0 to array [1,0,0]
- *
- * @param String|Array version
- * @return Array|Boolean
- */
-Flex.transformVersionToArray = function (version) {
-    if (!Object.isString(version)) {
-        return false;
-    }
-
-    var versions = version.match(/[\d]+/g);
-
-    if (versions.length > 3) {
-        return versions.slice(0,3);
-    } else if (versions.length) {
-        return versions;
-    }
-
-
-
-    return false;
-};
-
-/**
- * Transforms version string like 1.1.1 to float 1.00010001
- *
- * @param String|Array version
- * @param Number range - percition range between version digits
- * @return Array
- */
-Flex.transformVersionToFloat = function (version, range) {
-    if (Object.isString(version)) {
-        version = Flex.transformVersionToArray(version)
-    }
-
-    if (Object.isArray(version)) {
-        var result = 0;
-        for (var i =0, l=version.length; i < l; i++) {
-            result += parseFloat(version[i]) / Math.pow(10, range*i);
-        }
-
-        return result;
-    }
-
-    return false;
-};
-
-/**
- * Return flash player version as array of 0=major, 1=minor, 2=revision
- *
- * @return Array|Boolean
- */
-Flex.getFlashPlayerVersion = function () {
-    if (Flex.flashPlayerVersion) {
-        return Flex.flashPlayerVersion;
-    }
-
-    var version = false;
-    if (navigator.plugins != null && navigator.plugins.length > 0) {
-       if (navigator.mimeTypes && navigator.mimeTypes.length > 0) {
-          if (navigator.mimeTypes['application/x-shockwave-flash'] &&
-              !navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
-             return false;
-          }
-       }
-       var flashPlugin = navigator.plugins['Shockwave Flash'] || navigator.plugins['Shockwave Flash 2.0'];
-       version = Flex.transformVersionToArray(flashPlugin.description);
-    } else {
-       version = Flex.transformVersionToArray(Flex._getFlashPlayerVersionAsActiveX());
-    }
-
-    Flex.flashPlayerVersion = version;
-    return version;
-};
-
-Flex.Object = Class.create({
-    /**
-     * Initialize object from configuration, where configuration keys,
-     * is set of tag attributes for object or embed
-     *
-     * @example
-     * new Flex.Object({'src':'path/to/flashmovie.swf'});
-     *
-     * @param Object config
-     * @return void
-     */
-    initialize: function (config) {
-        this.isIE  = Prototype.Browser.IE;
-        this.isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
-        this.attributes = {
-             quality:"high",
-             pluginspage: "http://www.adobe.com/go/getflashplayer",
-             type: "application/x-shockwave-flash",
-             allowScriptAccess: "always",
-             classid: "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
-        };
-        this.bridgeName = '';
-        this.bridge = false;
-        this.setAttributes( config );
-        this.applied = false;
-
-        var myTemplatesPattern = /(^|.|\r|\n)(\{(.*?)\})/;
-        if(this.detectFlashVersion(9, 0, 28)) {
-            if(this.isIE) {
-                this.template = new Template( '<object {objectAttributes}><param name="allowFullScreen" value="true"/>{objectParameters}</object>', myTemplatesPattern )
-            } else {
-                this.template = new Template( '<embed {embedAttributes} allowfullscreen="true" />', myTemplatesPattern );
-            }
-        } else {
-            this.template = new Template(  'This content requires the Adobe Flash Player. '
-                                               +' <a href=http://www.adobe.com/go/getflash/>Get Flash</a>', myTemplatesPattern );
-        }
-
-        this.parametersTemplate = new Template( '<param name="{name}" value="{value}" />', myTemplatesPattern );
-        this.attributesTemplate = new Template( ' {name}="{value}" ', myTemplatesPattern );
-    },
-    /**
-     * Set object attribute for generation of html tags
-     *
-     * @param String name
-     * @param Object value
-     * @return void
-     */
-    setAttribute : function( name, value ) {
-        if(!this.applied) {
-            this.attributes[name] = value;
-        }
-    },
-    /**
-     * Retrieve object attribute value used for generation in html tags
-     *
-     * @param String name
-     * @return Object
-     */
-    getAttribute : function( name ) {
-        return this.attributes[name];
-    },
-    /**
-     * Set object attributes in one call
-     *
-     * @param Object attributesList
-     * @return void
-     */
-    setAttributes : function( attributesList ) {
-        $H(attributesList).each(function(pair){
-            this.setAttribute(pair.key, pair.value);
-        }.bind(this));
-    },
-    /**
-     * Retrieve all object attributes
-     *
-     * @return Object
-     */
-    getAttributes : function( ) {
-        return this.attributes;
-    },
-    /**
-     * Applies generated HTML content to specified HTML tag
-     *
-     * @param String|DOMELement container
-     * @return void
-     */
-    apply : function(container) {
-        if (!this.applied)    {
-            this.setAttribute("id", Flex.uniqId());
-            this.preInitBridge();
-            var readyHTML = this.template.evaluate(this.generateTemplateValues());
-            $(container).update(readyHTML);
-        }
-        this.applied = true;
-    },
-    /**
-     * Applies generated HTML content to window.document
-     *
-     * @return void
-     */
-    applyWrite : function( ) {
-        if (!this.applied)    {
-            this.setAttribute( "id", Flex.uniqId());
-            this.preInitBridge();
-            var readyHTML = this.template.evaluate( this.generateTemplateValues() );
-            document.write( readyHTML );
-        }
-        this.applied = true;
-    },
-    /**
-     * Preinitialize FABridge values
-     *
-     * @return void
-     */
-    preInitBridge: function () {
-        this.bridgeName = this.getAttribute('id') + 'bridge';
-        var flashVars = this.getAttribute('flashVars') || this.getAttribute('flashvars') || '';
-        if (flashVars != '') {
-            flashVars += '&';
-        }
-        flashVars += 'bridgeName=' + this.bridgeName;
-        this.setAttribute('flashVars', flashVars);
-        var scopeObj = this;
-        FABridge.addInitializationCallback(
-             this.bridgeName,
-             function () {
-                 scopeObj.bridge = this.root();
-                 scopeObj.initBridge();
-             }
-        );
-    },
-    /**
-     * Initialize bridge callback passed to FABridge,
-     * calls internal callback if it's presented
-     *
-     * @return void
-     */
-    initBridge: function() {
-        if(this.onBridgeInit) {
-            this.onBridgeInit(this.getBridge());
-        }
-    },
-    /**
-     * Retrieve FABridge instance for this object
-     *
-     * @return Object
-     */
-    getBridge : function() {
-        return this.bridge;
-    },
-    /**
-     * Generate temaplate values object for creation of flash player plugin movie HTML
-     *
-     * @return Object
-     */
-    generateTemplateValues : function() {
-        var attributesMap = {
-            embed: {
-                'movie':'src',
-                'id':'name',
-                'flashvars': 'flashVars',
-                'classid':false,
-                'codebase':false
-            },
-            object: {
-                'pluginspage':false,
-                'src':'movie',
-                'flashvars': 'flashVars',
-                'type':false,
-                'inline': [
-                    'type', 'classid', 'codebase', 'id', 'width', 'height',
-                    'align', 'vspace', 'hspace', 'class', 'title', 'accesskey', 'name',
-                    'tabindex'
-                ]
-            }
-        };
-        var embedAttributes = {};
-        var objectAttributes = {};
-        var parameters = {};
-        $H(this.attributes).each(function(pair) {
-            var attributeName = pair.key.toLowerCase();
-            this.attributes[pair.key] = this.escapeAttributes(pair.value);
-
-            // Retrieve mapped attribute names
-            var attributeNameInObject = (attributesMap.object[attributeName] ? attributesMap.object[attributeName] : attributeName);
-            var attributeNameInEmbed = (attributesMap.embed[attributeName] ? attributesMap.embed[attributeName] : attributeName);
-
-            if (attributesMap.object[attributeName] !== false) {
-                if (attributesMap.object.inline.indexOf(attributeNameInObject) !== -1) { // If it included in default object attribute
-                    objectAttributes[attributeNameInObject] = this.attributes[pair.key];
-                } else { // otherwise add it to parameters tag list
-                    parameters[attributeNameInObject] = this.attributes[pair.key];
-                }
-            }
-
-            if (attributesMap.embed[attributeName] !== false) { // If this attribute not ignored for flash in Gecko Browsers
-                embedAttributes[attributeNameInEmbed] = this.attributes[pair.key];
-            }
-        }.bind(this));
-
-        var result = {
-            objectAttributes: '',
-            objectParameters: '',
-            embedAttributes : ''
-        };
-
-
-        $H(objectAttributes).each(function(pair){
-             result.objectAttributes += this.attributesTemplate.evaluate({
-                 name:pair.key,
-                 value:pair.value
-             });
-        }.bind(this));
-
-        $H(embedAttributes).each(function(pair){
-             result.embedAttributes += this.attributesTemplate.evaluate({
-                 name:pair.key,
-                 value:pair.value
-             });
-        }.bind(this));
-
-        $H(parameters).each(function(pair){
-             result.objectParameters += this.parametersTemplate.evaluate({
-                 name:pair.key,
-                 value:pair.value
-             });
-        }.bind(this));
-
-        return result;
-    },
-    /**
-     * Escapes attributes for generation of valid HTML
-     *
-     * @return String
-     */
-    escapeAttributes: function (value) {
-        if(typeof value == 'string') {
-            return value.escapeHTML();
-        } else {
-            return value;
-        }
-    },
-    /**
-     * Detects needed flash player version
-     *
-     * @param Number major
-     * @param Number minor
-     * @param Number revision
-     * @return Boolean
-     */
-    detectFlashVersion: function (major, minor, revision) {
-        return Flex.checkFlashPlayerVersion(major, minor, revision);
-    }
-});
diff --git a/lib/web/mage/gallery-fullscreen.js b/lib/web/mage/gallery-fullscreen.js
index b758c5f81b96f44a4c3a6209b2c465c620e8944d..9f0b2527c7aaf9dfb12a17c5572982f76a3c9a98 100644
--- a/lib/web/mage/gallery-fullscreen.js
+++ b/lib/web/mage/gallery-fullscreen.js
@@ -20,9 +20,19 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "mage/gallery"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+
     /**
      * An auxiliary widget
      * Wraps gallery into dialog widget and opens the dialog in fullscreen mode
@@ -73,4 +83,4 @@
                 });
         }
     });
-})(jQuery);
\ No newline at end of file
+}));
\ No newline at end of file
diff --git a/lib/web/mage/gallery.js b/lib/web/mage/gallery.js
index 93b8bfe9918bdc531efa0090aa0e5b91858ae784..6f5137a144151fa840aa97e3da6a92b2cdac0bfb 100644
--- a/lib/web/mage/gallery.js
+++ b/lib/web/mage/gallery.js
@@ -27,9 +27,19 @@
 
  @TODO: - Add more effects;
  */
-
-(function($){
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+
     $.widget('mage.gallery', {
         options: {
             images: null,
@@ -348,4 +358,4 @@
                 .prepend(this._renderControl(control));
         }
     });
-})(jQuery);
\ No newline at end of file
+}));
\ No newline at end of file
diff --git a/lib/web/mage/item-table.js b/lib/web/mage/item-table.js
index a5762f01d1059bec203a1d189449207724b95165..85ee44841bd52d350f8102791c089fd198e8ee86 100644
--- a/lib/web/mage/item-table.js
+++ b/lib/web/mage/item-table.js
@@ -21,7 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template"
+], function($){
+    "use strict";
+
     $.widget('mage.itemTable', {
         options: {
             addBlock: '[data-template="add-block"]',
@@ -135,4 +141,5 @@
             }
         }
     });
-})(jQuery);
\ No newline at end of file
+
+});
\ No newline at end of file
diff --git a/lib/web/mage/list.js b/lib/web/mage/list.js
index 13d2bce298145486cf8a0ef064ce2f93b4f56f3d..51081c1f33526942c9ab466448139f6526664f2c 100644
--- a/lib/web/mage/list.js
+++ b/lib/web/mage/list.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
  /*global Handlebars*/
- (function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+
     $.widget('mage.list', {
         options: {
             template: '[data-role=item]', //template for item,
@@ -124,4 +128,4 @@
 
     });
 
-})(jQuery);
+});
\ No newline at end of file
diff --git a/lib/web/mage/loader.js b/lib/web/mage/loader.js
index 9c7e78ee8e98f6f2a6fe530404adc99436403d29..9b72975cd70963863e804c344425a12158f0c293 100644
--- a/lib/web/mage/loader.js
+++ b/lib/web/mage/loader.js
@@ -22,7 +22,14 @@
  */
 /*jshint browser:true jquery:true */
 /*global console:true*/
-(function($) {
+define([
+    "jquery",
+    "handlebars",
+    "jquery/ui",
+    "jquery/template",
+    "mage/translate"
+], function($){
+
     $.widget("mage.loader", {
         loaderStarted: 0,
         spinnerTemplate: $(undefined),
@@ -196,4 +203,5 @@
         }
 
     });
-})(jQuery);
+
+});
diff --git a/lib/web/mage/loader_old.js b/lib/web/mage/loader_old.js
index b1b5c96d10b10fdcb14bcb5c1b1fcdb70ced009e..dc53d813090e77d3a9ad545b9b242f5e310ce597 100644
--- a/lib/web/mage/loader_old.js
+++ b/lib/web/mage/loader_old.js
@@ -22,7 +22,18 @@
  */
 /*jshint browser:true jquery:true */
 /*global console:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template",
+            "mage/translate"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     $.widget("mage.loader", {
         loaderStarted: 0,
         spinner: $(undefined),
@@ -180,6 +191,5 @@
                 this._getJqueryObj(settings.loaderContext).trigger('processStop');
             }
         }
-
     });
-})(jQuery);
+}));
diff --git a/lib/web/mage/mage.js b/lib/web/mage/mage.js
index 344631536caced9d9486f81b636b8644030a5c24..dac3a1f72ec92b83c99cfb78378076677796f93e 100644
--- a/lib/web/mage/mage.js
+++ b/lib/web/mage/mage.js
@@ -20,10 +20,20 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-/*jshint eqnull:true browser:true jquery:true*/
-/*global head:true console:true*/
-(function($) {
+/*jshint eqnull:true browser:true jquery:true */
+/*global require:true console:true*/
+(function (factory) {
+    if (typeof define === "function" && define.amd) {
+        define([
+            "jquery",
+            "mage/components"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+
     /**
      * Store developer mode flag value
      * @type {boolean}
@@ -48,13 +58,10 @@
             return _isDevMode && typeof console !== 'undefined';
         }
     };
-})(jQuery);
 
 /**
  * Plugin mage and group of helpers for it
  */
-(function($) {
-    "use strict";
     /**
      * Plugin mage, initialize components on elements
      * @param {string} name - component name
@@ -87,28 +94,6 @@
      */
     var _resources = {};
 
-    /**
-     * Execute initialization callback when all resources are loaded
-     * @param {Array} args - list of resources
-     * @param {(Function|undefined)} handler - initialization callback
-     * @private
-     */
-    function _onload(args, handler) {
-        args = $.grep(args, function(resource) {
-            var script = $('script[src="' + resource + '"]');
-            return !script.length || typeof script[0].onload === 'function';
-        });
-
-        if (typeof handler === 'function' && args.length) {
-            args.push(handler);
-        }
-
-        if (args.length) {
-            head.js.apply(head, args);
-        } else if (typeof handler === 'function') {
-            handler();
-        }
-    }
 
     /**
      * Run initialization of a component
@@ -142,7 +127,8 @@
                 console.error('Cannot initialize components "' + init.name + '"');
             }
         }, $(this));
-        _onload(init.resources, handler);
+
+        require(init.resources, handler);
     }
 
     /**
@@ -197,10 +183,19 @@
          */
         component: function(component) {
             if ($.isPlainObject(component)) {
+
+                for(var name in component){
+                    
+                    if(typeof component[name] === 'string' ){
+                        component[name] = [ component[name] ];
+                    }
+                }
+
                 $.extend(_resources, component);
             } else if (typeof component === 'string' && arguments[1]) {
                 _resources[component] = $.makeArray(arguments[1]);
             }
+
             return this;
         },
 
@@ -235,36 +230,35 @@
         load: function() {
             $.each(arguments, function(i, component) {
                 if (_resources[component] && _resources[component].length) {
-                    _onload(_resources[component]);
+                    require( _resources[component] );
                 }
             });
             return this;
         }
     });
-})(jQuery);
 
-(function($, window) {
-    "use strict";
+    
     $.extend($.mage, {
-            /**
-             * Method handling redirects and page refresh
-             * @param {String} url - redirect URL
-             * @param {(undefined|String)} type - 'assign', 'reload', 'replace'
-             * @param {(undefined|Number)} timeout - timeout in milliseconds before processing the redirect or reload
-             * @param {(undefined|Boolean)} forced - true|false used for 'reload' only
-             */
-            redirect: function(url, type, timeout, forced) {
-                forced = forced ? true : false;
-                timeout = timeout ? timeout : 0;
-                type = type ? type : "assign";
-                var _redirect = function() {
-                    window.location[type](type === 'reload' ? forced : url);
-                };
-                if (timeout) {
-                    setTimeout(_redirect, timeout);
-                } else {
-                    _redirect();
-                }
+        /**
+         * Method handling redirects and page refresh
+         * @param {String} url - redirect URL
+         * @param {(undefined|String)} type - 'assign', 'reload', 'replace'
+         * @param {(undefined|Number)} timeout - timeout in milliseconds before processing the redirect or reload
+         * @param {(undefined|Boolean)} forced - true|false used for 'reload' only
+         */
+        redirect: function(url, type, timeout, forced) {
+            forced = forced ? true : false;
+            timeout = timeout ? timeout : 0;
+            type = type ? type : "assign";
+            var _redirect = function() {
+                window.location[type](type === 'reload' ? forced : url);
+            };
+            if (timeout) {
+                setTimeout(_redirect, timeout);
+            } else {
+                _redirect();
             }
+        }
     });
-})(jQuery, window);
+
+}));
\ No newline at end of file
diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js
index b43685a1eb0bbfdca519360424b7af1fb4e0902c..cc8061f60de1c9cbef742811cdb40154e47e6248 100644
--- a/lib/web/mage/menu.js
+++ b/lib/web/mage/menu.js
@@ -21,8 +21,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
  /*global mediaCheck*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui",
+    "jquery/jquery.mobile.custom"
+], function($){
     'use strict';
+
     /**
      * Menu Widget - this widget is a wrapper for the jQuery UI Menu
      */
@@ -485,4 +490,4 @@
         }
     });
 
-})(jQuery);
+});
diff --git a/lib/web/mage/popup-window.js b/lib/web/mage/popup-window.js
index 228a24c8d12a40ab31a6be76232ec6355e3473d0..2bf75f8cebe13a2674122ec3118fa672b20072e0 100644
--- a/lib/web/mage/popup-window.js
+++ b/lib/web/mage/popup-window.js
@@ -21,8 +21,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($, window, document) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
+    
     $.widget('mage.popupWindow', {
         options: {
             centerBrowser: 0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
@@ -84,4 +88,5 @@
             event.preventDefault();
         }
     });
-})(jQuery, window, document);
+
+});
diff --git a/lib/web/mage/proxy-event.js b/lib/web/mage/proxy-event.js
deleted file mode 100644
index 60a0acd9b2e722b3ae9c763bde854abfe89fc512..0000000000000000000000000000000000000000
--- a/lib/web/mage/proxy-event.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE_AFL.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
- */
-/*jshint browser:true jquery:true*/
-(function($) {
-    $.widget("mage.proxyEvent", {
-        /**
-         * Proxy creation
-         * @protected
-         */
-        _create: function() {
-            $.each(this.options.events || {}, $.proxy(function(eventName, options) {
-                if (typeof eventName != 'string') {
-                    throw new Error('Event name mast be string type');
-                }
-
-                options = $.extend({
-                    preventDefault: true,
-                    stopPropagation: false,
-                    to: 'body'
-                }, options);
-
-                this.element.on(eventName, function(event, data) {
-                    if (options.preventDefault) {
-                        event.preventDefault();
-                    }
-                    if (options.stopPropagation) {
-                        event.stopPropagation();
-                    }
-                    $(options.to).trigger(options.event || event, data);
-                });
-
-            }, this));
-        }
-    });
-})(jQuery);
diff --git a/lib/web/mage/redirect-url.js b/lib/web/mage/redirect-url.js
index 94881eb607c59f45f06b3f8cc024d81c26420c0d..9c6061bb8757161c34c6e149ad8dc208c69702c8 100644
--- a/lib/web/mage/redirect-url.js
+++ b/lib/web/mage/redirect-url.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function ($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+
     $.widget('mage.redirectUrl', {
         options: {
             event: 'click',
@@ -58,4 +62,5 @@
             }
         }
     });
-})(jQuery);
+
+});
\ No newline at end of file
diff --git a/lib/web/mage/sticky.js b/lib/web/mage/sticky.js
index e3ce9c4c9c63b9d86e9f3324592e13bef14a9ed0..4e3a075c2993bf485c1288c02061d02aecd47686 100644
--- a/lib/web/mage/sticky.js
+++ b/lib/web/mage/sticky.js
@@ -21,7 +21,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($, window) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
+    
     $.widget('mage.sticky', {
         options: {
             container: ''
@@ -56,4 +60,5 @@
             }
         }
     });
-})(jQuery, window);
+
+});
diff --git a/lib/web/mage/tabs.js b/lib/web/mage/tabs.js
index 4bc3a2e116fd44ae3db3d4297771edc905176da2..6eb059790c1ab4514d58f3ecfba8e548cf308af6 100644
--- a/lib/web/mage/tabs.js
+++ b/lib/web/mage/tabs.js
@@ -20,9 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function ($, undefined) {
+define([
+    "jquery",
+    "jquery/ui",
+    "mage/collapsible"
+], function($){
     "use strict";
+        
     $.widget("mage.tabs", {
         options: {
             active: 0,
@@ -96,7 +100,7 @@
         _processTabIndex: function() {
             var self = this;
             self.triggers.attr("tabIndex",-1);
-            $.each(this.collapsibles, function(i) {
+            $.each(this.collapsibles, function(i) {                
                 if(!$(this).collapsible("option","disabled")) {
                     self.triggers.eq(i).attr("tabIndex", 0);
                     return false;
@@ -159,14 +163,14 @@
          * @private
          */
         _instantiateCollapsible: function(element,index,active,disabled) {
-            $(element).mage('collapsible',
+            $(element).collapsible(
                 $.extend({}, this.options, {
                     active: active,
                     disabled: disabled,
                     header: this.headers.eq(index),
                     content: this.contents.eq(index),
-                    trigger: this.triggers.eq(index)})
-            );
+                    trigger: this.triggers.eq(index)}
+                ));
         },
 
         /**
@@ -283,4 +287,4 @@
             this._on(this.triggers, events);
         }
     });
-})(jQuery);
+});
diff --git a/lib/web/mage/terms.js b/lib/web/mage/terms.js
index 223c30d48382da0b5e23f822b1180fb30138d26b..0e280faf82d2a49d6ae63a3893fb3a2e0063e220 100644
--- a/lib/web/mage/terms.js
+++ b/lib/web/mage/terms.js
@@ -20,7 +20,10 @@
  * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-;(function($, document) {
+define([
+    "jquery"
+], function($){
+
     'use strict';
 
     $.fn.terms = function(args){
@@ -159,4 +162,4 @@
         $('[data-sections]').terms();
     });
 
-})(window.jQuery, document);
+});
diff --git a/lib/web/mage/toggle.js b/lib/web/mage/toggle.js
index ecb692065faf33758b6555b0ffd6d5742971d4f6..25eb3cb4c97ba75dee67f50da2c07827e94e79bd 100644
--- a/lib/web/mage/toggle.js
+++ b/lib/web/mage/toggle.js
@@ -21,7 +21,10 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
     "use strict";
 
     $.widget("mage.toggleAdvanced", {
@@ -196,4 +199,4 @@
         }
     });
 
-})(jQuery);
+});
diff --git a/lib/web/mage/tooltip.js b/lib/web/mage/tooltip.js
index 1baa87d9473b89b9337e20571490b2ed4bc2f408..87b6c667ba467860e5986924ed73cc22add33ad8 100644
--- a/lib/web/mage/tooltip.js
+++ b/lib/web/mage/tooltip.js
@@ -20,10 +20,13 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+define([
+    "jquery",
+    "jquery/ui"
+], function($){
 	'use strict';
+	
 	//Widget Wrapper
 	$.widget('mage.tooltip', $.ui.tooltip, {
 	});
-})(jQuery);
+});
diff --git a/lib/web/mage/translate-inline-vde.js b/lib/web/mage/translate-inline-vde.js
index e417adf7a219206382d8337539a3c5cf0986f57c..153d2327a4daca5fccbc0dce199a5fe3836e29ef 100644
--- a/lib/web/mage/translate-inline-vde.js
+++ b/lib/web/mage/translate-inline-vde.js
@@ -21,7 +21,18 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function($, window) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+    "jquery",
+    "jquery/ui",
+    "jquery/template",
+    "mage/translate-inline"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     /**
      * Widget for a dialog to edit translations.
      */
@@ -522,5 +533,4 @@
             }
         }
     });
-})(jQuery, window);
-
+}));
\ No newline at end of file
diff --git a/lib/web/mage/translate-inline.js b/lib/web/mage/translate-inline.js
index 0478daaa341adb18770110bd1c7a8e27c5c75bd5..a43b989c4d4dabf050ffea92bdbdf6477d054b9a 100644
--- a/lib/web/mage/translate-inline.js
+++ b/lib/web/mage/translate-inline.js
@@ -21,7 +21,18 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true */
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template",
+            "mage/translate"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     $.widget("mage.translateInline", $.ui.dialog, {
         options: {
             translateForm: {
@@ -133,4 +144,4 @@
             }
         }
     });
-})(jQuery);
+}));
diff --git a/lib/web/mage/translate.js b/lib/web/mage/translate.js
index 2658853b8d193d7ae36210e270ace58cd56e4b03..7aa7d3982df7455c8b9689604489fe7b1dc48ad6 100644
--- a/lib/web/mage/translate.js
+++ b/lib/web/mage/translate.js
@@ -21,7 +21,16 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint browser:true jquery:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "mage/mage"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     $.extend(true, $, {
         mage: {
             translate: (function() {
@@ -63,4 +72,4 @@
      * @type {function(string): string}
      */
     $.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate);
-})(jQuery);
+}));
diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js
index 01d1f30e25b1ea149bbff8881685bcc6f7c299d3..3363b476c067bd348534af10c1906f0287397b30 100644
--- a/lib/web/mage/validation.js
+++ b/lib/web/mage/validation.js
@@ -21,7 +21,18 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint regexdash:true eqnull:true browser:true jquery:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            'jquery',
+            'jquery/ui',
+            'jquery/validate',
+            'mage/translate'
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
     $.extend(true, $, {
         // @TODO: Move methods 'isEmpty', 'isEmptyNoTrim', 'parseNumber', 'stripHtml' in file with utility functions
@@ -304,7 +315,7 @@
         ],
         "stripped-min-length": [
             function(value, element, param) {
-                return jQuery(value).text().length >= param;
+                return $(value).text().length >= param;
             },
             'Please enter at least {0} characters'
         ],
@@ -312,13 +323,13 @@
             function(value, element) {
                 return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
             },
-            jQuery.validator.messages.email
+            $.validator.messages.email
         ],
         "url2": [
             function(value, element) {
                 return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
             },
-            jQuery.validator.messages.url
+            $.validator.messages.url
         ],
         "credit-card-types": [
             function(value, element, param) {
@@ -706,7 +717,6 @@
                     }
                 }
 
-
                 return result;
             },
             'The value is not within the specified range.'
@@ -1120,8 +1130,8 @@
         'validate-new-password': [
             function(v) {
 
-                if (jQuery.validator.methods['validate-password'] &&
-                    !jQuery.validator.methods['validate-password'](v)) {
+                if ($.validator.methods['validate-password'] &&
+                    !$.validator.methods['validate-password'](v)) {
                     return false;
                 }
                 if ($.mage.isEmpty(v) && v !== '') {
@@ -1319,5 +1329,4 @@
             });
         }
     });
-})(jQuery);
-
+}));
diff --git a/lib/web/mage/validation/dob-rule.js b/lib/web/mage/validation/dob-rule.js
index b8337b2908991adefecb60081c7df1d103fd09ae..d940720cf2f5d384c97b33b5d64e21ad34068533 100644
--- a/lib/web/mage/validation/dob-rule.js
+++ b/lib/web/mage/validation/dob-rule.js
@@ -22,8 +22,13 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+define([
+    "jquery",
+    "jquery/validate",
+    "mage/translate"
+], function($){
     "use strict";
+    
     $.validator.addMethod(
         'validate-dob',
         function (val, element, params) {
@@ -80,4 +85,5 @@
             return this.dobErrorMessage;
         }
     );
-})(jQuery);
+
+});
diff --git a/lib/web/mage/validation/validation.js b/lib/web/mage/validation/validation.js
index a049e211a68ce65b5f4677f013792932d1d75a65..a2ea7498eeadbd15764d07ec625c1e29a9e7087e 100644
--- a/lib/web/mage/validation/validation.js
+++ b/lib/web/mage/validation/validation.js
@@ -21,8 +21,19 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 /*jshint jquery:true*/
-(function($) {
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "mage/validation",
+            "mage/translate"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+    
     /**
      * Validation rule for grouped product, with multiple qty fields,
      * only one qty needs to have a positive integer
@@ -94,4 +105,4 @@
             return this.dateBetweenErrorMessage;
         }
     );
-})(jQuery);
+}));
diff --git a/lib/web/mage/webapi.js b/lib/web/mage/webapi.js
index 24952fe7e63502160ac78c3b72f07dabfb1e0497..44b6d4f19f1e998b93d9f5cf53f4a7db9fd499b8 100644
--- a/lib/web/mage/webapi.js
+++ b/lib/web/mage/webapi.js
@@ -20,8 +20,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-/* jshint jquery: true */
-(function($){
+/* jshint define: true */
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        define([
+            "jquery",
+            "mage/mage"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
 
     /**
@@ -205,4 +214,4 @@
             }
         };
     };
-})(jQuery);
+}));
diff --git a/lib/web/mage/zoom.js b/lib/web/mage/zoom.js
index 3b430a1966bcf095e15f61138ed2513a8b52dc26..7522bbf787fc60c00594f3957d79230c6ef27d3d 100644
--- a/lib/web/mage/zoom.js
+++ b/lib/web/mage/zoom.js
@@ -20,9 +20,20 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-
-(function($) {
+(function (factory) {
+    if (typeof define === "function" && define.amd) {
+        define([
+            "jquery",
+            "jquery/ui",
+            "jquery/template",
+            "handlebars"
+        ], factory);
+    } else {
+        factory(jQuery);
+    }
+}(function ($) {
     "use strict";
+
     $.widget('mage.zoom', {
         options: {
             largeImage: null,
@@ -462,4 +473,4 @@
             return this._superApply([position]);
         }
     });
-})(jQuery);
\ No newline at end of file
+}));
\ No newline at end of file
diff --git a/lib/web/modernizr/modernizr.details.js b/lib/web/modernizr/modernizr.details.js
index 48f1c9cfe0b26de26cc947780c046ff319a37b6d..147f5c104bfcd03601940f592ec5b9f2fda8b50e 100644
--- a/lib/web/modernizr/modernizr.details.js
+++ b/lib/web/modernizr/modernizr.details.js
@@ -1,25 +1,31 @@
 // By @mathias, based on http://mths.be/axh
-Modernizr.addTest('details', function() {
-    var doc = document,
-        el = doc.createElement('details'),
-        fake,
-        root,
-        diff;
-    if (!('open' in el)) { // return early if possible; thanks @aFarkas!
-        return false;
-    }
-    root = doc.body || (function() {
-        var de = doc.documentElement;
-        fake = true;
-        return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
-    }());
-    el.innerHTML = '<summary>a</summary>b';
-    el.style.display = 'block';
-    root.appendChild(el);
-    diff = el.offsetHeight;
-    el.open = true;
-    diff = diff != el.offsetHeight;
-    root.removeChild(el);
-    fake && root.parentNode.removeChild(root);
-    return diff;
-});
+define([
+    'modernizr/modernizr'
+], function(){
+
+    Modernizr.addTest('details', function() {
+        var doc = document,
+            el = doc.createElement('details'),
+            fake,
+            root,
+            diff;
+        if (!('open' in el)) { // return early if possible; thanks @aFarkas!
+            return false;
+        }
+        root = doc.body || (function() {
+            var de = doc.documentElement;
+            fake = true;
+            return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
+        }());
+        el.innerHTML = '<summary>a</summary>b';
+        el.style.display = 'block';
+        root.appendChild(el);
+        diff = el.offsetHeight;
+        el.open = true;
+        diff = diff != el.offsetHeight;
+        root.removeChild(el);
+        fake && root.parentNode.removeChild(root);
+        return diff;
+    });
+
+});
\ No newline at end of file
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/code/.gitignore b/lib/web/prototype/prototype-amd.js
similarity index 100%
rename from dev/tests/unit/testsuite/Magento/Framework/Backup/_files/data/code/.gitignore
rename to lib/web/prototype/prototype-amd.js
diff --git a/lib/web/prototype/tooltip.js b/lib/web/prototype/tooltip.js
deleted file mode 100644
index 56d883537c0d752f617919108b2fbf985de9b323..0000000000000000000000000000000000000000
--- a/lib/web/prototype/tooltip.js
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2006 Jonathan Weiss <jw@innerewut.de>
- *
- * Permission to use, copy, modify, and 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.
- */
-
-
-/* tooltip-0.2.js - Small tooltip library on top of Prototype 
- * by Jonathan Weiss <jw@innerewut.de> distributed under the BSD license. 
- *
- * This tooltip library works in two modes. If it gets a valid DOM element 
- * or DOM id as an argument it uses this element as the tooltip. This 
- * element will be placed (and shown) near the mouse pointer when a trigger-
- * element is moused-over.
- * If it gets only a text as an argument instead of a DOM id or DOM element
- * it will create a div with the classname 'tooltip' that holds the given text.
- * This newly created div will be used as the tooltip. This is usefull if you 
- * want to use tooltip.js to create popups out of title attributes.
- * 
- *
- * Usage: 
- *   <script src="/javascripts/prototype.js" type="text/javascript"></script>
- *   <script src="/javascripts/tooltip.js" type="text/javascript"></script>
- *   <script type="text/javascript">
- *     // with valid DOM id
- *     var my_tooltip = new Tooltip('id_of_trigger_element', 'id_of_tooltip_to_show_element')
- *
- *     // with text
- *     var my_other_tooltip = new Tooltip('id_of_trigger_element', 'a nice description')
- *
- *     // create popups for each element with a title attribute
- *    Event.observe(window,"load",function() {
- *      $$("*").findAll(function(node){
- *        return node.getAttribute('title');
- *      }).each(function(node){
- *        new Tooltip(node,node.title);
- *        node.removeAttribute("title");
- *      });
- *    });
- *    
- *   </script>
- * 
- * Now whenever you trigger a mouseOver on the `trigger` element, the tooltip element will
- * be shown. On o mouseOut the tooltip disappears. 
- * 
- * Example:
- * 
- *   <script src="/javascripts/prototype.js" type="text/javascript"></script>
- *   <script src="/javascripts/scriptaculous.js" type="text/javascript"></script>
- *   <script src="/javascripts/tooltip.js" type="text/javascript"></script>
- *
- *   <div id='tooltip' style="display:none; margin: 5px; background-color: red;">
- *     Detail infos on product 1....<br />
- *   </div>
- *
- *   <div id='product_1'>
- *     This is product 1
- *   </div>
- *
- *   <script type="text/javascript">
- *     var my_tooltip = new Tooltip('product_1', 'tooltip')
- *   </script>
- *
- * You can use my_tooltip.destroy() to remove the event observers and thereby the tooltip.
- */
-
-var Tooltip = Class.create();
-Tooltip.prototype = {
-  initialize: function(element, tool_tip) {
-    var options = Object.extend({
-      default_css: false,
-      margin: "0px",
-	    padding: "5px",
-	    backgroundColor: "#d6d6fc",
-	    min_distance_x: 5,
-      min_distance_y: 5,
-      delta_x: 0,
-      delta_y: 0,
-      zindex: 1000
-    }, arguments[2] || {});
-
-    this.element      = $(element);
-
-    this.options      = options;
-    
-    // use the supplied tooltip element or create our own div
-    if($(tool_tip)) {
-      this.tool_tip = $(tool_tip);
-    } else {
-      this.tool_tip = $(document.createElement("div")); 
-      document.body.appendChild(this.tool_tip);
-      this.tool_tip.addClassName("tooltip");
-      this.tool_tip.appendChild(document.createTextNode(tool_tip));
-    }
-
-    // hide the tool-tip by default
-    this.tool_tip.hide();
-
-    this.eventMouseOver = this.showTooltip.bindAsEventListener(this);
-    this.eventMouseOut   = this.hideTooltip.bindAsEventListener(this);
-    this.eventMouseMove  = this.moveTooltip.bindAsEventListener(this);
-
-    this.registerEvents();
-  },
-
-  destroy: function() {
-    Event.stopObserving(this.element, "mouseover", this.eventMouseOver);
-    Event.stopObserving(this.element, "mouseout", this.eventMouseOut);
-    Event.stopObserving(this.element, "mousemove", this.eventMouseMove);
-  },
-
-  registerEvents: function() {
-    Event.observe(this.element, "mouseover", this.eventMouseOver);
-    Event.observe(this.element, "mouseout", this.eventMouseOut);
-    Event.observe(this.element, "mousemove", this.eventMouseMove);
-  },
-
-  moveTooltip: function(event){
-	  Event.stop(event);
-	  // get Mouse position
-    var mouse_x = Event.pointerX(event);
-	  var mouse_y = Event.pointerY(event);
-	
-	  // decide if wee need to switch sides for the tooltip
-	  var dimensions = Element.getDimensions( this.tool_tip );
-	  var element_width = dimensions.width;
-	  var element_height = dimensions.height;
-	
-	  if ( (element_width + mouse_x) >= ( this.getWindowWidth() - this.options.min_distance_x) ){ // too big for X
-		  mouse_x = mouse_x - element_width;
-		  // apply min_distance to make sure that the mouse is not on the tool-tip
-		  mouse_x = mouse_x - this.options.min_distance_x;
-	  } else {
-		  mouse_x = mouse_x + this.options.min_distance_x;
-	  }
-	
-	  if ( (element_height + mouse_y) >= ( this.getWindowHeight() - this.options.min_distance_y) ){ // too big for Y
-		  mouse_y = mouse_y - element_height;
-	    // apply min_distance to make sure that the mouse is not on the tool-tip
-		  mouse_y = mouse_y - this.options.min_distance_y;
-	  } else {
-		  mouse_y = mouse_y + this.options.min_distance_y;
-	  } 
-	
-	  // now set the right styles
-	  this.setStyles(mouse_x, mouse_y);
-  },
-	
-		
-  showTooltip: function(event) {
-    Event.stop(event);
-    this.moveTooltip(event);
-	  new Element.show(this.tool_tip);
-  },
-  
-  setStyles: function(x, y){
-    // set the right styles to position the tool tip
-	  Element.setStyle(this.tool_tip, { position:'absolute',
-	 								    top:y + this.options.delta_y + "px",
-	 								    left:x + this.options.delta_x + "px",
-									    zindex:this.options.zindex
-	 								  });
-	
-	  // apply default theme if wanted
-	  if (this.options.default_css){
-	  	  Element.setStyle(this.tool_tip, { margin:this.options.margin,
-		 		  						                    padding:this.options.padding,
-		                                      backgroundColor:this.options.backgroundColor,
-										                      zindex:this.options.zindex
-		 								    });	
-	  }	
-  },
-
-  hideTooltip: function(event){
-	  new Element.hide(this.tool_tip);
-  },
-
-  getWindowHeight: function(){
-    var innerHeight;
-	  if (navigator.appVersion.indexOf('MSIE')>0) {
-		  innerHeight = document.body.clientHeight;
-    } else {
-		  innerHeight = window.innerHeight;
-    }
-    return innerHeight;	
-  },
- 
-  getWindowWidth: function(){
-    var innerWidth;
-	  if (navigator.appVersion.indexOf('MSIE')>0) {
-		  innerWidth = document.body.clientWidth;
-    } else {
-		  innerWidth = window.innerWidth;
-    }
-    return innerWidth;	
-  }
-
-}
diff --git a/lib/web/prototype/tooltip_manager.js b/lib/web/prototype/tooltip_manager.js
deleted file mode 100644
index 4c562c71b6e9e01c53b4df819d814c08e5fce656..0000000000000000000000000000000000000000
--- a/lib/web/prototype/tooltip_manager.js
+++ /dev/null
@@ -1,241 +0,0 @@
-// Singleton class TooltipWindow
-// This class works with special className. The tooltip content could be in your HTML page as an hidden element or
-// can be retrieve by an AJAX call.
-//
-// To work, You just need to set two class name on elements that should show tooltips
-// - One to say to TooltipManager that this element must have a tooltip ('tooltip' by default)
-// - Another to indicate how to find the tooltip content
-//   It could be html_XXXX if tootltip content is somewhere hidden in your page, XXX must be DOM ID of this hidden element
-//   It could be ajax_XXXX if tootltip content must be find by an ajax request, XXX will be the string send as id parameter to your server.
-// Check samples/tooltips/tooltip.html to see how it works
-//
-TooltipManager = {
-  options: {cssClassName: 'tooltip', delayOver: 200, delayOut: 1000, shiftX: 10, shiftY: 10,
-            className: 'alphacube', width: 200, height: null,
-            draggable: false, minimizable: false, maximizable: false, showEffect: Element.show, hideEffect: Element.hide},
-  ajaxInfo: null,
-  elements: null,
-  showTimer: null,
-  hideTimer: null,
-
-  // Init tooltip manager
-  // parameters:
-  // - cssClassName (string) : CSS class name where tooltip should be shown.
-  // - ajaxOptions  (hash)   : Ajax options for ajax tooltip.
-  //                           For examples {url: "/tooltip/get.php", options: {method: 'get'}}
-  //                           see Ajax.Request documentation for details
-  //- tooltipOptions (hash)  : available keys
-  //                           - delayOver: int in ms (default 10) delay before showing tooltip
-  //                           - delayOut:  int in ms (default 1000) delay before hidding tooltip
-  //                           - shiftX:    int in pixels (default 10) left shift of the tooltip window
-  //                           - shiftY:    int in pixels (default 10) top shift of the tooltip window
-  //                           and All window options like showEffect: Element.show, hideEffect: Element.hide to remove animation
-  //                           default: {className: 'alphacube', width: 200, height: null, draggable: false, minimizable: false, maximizable: false}
-
-  init: function(cssClassName, ajaxInfo, tooltipOptions) {
-    TooltipManager.options = Object.extend(TooltipManager.options, tooltipOptions || {});
-
-    cssClassName = TooltipManager.options.cssClassName || "tooltip";
-    TooltipManager.ajaxInfo = ajaxInfo;
-    TooltipManager.elements = $$("." + cssClassName);
-    TooltipManager.elements.each(function(element) {
-      element = $(element)
-      var info = TooltipManager._getInfo(element);
-      if (info.ajax) {
-        element.ajaxId = info.id;
-        element.ajaxInfo = ajaxInfo;
-      }
-      else {
-        element.tooltipElement = $(info.id);
-      }
-      element.observe("mouseover", TooltipManager._mouseOver);
-      element.observe("mouseout", TooltipManager._mouseOut);
-    });
-    Windows.addObserver(this);
-  },
-
-  addHTML: function(element, tooltipElement) {
-    element = $(element);
-    tooltipElement = $(tooltipElement);
-    element.tooltipElement = tooltipElement;
-
-    element.observe("mouseover", TooltipManager._mouseOver);
-    element.observe("mouseout", TooltipManager._mouseOut);
-  },
-
-  addAjax: function(element, ajaxInfo) {
-    element = $(element);
-    element.ajaxInfo = ajaxInfo;
-    element.observe("mouseover", TooltipManager._mouseOver);
-    element.observe("mouseout", TooltipManager._mouseOut);
-  },
-
-  addURL: function(element, url, width, height) {
-    element = $(element);
-    element.url = url;
-    element.frameWidth = width;
-    element.frameHeight = height;
-    element.observe("mouseover", TooltipManager._mouseOver);
-    element.observe("mouseout", TooltipManager._mouseOut);
-  },
-
-  close: function() {
-    if (TooltipManager.tooltipWindow)
-      TooltipManager.tooltipWindow.hide();
-  },
-
-  preloadImages: function(path, images, extension) {
-    if (!extension)
-      extension = ".gif";
-
-    //preload images
-    $A(images).each(function(i) {
-      var image = new Image();
-      image.src= path + "/" + i + extension;
-    });
-  },
-
-  _showTooltip: function(element) {
-    if (this.element == element)
-      return;
-    // Get original element
-    while (element && (!element.tooltipElement && !element.ajaxInfo && !element.url))
-      element = element.parentNode;
-    this.element = element;
-
-    TooltipManager.showTimer = null;
-    if (TooltipManager.hideTimer)
-      clearTimeout(TooltipManager.hideTimer);
-
-    var position = Position.cumulativeOffset(element);
-    var dimension = element.getDimensions();
-
-    if (! this.tooltipWindow)
-      this.tooltipWindow = new Window("__tooltip__", TooltipManager.options);
-
-    this.tooltipWindow.hide();
-    this.tooltipWindow.setLocation(position[1] + dimension.height + TooltipManager.options.shiftY, position[0] + TooltipManager.options.shiftX);
-
-    Event.observe(this.tooltipWindow.element, "mouseover", function(event) {TooltipManager._tooltipOver(event, element)});
-    Event.observe(this.tooltipWindow.element, "mouseout", function(event) {TooltipManager._tooltipOut(event, element)});
-
-    // Reset width/height for computation
-    this.tooltipWindow.height = TooltipManager.options.height;
-    this.tooltipWindow.width = TooltipManager.options.width;
-
-    // Ajax content
-    if (element.ajaxInfo) {
-      var p = element.ajaxInfo.options.parameters;
-      var saveParam = p;
-
-      // Set by CSS
-      if (element.ajaxId) {
-        if (p)
-          p += "&id=" + element.ajaxId;
-        else
-          p = "id=" + element.ajaxId;
-      }
-      element.ajaxInfo.options.parameters = p || "";
-      this.tooltipWindow.setHTMLContent("");
-      this.tooltipWindow.setAjaxContent(element.ajaxInfo.url, element.ajaxInfo.options);
-      element.ajaxInfo.options.parameters = saveParam;
-    }
-    // URL content
-    else if (element.url) {
-      this.tooltipWindow.setURL(element.url);
-      this.tooltipWindow.setSize(element.frameWidth, element.frameHeight);
-
-      // Set tooltip size
-      this.tooltipWindow.height = element.frameHeight;
-      this.tooltipWindow.width = element.frameWidth;
-    }
-    // HTML content
-    else
-      this.tooltipWindow.setHTMLContent(element.tooltipElement.innerHTML);
-
-    if (!element.ajaxInfo) {
-      this.tooltipWindow.show();
-      this.tooltipWindow.toFront();
-    }
-  },
-
-  _hideTooltip: function(element) {
-    if (this.tooltipWindow) {
-      this.tooltipWindow.hide();
-      this.element = null;
-    }
-  },
-
-  _mouseOver: function (event) {
-    var element = Event.element(event);
-    if (TooltipManager.showTimer)
-      clearTimeout(TooltipManager.showTimer);
-
-    TooltipManager.showTimer = setTimeout(function() {TooltipManager._showTooltip(element)}, TooltipManager.options.delayOver)
-  },
-
-  _mouseOut: function(event) {
-    var element = Event.element(event);
-    if (TooltipManager.showTimer) {
-      clearTimeout(TooltipManager.showTimer);
-      TooltipManager.showTimer = null;
-      return;
-    }
-    if (TooltipManager.tooltipWindow)
-      TooltipManager.hideTimer = setTimeout(function() {TooltipManager._hideTooltip(element)}, TooltipManager.options.delayOut)
-  },
-
-  _tooltipOver: function(event, element) {
-    if (TooltipManager.hideTimer) {
-      clearTimeout(TooltipManager.hideTimer);
-      TooltipManager.hideTimer = null;
-    }
-  },
-
-  _tooltipOut: function(event, element) {
-    if (TooltipManager.hideTimer == null)
-      TooltipManager.hideTimer = setTimeout(function() {TooltipManager._hideTooltip(element)}, TooltipManager.options.delayOut)
-  },
-
-  _getInfo: function(element) {
-    // Find html_ for static content
-    var id = element.className.split(' ').detect(function(name) {return name.indexOf("html_") == 0});
-    var ajax = true;
-    if (id)
-      ajax = false;
-    else
-      // Find ajax_ for ajax content
-      id = element.className.split(' ').detect(function(name) {return name.indexOf("ajax_") == 0});
-
-    id = id.substr(id.indexOf('_')+1, id.length)
-    return id ? {ajax: ajax, id: id} : null;
-  },
-
-  onBeforeShow: function(eventName, win) {
-     var top = parseFloat(win.getLocation().top);
-     var dim = win.element.getDimensions();
-
-     if (top + dim.height > TooltipManager._getScrollTop() + TooltipManager._getPageHeight()) {
-       var position = Position.cumulativeOffset(this.element);
-
-       var top = position[1] - TooltipManager.options.shiftY - dim.height;
-       win.setLocation(top, position[0] + TooltipManager.options.shiftX)
-     }
-   },
-
-	_getPageWidth: function(){
-		return window.innerWidth || document.documentElement.clientWidth || 0;
-	},
-
-	_getPageHeight: function(){
-		return window.innerHeight || document.documentElement.clientHeight || 0;
-	},
-
-	_getScrollTop: function(){
-		return document.documentElement.scrollTop || window.pageYOffset || 0;
-	},
-
-	_getScrollLeft: function(){
-		return document.documentElement.scrollLeft || window.pageXOffset || 0;
-	}
-};
diff --git a/lib/web/prototype/validation.js b/lib/web/prototype/validation.js
index ecee5cc3a24672025ac8f798e57a3db30ab35a59..ae52b8cb4a1ed78fdac2274e062419fd8f47947f 100644
--- a/lib/web/prototype/validation.js
+++ b/lib/web/prototype/validation.js
@@ -26,6 +26,8 @@
 * SOFTWARE.
 *
 */
+
+
 var Validator = Class.create();
 
 Validator.prototype = {
diff --git a/lib/web/prototype/window.js b/lib/web/prototype/window.js
index bb09ede9a2f0b889d43a060dfeb90fb0caf8384f..ad85b516c1e899f22d7eed2cc67cb4c671175a55 100644
--- a/lib/web/prototype/window.js
+++ b/lib/web/prototype/window.js
@@ -1449,15 +1449,9 @@ var Dialog = {
 
     parameters.className = parameters.className || "alert";
 
-    var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'"
-    var cancelButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " cancel_button'"
-/*     var content = "\
-      <div class='" + parameters.className + "_message'>" + content  + "</div>\
-        <div class='" + parameters.className + "_buttons'>\
-          <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\
-          <input type='button' value='" + cancelLabel + "' onclick='Dialog.cancelCallback()' " + cancelButtonClass + "/>\
-        </div>\
-    "; */
+    var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'";
+    var cancelButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " cancel_button'";
+
     var content = "\
       <div class='" + parameters.className + "_message'>" + content  + "</div>\
         <div class='" + parameters.className + "_buttons'>\
@@ -1485,12 +1479,7 @@ var Dialog = {
 
     parameters.className = parameters.className || "alert";
 
-    var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'"
-/*     var content = "\
-      <div class='" + parameters.className + "_message'>" + content  + "</div>\
-        <div class='" + parameters.className + "_buttons'>\
-          <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\
-        </div>";   */
+    var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'";
     var content = "\
       <div class='" + parameters.className + "_message'>" + content  + "</div>\
         <div class='" + parameters.className + "_buttons'>\
diff --git a/lib/web/scriptaculous/controls.js b/lib/web/scriptaculous/controls.js
deleted file mode 100644
index 863245266a9b32c932975a70f0e3bdf4d977d313..0000000000000000000000000000000000000000
--- a/lib/web/scriptaculous/controls.js
+++ /dev/null
@@ -1,973 +0,0 @@
-// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
-
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-//           (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
-// Contributors:
-//  Richard Livsey
-//  Rahul Bhargava
-//  Rob Wills
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-// Autocompleter.Base handles all the autocompletion functionality
-// that's independent of the data source for autocompletion. This
-// includes drawing the autocompletion menu, observing keyboard
-// and mouse events, and similar.
-//
-// Specific autocompleters need to provide, at the very least,
-// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method
-// should get the text for which to provide autocompletion by
-// invoking this.getToken(), NOT by directly accessing
-// this.element.value. This is to allow incremental tokenized
-// autocompletion. Specific auto-completion logic (AJAX, etc)
-// belongs in getUpdatedChoices.
-//
-// Tokenized incremental autocompletion is enabled automatically
-// when an autocompleter is instantiated with the 'tokens' option
-// in the options parameter, e.g.:
-// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
-// will incrementally autocomplete with a comma as the token.
-// Additionally, ',' in the above example can be replaced with
-// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most
-// useful when one of the tokens is \n (a newline), as it
-// allows smart autocompletion after linebreaks.
-
-if(typeof Effect == 'undefined')
-  throw("controls.js requires including script.aculo.us' effects.js library");
-
-var Autocompleter = { };
-Autocompleter.Base = Class.create({
-  baseInitialize: function(element, update, options) {
-    element          = $(element);
-    this.element     = element;
-    this.update      = $(update);
-    this.hasFocus    = false;
-    this.changed     = false;
-    this.active      = false;
-    this.parent      = false;
-    this.index       = 0;
-    this.entryCount  = 0;
-    this.oldElementValue = this.element.value;
-
-    if(this.setOptions)
-      this.setOptions(options);
-    else
-      this.options = options || { };
-
-    this.options.paramName    = this.options.paramName || this.element.name;
-    this.options.tokens       = this.options.tokens || [];
-    this.options.frequency    = this.options.frequency || 0.4;
-    this.options.minChars     = this.options.minChars || 1;
-    this.options.onShow       = this.options.onShow ||
-      function(element, update){
-        if(!update.style.position || update.style.position=='absolute') {
-          update.style.position = 'absolute';
-          Position.clone(element, update, {
-            setHeight: false,
-            offsetTop: element.offsetHeight
-          });
-        }
-        Effect.Appear(update,{duration:0.15});
-      };
-    this.options.onHide = this.options.onHide ||
-      function(element, update){ new Effect.Fade(update,{duration:0.15}) };
-
-    if(typeof(this.options.tokens) == 'string')
-      this.options.tokens = new Array(this.options.tokens);
-    // Force carriage returns as token delimiters anyway
-    if (!this.options.tokens.include('\n'))
-      this.options.tokens.push('\n');
-
-    this.observer = null;
-
-    this.element.setAttribute('autocomplete','off');
-
-    Element.hide(this.update);
-
-    Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
-    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
-  },
-
-  show: function() {
-    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
-    if(!this.iefix &&
-      (Prototype.Browser.IE) &&
-      (parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6) &&
-      (Element.getStyle(this.update, 'position')=='absolute')) {
-      new Insertion.After(this.update,
-       '<iframe id="' + this.update.id + '_iefix" '+
-       'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
-       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
-      this.iefix = $(this.update.id+'_iefix');
-    }
-    if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
-  },
-
-  fixIEOverlapping: function() {
-    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
-    this.iefix.style.zIndex = 1;
-    this.update.style.zIndex = 2;
-    Element.show(this.iefix);
-  },
-
-  hide: function() {
-    this.stopIndicator();
-    if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
-    if(this.iefix) Element.hide(this.iefix);
-  },
-
-  startIndicator: function() {
-    if(this.options.indicator) {
-        Element.show(this.options.indicator);
-    }
-    this.options.parent && $(this.options.parent).addClassName('ajax-loading');
-  },
-
-  stopIndicator: function() {
-    if(this.options.indicator) {
-        Element.hide(this.options.indicator);
-    }
-    this.options.parent && $(this.options.parent).removeClassName('ajax-loading');
-  },
-
-  onKeyPress: function(event) {
-    if(this.active)
-      switch(event.keyCode) {
-       case Event.KEY_TAB:
-       case Event.KEY_RETURN:
-         this.selectEntry();
-         Event.stop(event);
-       case Event.KEY_ESC:
-         this.hide();
-         this.active = false;
-         Event.stop(event);
-         return;
-       case Event.KEY_LEFT:
-       case Event.KEY_RIGHT:
-         return;
-       case Event.KEY_UP:
-         this.markPrevious();
-         this.render();
-         Event.stop(event);
-         return;
-       case Event.KEY_DOWN:
-         this.markNext();
-         this.render();
-         Event.stop(event);
-         return;
-      }
-     else
-       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
-         (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
-
-    this.changed = true;
-    this.hasFocus = true;
-
-    if(this.observer) clearTimeout(this.observer);
-      this.observer =
-        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
-  },
-
-  activate: function() {
-    this.changed = false;
-    this.hasFocus = true;
-    this.getUpdatedChoices();
-  },
-
-  onHover: function(event) {
-    var element = Event.findElement(event, 'LI');
-    if(this.index != element.autocompleteIndex)
-    {
-        this.index = element.autocompleteIndex;
-        this.render();
-    }
-    Event.stop(event);
-  },
-
-  onClick: function(event) {
-    var element = Event.findElement(event, 'LI');
-    this.index = element.autocompleteIndex;
-    this.selectEntry();
-    this.hide();
-  },
-
-  onBlur: function(event) {
-    // needed to make click events working
-    setTimeout(this.hide.bind(this), 250);
-    this.hasFocus = false;
-    this.active = false;
-  },
-
-  render: function() {
-    if(this.entryCount > 0) {
-      for (var i = 0; i < this.entryCount; i++)
-        this.index==i ?
-          Element.addClassName(this.getEntry(i),"selected") :
-          Element.removeClassName(this.getEntry(i),"selected");
-      if(this.hasFocus) {
-        this.show();
-        this.active = true;
-      }
-    } else {
-      this.active = false;
-      this.hide();
-    }
-  },
-
-  markPrevious: function() {
-    if(this.index > 0) this.index--;
-      else this.index = this.entryCount-1;
-    //this.getEntry(this.index).scrollIntoView(true); useless
-  },
-
-  markNext: function() {
-    if(this.index < this.entryCount-1) this.index++;
-      else this.index = 0;
-    this.getEntry(this.index).scrollIntoView(false);
-  },
-
-  getEntry: function(index) {
-    return this.update.firstChild.childNodes[index];
-  },
-
-  getCurrentEntry: function() {
-    return this.getEntry(this.index);
-  },
-
-  selectEntry: function() {
-    this.active = false;
-    this.updateElement(this.getCurrentEntry());
-  },
-
-  updateElement: function(selectedElement) {
-    if (this.options.updateElement) {
-      this.options.updateElement(selectedElement);
-      return;
-    }
-    var value = '';
-    if (this.options.select) {
-      var nodes = $(selectedElement).select('.' + this.options.select) || [];
-      if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
-    } else
-      value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-
-    var bounds = this.getTokenBounds();
-    if (bounds[0] != -1) {
-      var newValue = this.element.value.substr(0, bounds[0]);
-      var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
-      if (whitespace)
-        newValue += whitespace[0];
-      this.element.value = newValue + value + this.element.value.substr(bounds[1]);
-    } else {
-      this.element.value = value;
-    }
-    this.oldElementValue = this.element.value;
-    this.element.focus();
-
-    if (this.options.afterUpdateElement)
-      this.options.afterUpdateElement(this.element, selectedElement);
-  },
-
-  updateChoices: function(choices) {
-    if(!this.changed && this.hasFocus) {
-      this.update.innerHTML = choices;
-      Element.cleanWhitespace(this.update);
-      Element.cleanWhitespace(this.update.down());
-
-      if(this.update.firstChild && this.update.down().childNodes) {
-        this.entryCount =
-          this.update.down().childNodes.length;
-        for (var i = 0; i < this.entryCount; i++) {
-          var entry = this.getEntry(i);
-          entry.autocompleteIndex = i;
-          this.addObservers(entry);
-        }
-      } else {
-        this.entryCount = 0;
-      }
-
-      this.stopIndicator();
-      this.index = 0;
-
-      if(this.entryCount==1 && this.options.autoSelect) {
-        this.selectEntry();
-        this.hide();
-      } else {
-        this.render();
-      }
-    }
-  },
-
-  addObservers: function(element) {
-    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
-    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
-  },
-
-  onObserverEvent: function() {
-    this.changed = false;
-    this.tokenBounds = null;
-    if(this.getToken().length>=this.options.minChars) {
-      this.getUpdatedChoices();
-    } else {
-      this.active = false;
-      this.hide();
-    }
-    this.oldElementValue = this.element.value;
-  },
-
-  getToken: function() {
-    var bounds = this.getTokenBounds();
-    return this.element.value.substring(bounds[0], bounds[1]).strip();
-  },
-
-  getTokenBounds: function() {
-    if (null != this.tokenBounds) return this.tokenBounds;
-    var value = this.element.value;
-    if (value.strip().empty()) return [-1, 0];
-    var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
-    var offset = (diff == this.oldElementValue.length ? 1 : 0);
-    var prevTokenPos = -1, nextTokenPos = value.length;
-    var tp;
-    for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
-      tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
-      if (tp > prevTokenPos) prevTokenPos = tp;
-      tp = value.indexOf(this.options.tokens[index], diff + offset);
-      if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
-    }
-    return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
-  }
-});
-
-Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
-  var boundary = Math.min(newS.length, oldS.length);
-  for (var index = 0; index < boundary; ++index)
-    if (newS[index] != oldS[index])
-      return index;
-  return boundary;
-};
-
-Ajax.Autocompleter = Class.create(Autocompleter.Base, {
-  initialize: function(element, update, url, options) {
-    this.baseInitialize(element, update, options);
-    this.options.asynchronous  = true;
-    this.options.onComplete    = this.onComplete.bind(this);
-    this.options.defaultParams = this.options.parameters || null;
-    this.url                   = url;
-  },
-
-  getUpdatedChoices: function() {
-    this.startIndicator();
-
-    var entry = encodeURIComponent(this.options.paramName) + '=' +
-      encodeURIComponent(this.getToken());
-
-    this.options.parameters = this.options.callback ?
-      this.options.callback(this.element, entry) : entry;
-
-    if(this.options.defaultParams)
-      this.options.parameters += '&' + this.options.defaultParams;
-
-    new Ajax.Request(this.url, this.options);
-  },
-
-  onComplete: function(request) {
-    this.updateChoices(request.responseText);
-  }
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-//                    text only at the beginning of strings in the
-//                    autocomplete array. Defaults to true, which will
-//                    match text at the beginning of any *word* in the
-//                    strings in the autocomplete array. If you want to
-//                    search anywhere in the string, additionally set
-//                    the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-//                   a partial match (unlike minChars, which defines
-//                   how many characters are required to do any match
-//                   at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-//                 Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector'
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create(Autocompleter.Base, {
-  initialize: function(element, update, array, options) {
-    this.baseInitialize(element, update, options);
-    this.options.array = array;
-  },
-
-  getUpdatedChoices: function() {
-    this.updateChoices(this.options.selector(this));
-  },
-
-  setOptions: function(options) {
-    this.options = Object.extend({
-      choices: 10,
-      partialSearch: true,
-      partialChars: 2,
-      ignoreCase: true,
-      fullSearch: false,
-      selector: function(instance) {
-        var ret       = []; // Beginning matches
-        var partial   = []; // Inside matches
-        var entry     = instance.getToken();
-        var count     = 0;
-
-        for (var i = 0; i < instance.options.array.length &&
-          ret.length < instance.options.choices ; i++) {
-
-          var elem = instance.options.array[i];
-          var foundPos = instance.options.ignoreCase ?
-            elem.toLowerCase().indexOf(entry.toLowerCase()) :
-            elem.indexOf(entry);
-
-          while (foundPos != -1) {
-            if (foundPos == 0 && elem.length != entry.length) {
-              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
-                elem.substr(entry.length) + "</li>");
-              break;
-            } else if (entry.length >= instance.options.partialChars &&
-              instance.options.partialSearch && foundPos != -1) {
-              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
-                partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
-                  elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
-                  foundPos + entry.length) + "</li>");
-                break;
-              }
-            }
-
-            foundPos = instance.options.ignoreCase ?
-              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
-              elem.indexOf(entry, foundPos + 1);
-
-          }
-        }
-        if (partial.length)
-          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
-        return "<ul>" + ret.join('') + "</ul>";
-      }
-    }, options || { });
-  }
-});
-
-// AJAX in-place editor and collection editor
-// Full rewrite by Christophe Porteneuve <tdd@tddsworld.com> (April 2007).
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
-  setTimeout(function() {
-    Field.activate(field);
-  }, 1);
-};
-
-Ajax.InPlaceEditor = Class.create({
-  initialize: function(element, url, options) {
-    this.url = url;
-    this.element = element = $(element);
-    this.prepareOptions();
-    this._controls = { };
-    arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
-    Object.extend(this.options, options || { });
-    if (!this.options.formId && this.element.id) {
-      this.options.formId = this.element.id + '-inplaceeditor';
-      if ($(this.options.formId))
-        this.options.formId = '';
-    }
-    if (this.options.externalControl)
-      this.options.externalControl = $(this.options.externalControl);
-    if (!this.options.externalControl)
-      this.options.externalControlOnly = false;
-    this._originalBackground = this.element.getStyle('background-color') || 'transparent';
-    this.element.title = this.options.clickToEditText;
-    this._boundCancelHandler = this.handleFormCancellation.bind(this);
-    this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
-    this._boundFailureHandler = this.handleAJAXFailure.bind(this);
-    this._boundSubmitHandler = this.handleFormSubmission.bind(this);
-    this._boundWrapperHandler = this.wrapUp.bind(this);
-    this.registerListeners();
-  },
-  checkForEscapeOrReturn: function(e) {
-    if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
-    if (Event.KEY_ESC == e.keyCode)
-      this.handleFormCancellation(e);
-    else if (Event.KEY_RETURN == e.keyCode)
-      this.handleFormSubmission(e);
-  },
-  createControl: function(mode, handler, extraClasses) {
-    var control = this.options[mode + 'Control'];
-    var text = this.options[mode + 'Text'];
-    if ('button' == control) {
-      var btn = document.createElement('input');
-      btn.type = 'submit';
-      btn.value = text;
-      btn.className = 'editor_' + mode + '_button';
-      if ('cancel' == mode)
-        btn.onclick = this._boundCancelHandler;
-      this._form.appendChild(btn);
-      this._controls[mode] = btn;
-    } else if ('link' == control) {
-      var link = document.createElement('a');
-      link.href = '#';
-      link.appendChild(document.createTextNode(text));
-      link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
-      link.className = 'editor_' + mode + '_link';
-      if (extraClasses)
-        link.className += ' ' + extraClasses;
-      this._form.appendChild(link);
-      this._controls[mode] = link;
-    }
-  },
-  createEditField: function() {
-    var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
-    var fld;
-    if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
-      fld = document.createElement('input');
-      fld.type = 'text';
-      var size = this.options.size || this.options.cols || 0;
-      if (0 < size) fld.size = size;
-    } else {
-      fld = document.createElement('textarea');
-      fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
-      fld.cols = this.options.cols || 40;
-    }
-    fld.name = this.options.paramName;
-    fld.value = text; // No HTML breaks conversion anymore
-    fld.className = 'editor_field';
-    if (this.options.submitOnBlur)
-      fld.onblur = this._boundSubmitHandler;
-    this._controls.editor = fld;
-    if (this.options.loadTextURL)
-      this.loadExternalText();
-    this._form.appendChild(this._controls.editor);
-  },
-  createForm: function() {
-    var ipe = this;
-    function addText(mode, condition) {
-      var text = ipe.options['text' + mode + 'Controls'];
-      if (!text || condition === false) return;
-      ipe._form.appendChild(document.createTextNode(text));
-    };
-    this._form = $(document.createElement('form'));
-    this._form.id = this.options.formId;
-    this._form.addClassName(this.options.formClassName);
-    this._form.onsubmit = this._boundSubmitHandler;
-    this.createEditField();
-    if ('textarea' == this._controls.editor.tagName.toLowerCase())
-      this._form.appendChild(document.createElement('br'));
-    if (this.options.onFormCustomization)
-      this.options.onFormCustomization(this, this._form);
-    addText('Before', this.options.okControl || this.options.cancelControl);
-    this.createControl('ok', this._boundSubmitHandler);
-    addText('Between', this.options.okControl && this.options.cancelControl);
-    this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
-    addText('After', this.options.okControl || this.options.cancelControl);
-  },
-  destroy: function() {
-    if (this._oldInnerHTML)
-      this.element.innerHTML = this._oldInnerHTML;
-    this.leaveEditMode();
-    this.unregisterListeners();
-  },
-  enterEditMode: function(e) {
-    if (this._saving || this._editing) return;
-    this._editing = true;
-    this.triggerCallback('onEnterEditMode');
-    if (this.options.externalControl)
-      this.options.externalControl.hide();
-    this.element.hide();
-    this.createForm();
-    this.element.parentNode.insertBefore(this._form, this.element);
-    if (!this.options.loadTextURL)
-      this.postProcessEditField();
-    if (e) Event.stop(e);
-  },
-  enterHover: function(e) {
-    if (this.options.hoverClassName)
-      this.element.addClassName(this.options.hoverClassName);
-    if (this._saving) return;
-    this.triggerCallback('onEnterHover');
-  },
-  getText: function() {
-    return this.element.innerHTML.unescapeHTML();
-  },
-  handleAJAXFailure: function(transport) {
-    this.triggerCallback('onFailure', transport);
-    if (this._oldInnerHTML) {
-      this.element.innerHTML = this._oldInnerHTML;
-      this._oldInnerHTML = null;
-    }
-  },
-  handleFormCancellation: function(e) {
-    this.wrapUp();
-    if (e) Event.stop(e);
-  },
-  handleFormSubmission: function(e) {
-    var form = this._form;
-    var value = $F(this._controls.editor);
-    this.prepareSubmission();
-    var params = this.options.callback(form, value) || '';
-    if (Object.isString(params))
-      params = params.toQueryParams();
-    params.editorId = this.element.id;
-    if (this.options.htmlResponse) {
-      var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
-      Object.extend(options, {
-        parameters: params,
-        onComplete: this._boundWrapperHandler,
-        onFailure: this._boundFailureHandler
-      });
-      new Ajax.Updater({ success: this.element }, this.url, options);
-    } else {
-      var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-      Object.extend(options, {
-        parameters: params,
-        onComplete: this._boundWrapperHandler,
-        onFailure: this._boundFailureHandler
-      });
-      new Ajax.Request(this.url, options);
-    }
-    if (e) Event.stop(e);
-  },
-  leaveEditMode: function() {
-    this.element.removeClassName(this.options.savingClassName);
-    this.removeForm();
-    this.leaveHover();
-    this.element.style.backgroundColor = this._originalBackground;
-    this.element.show();
-    if (this.options.externalControl)
-      this.options.externalControl.show();
-    this._saving = false;
-    this._editing = false;
-    this._oldInnerHTML = null;
-    this.triggerCallback('onLeaveEditMode');
-  },
-  leaveHover: function(e) {
-    if (this.options.hoverClassName)
-      this.element.removeClassName(this.options.hoverClassName);
-    if (this._saving) return;
-    this.triggerCallback('onLeaveHover');
-  },
-  loadExternalText: function() {
-    this._form.addClassName(this.options.loadingClassName);
-    this._controls.editor.disabled = true;
-    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-    Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
-      onComplete: Prototype.emptyFunction,
-      onSuccess: function(transport) {
-        this._form.removeClassName(this.options.loadingClassName);
-        var text = transport.responseText;
-        if (this.options.stripLoadedTextTags)
-          text = text.stripTags();
-        this._controls.editor.value = text;
-        this._controls.editor.disabled = false;
-        this.postProcessEditField();
-      }.bind(this),
-      onFailure: this._boundFailureHandler
-    });
-    new Ajax.Request(this.options.loadTextURL, options);
-  },
-  postProcessEditField: function() {
-    var fpc = this.options.fieldPostCreation;
-    if (fpc)
-      $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
-  },
-  prepareOptions: function() {
-    this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
-    Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
-    [this._extraDefaultOptions].flatten().compact().each(function(defs) {
-      Object.extend(this.options, defs);
-    }.bind(this));
-  },
-  prepareSubmission: function() {
-    this._saving = true;
-    this.removeForm();
-    this.leaveHover();
-    this.showSaving();
-  },
-  registerListeners: function() {
-    this._listeners = { };
-    var listener;
-    $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
-      listener = this[pair.value].bind(this);
-      this._listeners[pair.key] = listener;
-      if (!this.options.externalControlOnly)
-        this.element.observe(pair.key, listener);
-      if (this.options.externalControl)
-        this.options.externalControl.observe(pair.key, listener);
-    }.bind(this));
-  },
-  removeForm: function() {
-    if (!this._form) return;
-    this._form.remove();
-    this._form = null;
-    this._controls = { };
-  },
-  showSaving: function() {
-    this._oldInnerHTML = this.element.innerHTML;
-    this.element.innerHTML = this.options.savingText;
-    this.element.addClassName(this.options.savingClassName);
-    this.element.style.backgroundColor = this._originalBackground;
-    this.element.show();
-  },
-  triggerCallback: function(cbName, arg) {
-    if ('function' == typeof this.options[cbName]) {
-      this.options[cbName](this, arg);
-    }
-  },
-  unregisterListeners: function() {
-    $H(this._listeners).each(function(pair) {
-      if (!this.options.externalControlOnly)
-        this.element.stopObserving(pair.key, pair.value);
-      if (this.options.externalControl)
-        this.options.externalControl.stopObserving(pair.key, pair.value);
-    }.bind(this));
-  },
-  wrapUp: function(transport) {
-    this.leaveEditMode();
-    // Can't use triggerCallback due to backward compatibility: requires
-    // binding + direct element
-    this._boundComplete(transport, this.element);
-  }
-});
-
-Object.extend(Ajax.InPlaceEditor.prototype, {
-  dispose: Ajax.InPlaceEditor.prototype.destroy
-});
-
-Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
-  initialize: function($super, element, url, options) {
-    this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
-    $super(element, url, options);
-  },
-
-  createEditField: function() {
-    var list = document.createElement('select');
-    list.name = this.options.paramName;
-    list.size = 1;
-    this._controls.editor = list;
-    this._collection = this.options.collection || [];
-    if (this.options.loadCollectionURL)
-      this.loadCollection();
-    else
-      this.checkForExternalText();
-    this._form.appendChild(this._controls.editor);
-  },
-
-  loadCollection: function() {
-    this._form.addClassName(this.options.loadingClassName);
-    this.showLoadingText(this.options.loadingCollectionText);
-    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-    Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
-      onComplete: Prototype.emptyFunction,
-      onSuccess: function(transport) {
-        var js = transport.responseText.strip();
-        if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
-          throw('Server returned an invalid collection representation.');
-        this._collection = eval(js);
-        this.checkForExternalText();
-      }.bind(this),
-      onFailure: this.onFailure
-    });
-    new Ajax.Request(this.options.loadCollectionURL, options);
-  },
-
-  showLoadingText: function(text) {
-    this._controls.editor.disabled = true;
-    var tempOption = this._controls.editor.firstChild;
-    if (!tempOption) {
-      tempOption = document.createElement('option');
-      tempOption.value = '';
-      this._controls.editor.appendChild(tempOption);
-      tempOption.selected = true;
-    }
-    tempOption.update((text || '').stripScripts().stripTags());
-  },
-
-  checkForExternalText: function() {
-    this._text = this.getText();
-    if (this.options.loadTextURL)
-      this.loadExternalText();
-    else
-      this.buildOptionList();
-  },
-
-  loadExternalText: function() {
-    this.showLoadingText(this.options.loadingText);
-    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
-    Object.extend(options, {
-      parameters: 'editorId=' + encodeURIComponent(this.element.id),
-      onComplete: Prototype.emptyFunction,
-      onSuccess: function(transport) {
-        this._text = transport.responseText.strip();
-        this.buildOptionList();
-      }.bind(this),
-      onFailure: this.onFailure
-    });
-    new Ajax.Request(this.options.loadTextURL, options);
-  },
-
-  buildOptionList: function() {
-    this._form.removeClassName(this.options.loadingClassName);
-    this._collection = this._collection.map(function(entry) {
-      return 2 === entry.length ? entry : [entry, entry].flatten();
-    });
-    var marker = ('value' in this.options) ? this.options.value : this._text;
-    var textFound = this._collection.any(function(entry) {
-      return entry[0] == marker;
-    }.bind(this));
-    this._controls.editor.update('');
-    var option;
-    this._collection.each(function(entry, index) {
-      option = document.createElement('option');
-      option.value = entry[0];
-      option.selected = textFound ? entry[0] == marker : 0 == index;
-      option.appendChild(document.createTextNode(entry[1]));
-      this._controls.editor.appendChild(option);
-    }.bind(this));
-    this._controls.editor.disabled = false;
-    Field.scrollFreeActivate(this._controls.editor);
-  }
-});
-
-//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
-//**** This only  exists for a while,  in order to  let ****
-//**** users adapt to  the new API.  Read up on the new ****
-//**** API and convert your code to it ASAP!            ****
-
-Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
-  if (!options) return;
-  function fallback(name, expr) {
-    if (name in options || expr === undefined) return;
-    options[name] = expr;
-  };
-  fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
-    options.cancelLink == options.cancelButton == false ? false : undefined)));
-  fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
-    options.okLink == options.okButton == false ? false : undefined)));
-  fallback('highlightColor', options.highlightcolor);
-  fallback('highlightEndColor', options.highlightendcolor);
-};
-
-Object.extend(Ajax.InPlaceEditor, {
-  DefaultOptions: {
-    ajaxOptions: { },
-    autoRows: 3,                                // Use when multi-line w/ rows == 1
-    cancelControl: 'link',                      // 'link'|'button'|false
-    cancelText: 'cancel',
-    clickToEditText: 'Click to edit',
-    externalControl: null,                      // id|elt
-    externalControlOnly: false,
-    fieldPostCreation: 'activate',              // 'activate'|'focus'|false
-    formClassName: 'inplaceeditor-form',
-    formId: null,                               // id|elt
-    highlightColor: '#ffff99',
-    highlightEndColor: '#ffffff',
-    hoverClassName: '',
-    htmlResponse: true,
-    loadingClassName: 'inplaceeditor-loading',
-    loadingText: 'Loading...',
-    okControl: 'button',                        // 'link'|'button'|false
-    okText: 'ok',
-    paramName: 'value',
-    rows: 1,                                    // If 1 and multi-line, uses autoRows
-    savingClassName: 'inplaceeditor-saving',
-    savingText: 'Saving...',
-    size: 0,
-    stripLoadedTextTags: false,
-    submitOnBlur: false,
-    textAfterControls: '',
-    textBeforeControls: '',
-    textBetweenControls: ''
-  },
-  DefaultCallbacks: {
-    callback: function(form) {
-      return Form.serialize(form);
-    },
-    onComplete: function(transport, element) {
-      // For backward compatibility, this one is bound to the IPE, and passes
-      // the element directly.  It was too often customized, so we don't break it.
-      new Effect.Highlight(element, {
-        startcolor: this.options.highlightColor, keepBackgroundImage: true });
-    },
-    onEnterEditMode: null,
-    onEnterHover: function(ipe) {
-      ipe.element.style.backgroundColor = ipe.options.highlightColor;
-      if (ipe._effect)
-        ipe._effect.cancel();
-    },
-    onFailure: function(transport, ipe) {
-      alert('Error communication with the server: ' + transport.responseText.stripTags());
-    },
-    onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
-    onLeaveEditMode: null,
-    onLeaveHover: function(ipe) {
-      ipe._effect = new Effect.Highlight(ipe.element, {
-        startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
-        restorecolor: ipe._originalBackground, keepBackgroundImage: true
-      });
-    }
-  },
-  Listeners: {
-    click: 'enterEditMode',
-    keydown: 'checkForEscapeOrReturn',
-    mouseover: 'enterHover',
-    mouseout: 'leaveHover'
-  }
-});
-
-Ajax.InPlaceCollectionEditor.DefaultOptions = {
-  loadingCollectionText: 'Loading options...'
-};
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create({
-  initialize: function(element, delay, callback) {
-    this.delay     = delay || 0.5;
-    this.element   = $(element);
-    this.callback  = callback;
-    this.timer     = null;
-    this.lastValue = $F(this.element);
-    Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
-  },
-  delayedListener: function(event) {
-    if(this.lastValue == $F(this.element)) return;
-    if(this.timer) clearTimeout(this.timer);
-    this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
-    this.lastValue = $F(this.element);
-  },
-  onTimerEvent: function() {
-    this.timer = null;
-    this.callback(this.element, $F(this.element));
-  }
-});
\ No newline at end of file
diff --git a/lib/web/scriptaculous/dragdrop.js b/lib/web/scriptaculous/dragdrop.js
deleted file mode 100644
index 9ebfe24d3c03ca874c1877af842d80ce2ede87c9..0000000000000000000000000000000000000000
--- a/lib/web/scriptaculous/dragdrop.js
+++ /dev/null
@@ -1,974 +0,0 @@
-// script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
-
-// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(Object.isUndefined(Effect))
-  throw("dragdrop.js requires including script.aculo.us' effects.js library");
-
-var Droppables = {
-  drops: [],
-
-  remove: function(element) {
-    this.drops = this.drops.reject(function(d) { return d.element==$(element) });
-  },
-
-  add: function(element) {
-    element = $(element);
-    var options = Object.extend({
-      greedy:     true,
-      hoverclass: null,
-      tree:       false
-    }, arguments[1] || { });
-
-    // cache containers
-    if(options.containment) {
-      options._containers = [];
-      var containment = options.containment;
-      if(Object.isArray(containment)) {
-        containment.each( function(c) { options._containers.push($(c)) });
-      } else {
-        options._containers.push($(containment));
-      }
-    }
-
-    if(options.accept) options.accept = [options.accept].flatten();
-
-    Element.makePositioned(element); // fix IE
-    options.element = element;
-
-    this.drops.push(options);
-  },
-
-  findDeepestChild: function(drops) {
-    deepest = drops[0];
-
-    for (i = 1; i < drops.length; ++i)
-      if (Element.isParent(drops[i].element, deepest.element))
-        deepest = drops[i];
-
-    return deepest;
-  },
-
-  isContained: function(element, drop) {
-    var containmentNode;
-    if(drop.tree) {
-      containmentNode = element.treeNode;
-    } else {
-      containmentNode = element.parentNode;
-    }
-    return drop._containers.detect(function(c) { return containmentNode == c });
-  },
-
-  isAffected: function(point, element, drop) {
-    return (
-      (drop.element!=element) &&
-      ((!drop._containers) ||
-        this.isContained(element, drop)) &&
-      ((!drop.accept) ||
-        (Element.classNames(element).detect(
-          function(v) { return drop.accept.include(v) } ) )) &&
-      Position.within(drop.element, point[0], point[1]) );
-  },
-
-  deactivate: function(drop) {
-    if(drop.hoverclass)
-      Element.removeClassName(drop.element, drop.hoverclass);
-    this.last_active = null;
-  },
-
-  activate: function(drop) {
-    if(drop.hoverclass)
-      Element.addClassName(drop.element, drop.hoverclass);
-    this.last_active = drop;
-  },
-
-  show: function(point, element) {
-    if(!this.drops.length) return;
-    var drop, affected = [];
-
-    this.drops.each( function(drop) {
-      if(Droppables.isAffected(point, element, drop))
-        affected.push(drop);
-    });
-
-    if(affected.length>0)
-      drop = Droppables.findDeepestChild(affected);
-
-    if(this.last_active && this.last_active != drop) this.deactivate(this.last_active);
-    if (drop) {
-      Position.within(drop.element, point[0], point[1]);
-      if(drop.onHover)
-        drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
-      if (drop != this.last_active) Droppables.activate(drop);
-    }
-  },
-
-  fire: function(event, element) {
-    if(!this.last_active) return;
-    Position.prepare();
-
-    if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
-      if (this.last_active.onDrop) {
-        this.last_active.onDrop(element, this.last_active.element, event);
-        return true;
-      }
-  },
-
-  reset: function() {
-    if(this.last_active)
-      this.deactivate(this.last_active);
-  }
-};
-
-var Draggables = {
-  drags: [],
-  observers: [],
-
-  register: function(draggable) {
-    if(this.drags.length == 0) {
-      this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
-      this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
-      this.eventKeypress  = this.keyPress.bindAsEventListener(this);
-
-      Event.observe(document, "mouseup", this.eventMouseUp);
-      Event.observe(document, "mousemove", this.eventMouseMove);
-      Event.observe(document, "keypress", this.eventKeypress);
-    }
-    this.drags.push(draggable);
-  },
-
-  unregister: function(draggable) {
-    this.drags = this.drags.reject(function(d) { return d==draggable });
-    if(this.drags.length == 0) {
-      Event.stopObserving(document, "mouseup", this.eventMouseUp);
-      Event.stopObserving(document, "mousemove", this.eventMouseMove);
-      Event.stopObserving(document, "keypress", this.eventKeypress);
-    }
-  },
-
-  activate: function(draggable) {
-    if(draggable.options.delay) {
-      this._timeout = setTimeout(function() {
-        Draggables._timeout = null;
-        window.focus();
-        Draggables.activeDraggable = draggable;
-      }.bind(this), draggable.options.delay);
-    } else {
-      window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
-      this.activeDraggable = draggable;
-    }
-  },
-
-  deactivate: function() {
-    this.activeDraggable = null;
-  },
-
-  updateDrag: function(event) {
-    if(!this.activeDraggable) return;
-    var pointer = [Event.pointerX(event), Event.pointerY(event)];
-    // Mozilla-based browsers fire successive mousemove events with
-    // the same coordinates, prevent needless redrawing (moz bug?)
-    if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
-    this._lastPointer = pointer;
-
-    this.activeDraggable.updateDrag(event, pointer);
-  },
-
-  endDrag: function(event) {
-    if(this._timeout) {
-      clearTimeout(this._timeout);
-      this._timeout = null;
-    }
-    if(!this.activeDraggable) return;
-    this._lastPointer = null;
-    this.activeDraggable.endDrag(event);
-    this.activeDraggable = null;
-  },
-
-  keyPress: function(event) {
-    if(this.activeDraggable)
-      this.activeDraggable.keyPress(event);
-  },
-
-  addObserver: function(observer) {
-    this.observers.push(observer);
-    this._cacheObserverCallbacks();
-  },
-
-  removeObserver: function(element) {  // element instead of observer fixes mem leaks
-    this.observers = this.observers.reject( function(o) { return o.element==element });
-    this._cacheObserverCallbacks();
-  },
-
-  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
-    if(this[eventName+'Count'] > 0)
-      this.observers.each( function(o) {
-        if(o[eventName]) o[eventName](eventName, draggable, event);
-      });
-    if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
-  },
-
-  _cacheObserverCallbacks: function() {
-    ['onStart','onEnd','onDrag'].each( function(eventName) {
-      Draggables[eventName+'Count'] = Draggables.observers.select(
-        function(o) { return o[eventName]; }
-      ).length;
-    });
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create({
-  initialize: function(element) {
-    var defaults = {
-      handle: false,
-      reverteffect: function(element, top_offset, left_offset) {
-        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
-        new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
-          queue: {scope:'_draggable', position:'end'}
-        });
-      },
-      endeffect: function(element) {
-        var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
-        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
-          queue: {scope:'_draggable', position:'end'},
-          afterFinish: function(){
-            Draggable._dragging[element] = false
-          }
-        });
-      },
-      zindex: 1000,
-      revert: false,
-      quiet: false,
-      scroll: false,
-      scrollSensitivity: 20,
-      scrollSpeed: 15,
-      snap: false,  // false, or xy or [x,y] or function(x,y){ return [x,y] }
-      delay: 0
-    };
-
-    if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
-      Object.extend(defaults, {
-        starteffect: function(element) {
-          element._opacity = Element.getOpacity(element);
-          Draggable._dragging[element] = true;
-          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
-        }
-      });
-
-    var options = Object.extend(defaults, arguments[1] || { });
-
-    this.element = $(element);
-
-    if(options.handle && Object.isString(options.handle))
-      this.handle = this.element.down('.'+options.handle, 0);
-
-    if(!this.handle) this.handle = $(options.handle);
-    if(!this.handle) this.handle = this.element;
-
-    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
-      options.scroll = $(options.scroll);
-      this._isScrollChild = Element.childOf(this.element, options.scroll);
-    }
-
-    Element.makePositioned(this.element); // fix IE
-
-    this.options  = options;
-    this.dragging = false;
-
-    this.eventMouseDown = this.initDrag.bindAsEventListener(this);
-    Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
-    Draggables.register(this);
-  },
-
-  destroy: function() {
-    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
-    Draggables.unregister(this);
-  },
-
-  currentDelta: function() {
-    return([
-      parseInt(Element.getStyle(this.element,'left') || '0'),
-      parseInt(Element.getStyle(this.element,'top') || '0')]);
-  },
-
-  initDrag: function(event) {
-    if(!Object.isUndefined(Draggable._dragging[this.element]) &&
-      Draggable._dragging[this.element]) return;
-    if(Event.isLeftClick(event)) {
-      // abort on form elements, fixes a Firefox issue
-      var src = Event.element(event);
-      if((tag_name = src.tagName.toUpperCase()) && (
-        tag_name=='INPUT' ||
-        tag_name=='SELECT' ||
-        tag_name=='OPTION' ||
-        tag_name=='BUTTON' ||
-        tag_name=='TEXTAREA')) return;
-
-      var pointer = [Event.pointerX(event), Event.pointerY(event)];
-      var pos     = this.element.cumulativeOffset();
-      this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
-      Draggables.activate(this);
-      Event.stop(event);
-    }
-  },
-
-  startDrag: function(event) {
-    this.dragging = true;
-    if(!this.delta)
-      this.delta = this.currentDelta();
-
-    if(this.options.zindex) {
-      this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
-      this.element.style.zIndex = this.options.zindex;
-    }
-
-    if(this.options.ghosting) {
-      this._clone = this.element.cloneNode(true);
-      this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
-      if (!this._originallyAbsolute)
-        Position.absolutize(this.element);
-      this.element.parentNode.insertBefore(this._clone, this.element);
-    }
-
-    if(this.options.scroll) {
-      if (this.options.scroll == window) {
-        var where = this._getWindowScroll(this.options.scroll);
-        this.originalScrollLeft = where.left;
-        this.originalScrollTop = where.top;
-      } else {
-        this.originalScrollLeft = this.options.scroll.scrollLeft;
-        this.originalScrollTop = this.options.scroll.scrollTop;
-      }
-    }
-
-    Draggables.notify('onStart', this, event);
-
-    if(this.options.starteffect) this.options.starteffect(this.element);
-  },
-
-  updateDrag: function(event, pointer) {
-    if(!this.dragging) this.startDrag(event);
-
-    if(!this.options.quiet){
-      Position.prepare();
-      Droppables.show(pointer, this.element);
-    }
-
-    Draggables.notify('onDrag', this, event);
-
-    this.draw(pointer);
-    if(this.options.change) this.options.change(this);
-
-    if(this.options.scroll) {
-      this.stopScrolling();
-
-      var p;
-      if (this.options.scroll == window) {
-        with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
-      } else {
-        p = Position.page(this.options.scroll).toArray();
-        p[0] += this.options.scroll.scrollLeft + Position.deltaX;
-        p[1] += this.options.scroll.scrollTop + Position.deltaY;
-        p.push(p[0]+this.options.scroll.offsetWidth);
-        p.push(p[1]+this.options.scroll.offsetHeight);
-      }
-      var speed = [0,0];
-      if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
-      if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
-      if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
-      if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
-      this.startScrolling(speed);
-    }
-
-    // fix AppleWebKit rendering
-    if(Prototype.Browser.WebKit) window.scrollBy(0,0);
-
-    Event.stop(event);
-  },
-
-  finishDrag: function(event, success) {
-    this.dragging = false;
-
-    if(this.options.quiet){
-      Position.prepare();
-      var pointer = [Event.pointerX(event), Event.pointerY(event)];
-      Droppables.show(pointer, this.element);
-    }
-
-    if(this.options.ghosting) {
-      if (!this._originallyAbsolute)
-        Position.relativize(this.element);
-      delete this._originallyAbsolute;
-      Element.remove(this._clone);
-      this._clone = null;
-    }
-
-    var dropped = false;
-    if(success) {
-      dropped = Droppables.fire(event, this.element);
-      if (!dropped) dropped = false;
-    }
-    if(dropped && this.options.onDropped) this.options.onDropped(this.element);
-    Draggables.notify('onEnd', this, event);
-
-    var revert = this.options.revert;
-    if(revert && Object.isFunction(revert)) revert = revert(this.element);
-
-    var d = this.currentDelta();
-    if(revert && this.options.reverteffect) {
-      if (dropped == 0 || revert != 'failure')
-        this.options.reverteffect(this.element,
-          d[1]-this.delta[1], d[0]-this.delta[0]);
-    } else {
-      this.delta = d;
-    }
-
-    if(this.options.zindex)
-      this.element.style.zIndex = this.originalZ;
-
-    if(this.options.endeffect)
-      this.options.endeffect(this.element);
-
-    Draggables.deactivate(this);
-    Droppables.reset();
-  },
-
-  keyPress: function(event) {
-    if(event.keyCode!=Event.KEY_ESC) return;
-    this.finishDrag(event, false);
-    Event.stop(event);
-  },
-
-  endDrag: function(event) {
-    if(!this.dragging) return;
-    this.stopScrolling();
-    this.finishDrag(event, true);
-    Event.stop(event);
-  },
-
-  draw: function(point) {
-    var pos = this.element.cumulativeOffset();
-    if(this.options.ghosting) {
-      var r   = Position.realOffset(this.element);
-      pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
-    }
-
-    var d = this.currentDelta();
-    pos[0] -= d[0]; pos[1] -= d[1];
-
-    if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
-      pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
-      pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
-    }
-
-    var p = [0,1].map(function(i){
-      return (point[i]-pos[i]-this.offset[i])
-    }.bind(this));
-
-    if(this.options.snap) {
-      if(Object.isFunction(this.options.snap)) {
-        p = this.options.snap(p[0],p[1],this);
-      } else {
-      if(Object.isArray(this.options.snap)) {
-        p = p.map( function(v, i) {
-          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
-      } else {
-        p = p.map( function(v) {
-          return (v/this.options.snap).round()*this.options.snap }.bind(this));
-      }
-    }}
-
-    var style = this.element.style;
-    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
-      style.left = p[0] + "px";
-    if((!this.options.constraint) || (this.options.constraint=='vertical'))
-      style.top  = p[1] + "px";
-
-    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
-  },
-
-  stopScrolling: function() {
-    if(this.scrollInterval) {
-      clearInterval(this.scrollInterval);
-      this.scrollInterval = null;
-      Draggables._lastScrollPointer = null;
-    }
-  },
-
-  startScrolling: function(speed) {
-    if(!(speed[0] || speed[1])) return;
-    this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
-    this.lastScrolled = new Date();
-    this.scrollInterval = setInterval(this.scroll.bind(this), 10);
-  },
-
-  scroll: function() {
-    var current = new Date();
-    var delta = current - this.lastScrolled;
-    this.lastScrolled = current;
-    if(this.options.scroll == window) {
-      with (this._getWindowScroll(this.options.scroll)) {
-        if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
-          var d = delta / 1000;
-          this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
-        }
-      }
-    } else {
-      this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
-      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
-    }
-
-    Position.prepare();
-    Droppables.show(Draggables._lastPointer, this.element);
-    Draggables.notify('onDrag', this);
-    if (this._isScrollChild) {
-      Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
-      Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
-      Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
-      if (Draggables._lastScrollPointer[0] < 0)
-        Draggables._lastScrollPointer[0] = 0;
-      if (Draggables._lastScrollPointer[1] < 0)
-        Draggables._lastScrollPointer[1] = 0;
-      this.draw(Draggables._lastScrollPointer);
-    }
-
-    if(this.options.change) this.options.change(this);
-  },
-
-  _getWindowScroll: function(w) {
-    var T, L, W, H;
-    with (w.document) {
-      if (w.document.documentElement && documentElement.scrollTop) {
-        T = documentElement.scrollTop;
-        L = documentElement.scrollLeft;
-      } else if (w.document.body) {
-        T = body.scrollTop;
-        L = body.scrollLeft;
-      }
-      if (w.innerWidth) {
-        W = w.innerWidth;
-        H = w.innerHeight;
-      } else if (w.document.documentElement && documentElement.clientWidth) {
-        W = documentElement.clientWidth;
-        H = documentElement.clientHeight;
-      } else {
-        W = body.offsetWidth;
-        H = body.offsetHeight;
-      }
-    }
-    return { top: T, left: L, width: W, height: H };
-  }
-});
-
-Draggable._dragging = { };
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create({
-  initialize: function(element, observer) {
-    this.element   = $(element);
-    this.observer  = observer;
-    this.lastValue = Sortable.serialize(this.element);
-  },
-
-  onStart: function() {
-    this.lastValue = Sortable.serialize(this.element);
-  },
-
-  onEnd: function() {
-    Sortable.unmark();
-    if(this.lastValue != Sortable.serialize(this.element))
-      this.observer(this.element)
-  }
-});
-
-var Sortable = {
-  SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-
-  sortables: { },
-
-  _findRootElement: function(element) {
-    while (element.tagName.toUpperCase() != "BODY") {
-      if(element.id && Sortable.sortables[element.id]) return element;
-      element = element.parentNode;
-    }
-  },
-
-  options: function(element) {
-    element = Sortable._findRootElement($(element));
-    if(!element) return;
-    return Sortable.sortables[element.id];
-  },
-
-  destroy: function(element){
-    element = $(element);
-    var s = Sortable.sortables[element.id];
-
-    if(s) {
-      Draggables.removeObserver(s.element);
-      s.droppables.each(function(d){ Droppables.remove(d) });
-      s.draggables.invoke('destroy');
-
-      delete Sortable.sortables[s.element.id];
-    }
-  },
-
-  create: function(element) {
-    element = $(element);
-    var options = Object.extend({
-      element:     element,
-      tag:         'li',       // assumes li children, override with tag: 'tagname'
-      dropOnEmpty: false,
-      tree:        false,
-      treeTag:     'ul',
-      overlap:     'vertical', // one of 'vertical', 'horizontal'
-      constraint:  'vertical', // one of 'vertical', 'horizontal', false
-      containment: element,    // also takes array of elements (or id's); or false
-      handle:      false,      // or a CSS class
-      only:        false,
-      delay:       0,
-      hoverclass:  null,
-      ghosting:    false,
-      quiet:       false,
-      scroll:      false,
-      scrollSensitivity: 20,
-      scrollSpeed: 15,
-      format:      this.SERIALIZE_RULE,
-
-      // these take arrays of elements or ids and can be
-      // used for better initialization performance
-      elements:    false,
-      handles:     false,
-
-      onChange:    Prototype.emptyFunction,
-      onUpdate:    Prototype.emptyFunction
-    }, arguments[1] || { });
-
-    // clear any old sortable with same element
-    this.destroy(element);
-
-    // build options for the draggables
-    var options_for_draggable = {
-      revert:      true,
-      quiet:       options.quiet,
-      scroll:      options.scroll,
-      scrollSpeed: options.scrollSpeed,
-      scrollSensitivity: options.scrollSensitivity,
-      delay:       options.delay,
-      ghosting:    options.ghosting,
-      constraint:  options.constraint,
-      handle:      options.handle };
-
-    if(options.starteffect)
-      options_for_draggable.starteffect = options.starteffect;
-
-    if(options.reverteffect)
-      options_for_draggable.reverteffect = options.reverteffect;
-    else
-      if(options.ghosting) options_for_draggable.reverteffect = function(element) {
-        element.style.top  = 0;
-        element.style.left = 0;
-      };
-
-    if(options.endeffect)
-      options_for_draggable.endeffect = options.endeffect;
-
-    if(options.zindex)
-      options_for_draggable.zindex = options.zindex;
-
-    // build options for the droppables
-    var options_for_droppable = {
-      overlap:     options.overlap,
-      containment: options.containment,
-      tree:        options.tree,
-      hoverclass:  options.hoverclass,
-      onHover:     Sortable.onHover
-    };
-
-    var options_for_tree = {
-      onHover:      Sortable.onEmptyHover,
-      overlap:      options.overlap,
-      containment:  options.containment,
-      hoverclass:   options.hoverclass
-    };
-
-    // fix for gecko engine
-    Element.cleanWhitespace(element);
-
-    options.draggables = [];
-    options.droppables = [];
-
-    // drop on empty handling
-    if(options.dropOnEmpty || options.tree) {
-      Droppables.add(element, options_for_tree);
-      options.droppables.push(element);
-    }
-
-    (options.elements || this.findElements(element, options) || []).each( function(e,i) {
-      var handle = options.handles ? $(options.handles[i]) :
-        (options.handle ? $(e).select('.' + options.handle)[0] : e);
-      options.draggables.push(
-        new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
-      Droppables.add(e, options_for_droppable);
-      if(options.tree) e.treeNode = element;
-      options.droppables.push(e);
-    });
-
-    if(options.tree) {
-      (Sortable.findTreeElements(element, options) || []).each( function(e) {
-        Droppables.add(e, options_for_tree);
-        e.treeNode = element;
-        options.droppables.push(e);
-      });
-    }
-
-    // keep reference
-    this.sortables[element.identify()] = options;
-
-    // for onupdate
-    Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
-  },
-
-  // return all suitable-for-sortable elements in a guaranteed order
-  findElements: function(element, options) {
-    return Element.findChildren(
-      element, options.only, options.tree ? true : false, options.tag);
-  },
-
-  findTreeElements: function(element, options) {
-    return Element.findChildren(
-      element, options.only, options.tree ? true : false, options.treeTag);
-  },
-
-  onHover: function(element, dropon, overlap) {
-    if(Element.isParent(dropon, element)) return;
-
-    if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
-      return;
-    } else if(overlap>0.5) {
-      Sortable.mark(dropon, 'before');
-      if(dropon.previousSibling != element) {
-        var oldParentNode = element.parentNode;
-        element.style.visibility = "hidden"; // fix gecko rendering
-        dropon.parentNode.insertBefore(element, dropon);
-        if(dropon.parentNode!=oldParentNode)
-          Sortable.options(oldParentNode).onChange(element);
-        Sortable.options(dropon.parentNode).onChange(element);
-      }
-    } else {
-      Sortable.mark(dropon, 'after');
-      var nextElement = dropon.nextSibling || null;
-      if(nextElement != element) {
-        var oldParentNode = element.parentNode;
-        element.style.visibility = "hidden"; // fix gecko rendering
-        dropon.parentNode.insertBefore(element, nextElement);
-        if(dropon.parentNode!=oldParentNode)
-          Sortable.options(oldParentNode).onChange(element);
-        Sortable.options(dropon.parentNode).onChange(element);
-      }
-    }
-  },
-
-  onEmptyHover: function(element, dropon, overlap) {
-    var oldParentNode = element.parentNode;
-    var droponOptions = Sortable.options(dropon);
-
-    if(!Element.isParent(dropon, element)) {
-      var index;
-
-      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
-      var child = null;
-
-      if(children) {
-        var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
-        for (index = 0; index < children.length; index += 1) {
-          if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
-            offset -= Element.offsetSize (children[index], droponOptions.overlap);
-          } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
-            child = index + 1 < children.length ? children[index + 1] : null;
-            break;
-          } else {
-            child = children[index];
-            break;
-          }
-        }
-      }
-
-      dropon.insertBefore(element, child);
-
-      Sortable.options(oldParentNode).onChange(element);
-      droponOptions.onChange(element);
-    }
-  },
-
-  unmark: function() {
-    if(Sortable._marker) Sortable._marker.hide();
-  },
-
-  mark: function(dropon, position) {
-    // mark on ghosting only
-    var sortable = Sortable.options(dropon.parentNode);
-    if(sortable && !sortable.ghosting) return;
-
-    if(!Sortable._marker) {
-      Sortable._marker =
-        ($('dropmarker') || Element.extend(document.createElement('DIV'))).
-          hide().addClassName('dropmarker').setStyle({position:'absolute'});
-      document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
-    }
-    var offsets = dropon.cumulativeOffset();
-    Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-
-    if(position=='after')
-      if(sortable.overlap == 'horizontal')
-        Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
-      else
-        Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-
-    Sortable._marker.show();
-  },
-
-  _tree: function(element, options, parent) {
-    var children = Sortable.findElements(element, options) || [];
-
-    for (var i = 0; i < children.length; ++i) {
-      var match = children[i].id.match(options.format);
-
-      if (!match) continue;
-
-      var child = {
-        id: encodeURIComponent(match ? match[1] : null),
-        element: element,
-        parent: parent,
-        children: [],
-        position: parent.children.length,
-        container: $(children[i]).down(options.treeTag)
-      };
-
-      /* Get the element containing the children and recurse over it */
-      if (child.container)
-        this._tree(child.container, options, child);
-
-      parent.children.push (child);
-    }
-
-    return parent;
-  },
-
-  tree: function(element) {
-    element = $(element);
-    var sortableOptions = this.options(element);
-    var options = Object.extend({
-      tag: sortableOptions.tag,
-      treeTag: sortableOptions.treeTag,
-      only: sortableOptions.only,
-      name: element.id,
-      format: sortableOptions.format
-    }, arguments[1] || { });
-
-    var root = {
-      id: null,
-      parent: null,
-      children: [],
-      container: element,
-      position: 0
-    };
-
-    return Sortable._tree(element, options, root);
-  },
-
-  /* Construct a [i] index for a particular node */
-  _constructIndex: function(node) {
-    var index = '';
-    do {
-      if (node.id) index = '[' + node.position + ']' + index;
-    } while ((node = node.parent) != null);
-    return index;
-  },
-
-  sequence: function(element) {
-    element = $(element);
-    var options = Object.extend(this.options(element), arguments[1] || { });
-
-    return $(this.findElements(element, options) || []).map( function(item) {
-      return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
-    });
-  },
-
-  setSequence: function(element, new_sequence) {
-    element = $(element);
-    var options = Object.extend(this.options(element), arguments[2] || { });
-
-    var nodeMap = { };
-    this.findElements(element, options).each( function(n) {
-        if (n.id.match(options.format))
-            nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
-        n.parentNode.removeChild(n);
-    });
-
-    new_sequence.each(function(ident) {
-      var n = nodeMap[ident];
-      if (n) {
-        n[1].appendChild(n[0]);
-        delete nodeMap[ident];
-      }
-    });
-  },
-
-  serialize: function(element) {
-    element = $(element);
-    var options = Object.extend(Sortable.options(element), arguments[1] || { });
-    var name = encodeURIComponent(
-      (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
-    if (options.tree) {
-      return Sortable.tree(element, arguments[1]).children.map( function (item) {
-        return [name + Sortable._constructIndex(item) + "[id]=" +
-                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
-      }).flatten().join('&');
-    } else {
-      return Sortable.sequence(element, arguments[1]).map( function(item) {
-        return name + "[]=" + encodeURIComponent(item);
-      }).join('&');
-    }
-  }
-};
-
-// Returns true if child is contained within element
-Element.isParent = function(child, element) {
-  if (!child.parentNode || child == element) return false;
-  if (child.parentNode == element) return true;
-  return Element.isParent(child.parentNode, element);
-};
-
-Element.findChildren = function(element, only, recursive, tagName) {
-  if(!element.hasChildNodes()) return null;
-  tagName = tagName.toUpperCase();
-  if(only) only = [only].flatten();
-  var elements = [];
-  $A(element.childNodes).each( function(e) {
-    if(e.tagName && e.tagName.toUpperCase()==tagName &&
-      (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
-        elements.push(e);
-    if(recursive) {
-      var grandchildren = Element.findChildren(e, only, recursive, tagName);
-      if(grandchildren) elements.push(grandchildren);
-    }
-  });
-
-  return (elements.length>0 ? elements.flatten() : []);
-};
-
-Element.offsetSize = function (element, type) {
-  return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-};
\ No newline at end of file
diff --git a/lib/web/scriptaculous/slider.js b/lib/web/scriptaculous/slider.js
deleted file mode 100644
index 4580cb8b6d8ebccc5d6a4175ffb0fe6d286c0451..0000000000000000000000000000000000000000
--- a/lib/web/scriptaculous/slider.js
+++ /dev/null
@@ -1,277 +0,0 @@
-// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
-
-// Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if (!Control) var Control = { };
-
-// options:
-//  axis: 'vertical', or 'horizontal' (default)
-//
-// callbacks:
-//  onChange(value)
-//  onSlide(value)
-Control.Slider = Class.create({
-  initialize: function(handle, track, options) {
-    var slider = this;
-
-    if (Object.isArray(handle)) {
-      this.handles = handle.collect( function(e) { return $(e) });
-    } else {
-      this.handles = [$(handle)];
-    }
-
-    this.track   = $(track);
-    this.options = options || { };
-
-    this.axis      = this.options.axis || 'horizontal';
-    this.increment = this.options.increment || 1;
-    this.step      = parseInt(this.options.step || '1');
-    this.range     = this.options.range || $R(0,1);
-
-    this.value     = 0; // assure backwards compat
-    this.values    = this.handles.map( function() { return 0 });
-    this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
-    this.options.startSpan = $(this.options.startSpan || null);
-    this.options.endSpan   = $(this.options.endSpan || null);
-
-    this.restricted = this.options.restricted || false;
-
-    this.maximum   = this.options.maximum || this.range.end;
-    this.minimum   = this.options.minimum || this.range.start;
-
-    // Will be used to align the handle onto the track, if necessary
-    this.alignX = parseInt(this.options.alignX || '0');
-    this.alignY = parseInt(this.options.alignY || '0');
-
-    this.trackLength = this.maximumOffset() - this.minimumOffset();
-
-    this.handleLength = this.isVertical() ?
-      (this.handles[0].offsetHeight != 0 ?
-        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
-      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
-        this.handles[0].style.width.replace(/px$/,""));
-
-    this.active   = false;
-    this.dragging = false;
-    this.disabled = false;
-
-    if (this.options.disabled) this.setDisabled();
-
-    // Allowed values array
-    this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
-    if (this.allowedValues) {
-      this.minimum = this.allowedValues.min();
-      this.maximum = this.allowedValues.max();
-    }
-
-    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
-    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
-    this.eventMouseMove = this.update.bindAsEventListener(this);
-
-    // Initialize handles in reverse (make sure first handle is active)
-    this.handles.each( function(h,i) {
-      i = slider.handles.length-1-i;
-      slider.setValue(parseFloat(
-        (Object.isArray(slider.options.sliderValue) ?
-          slider.options.sliderValue[i] : slider.options.sliderValue) ||
-         slider.range.start), i);
-      h.makePositioned().observe("mousedown", slider.eventMouseDown);
-    });
-
-    this.track.observe("mousedown", this.eventMouseDown);
-    document.observe("mouseup", this.eventMouseUp);
-    $(this.track.parentNode.parentNode).observe("mousemove", this.eventMouseMove);
-
-
-    this.initialized = true;
-  },
-  dispose: function() {
-    var slider = this;
-    Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
-    Event.stopObserving(document, "mouseup", this.eventMouseUp);
-    Event.stopObserving(this.track.parentNode.parentNode, "mousemove", this.eventMouseMove);
-    this.handles.each( function(h) {
-      Event.stopObserving(h, "mousedown", slider.eventMouseDown);
-    });
-  },
-  setDisabled: function(){
-    this.disabled = true;
-    this.track.parentNode.className = this.track.parentNode.className + ' disabled';
-  },
-  setEnabled: function(){
-    this.disabled = false;
-  },
-  getNearestValue: function(value){
-    if (this.allowedValues){
-      if (value >= this.allowedValues.max()) return(this.allowedValues.max());
-      if (value <= this.allowedValues.min()) return(this.allowedValues.min());
-
-      var offset = Math.abs(this.allowedValues[0] - value);
-      var newValue = this.allowedValues[0];
-      this.allowedValues.each( function(v) {
-        var currentOffset = Math.abs(v - value);
-        if (currentOffset <= offset){
-          newValue = v;
-          offset = currentOffset;
-        }
-      });
-      return newValue;
-    }
-    if (value > this.range.end) return this.range.end;
-    if (value < this.range.start) return this.range.start;
-    return value;
-  },
-  setValue: function(sliderValue, handleIdx){
-    if (!this.active) {
-      this.activeHandleIdx = handleIdx || 0;
-      this.activeHandle    = this.handles[this.activeHandleIdx];
-      this.updateStyles();
-    }
-    handleIdx = handleIdx || this.activeHandleIdx || 0;
-    if (this.initialized && this.restricted) {
-      if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
-        sliderValue = this.values[handleIdx-1];
-      if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
-        sliderValue = this.values[handleIdx+1];
-    }
-    sliderValue = this.getNearestValue(sliderValue);
-    this.values[handleIdx] = sliderValue;
-    this.value = this.values[0]; // assure backwards compat
-
-    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
-      this.translateToPx(sliderValue);
-
-    this.drawSpans();
-    if (!this.dragging || !this.event) this.updateFinished();
-  },
-  setValueBy: function(delta, handleIdx) {
-    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
-      handleIdx || this.activeHandleIdx || 0);
-  },
-  translateToPx: function(value) {
-    return Math.round(
-      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
-      (value - this.range.start)) + "px";
-  },
-  translateToValue: function(offset) {
-    return ((offset/(this.trackLength-this.handleLength) *
-      (this.range.end-this.range.start)) + this.range.start);
-  },
-  getRange: function(range) {
-    var v = this.values.sortBy(Prototype.K);
-    range = range || 0;
-    return $R(v[range],v[range+1]);
-  },
-  minimumOffset: function(){
-    return(this.isVertical() ? this.alignY : this.alignX);
-  },
-  maximumOffset: function(){
-    return(this.isVertical() ?
-      (this.track.offsetHeight != 0 ? this.track.offsetHeight :
-        this.track.style.height.replace(/px$/,"")) - this.alignY :
-      (this.track.offsetWidth != 0 ? this.track.offsetWidth :
-        this.track.style.width.replace(/px$/,"")) - this.alignX);
-  },
-  isVertical:  function(){
-    return (this.axis == 'vertical');
-  },
-  drawSpans: function() {
-    var slider = this;
-    if (this.spans)
-      $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
-    if (this.options.startSpan)
-      this.setSpan(this.options.startSpan,
-        $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
-    if (this.options.endSpan)
-      this.setSpan(this.options.endSpan,
-        $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
-  },
-  setSpan: function(span, range) {
-    if (this.isVertical()) {
-      span.style.top = this.translateToPx(range.start);
-      span.style.height = this.translateToPx(range.end - range.start + this.range.start);
-    } else {
-      span.style.left = this.translateToPx(range.start);
-      span.style.width = this.translateToPx(range.end - range.start + this.range.start);
-    }
-  },
-  updateStyles: function() {
-    this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
-    Element.addClassName(this.activeHandle, 'selected');
-  },
-  startDrag: function(event) {
-    if (Event.isLeftClick(event)) {
-      if (!this.disabled){
-        this.active = true;
-
-        var handle = Event.element(event);
-        var pointer  = [Event.pointerX(event), Event.pointerY(event)];
-        var track = handle;
-        if (track==this.track) {
-          var offsets  = Position.cumulativeOffset(this.track);
-          this.event = event;
-          this.setValue(this.translateToValue(
-           (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
-          ));
-          var offsets  = Position.cumulativeOffset(this.activeHandle);
-          this.offsetX = (pointer[0] - offsets[0]);
-          this.offsetY = (pointer[1] - offsets[1]);
-        } else {
-          // find the handle (prevents issues with Safari)
-          while((this.handles.indexOf(handle) == -1) && handle.parentNode)
-            handle = handle.parentNode;
-
-          if (this.handles.indexOf(handle)!=-1) {
-            this.activeHandle    = handle;
-            this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
-            this.updateStyles();
-
-            var offsets  = Position.cumulativeOffset(this.activeHandle);
-            this.offsetX = (pointer[0] - offsets[0]);
-            this.offsetY = (pointer[1] - offsets[1]);
-          }
-        }
-      }
-      Event.stop(event);
-    }
-  },
-  update: function(event) {
-   if (this.active) {
-      if (!this.dragging) this.dragging = true;
-      this.draw(event);
-      if (Prototype.Browser.WebKit) window.scrollBy(0,0);
-      Event.stop(event);
-   }
-  },
-  draw: function(event) {
-    var pointer = [Event.pointerX(event), Event.pointerY(event)];
-    var offsets = Position.cumulativeOffset(this.track);
-    pointer[0] -= this.offsetX + offsets[0];
-    pointer[1] -= this.offsetY + offsets[1];
-    this.event = event;
-    this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
-    if (this.initialized && this.options.onSlide)
-      this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
-  },
-  endDrag: function(event) {
-    if (this.active && this.dragging) {
-      this.finishDrag(event, true);
-      Event.stop(event);
-    }
-    this.active = false;
-    this.dragging = false;
-  },
-  finishDrag: function(event, success) {
-    this.active = false;
-    this.dragging = false;
-    this.updateFinished();
-  },
-  updateFinished: function() {
-    if (this.initialized && this.options.onChange)
-      this.options.onChange(this.values.length>1 ? this.values : this.value, this);
-    this.event = null;
-  }
-});
\ No newline at end of file
diff --git a/lib/web/scriptaculous/sound.js b/lib/web/scriptaculous/sound.js
deleted file mode 100644
index e2487cde5205b697fed3d82d9771072d2ae903d6..0000000000000000000000000000000000000000
--- a/lib/web/scriptaculous/sound.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// script.aculo.us sound.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
-
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// Based on code created by Jules Gravinese (http://www.webveteran.com/)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-Sound = {
-  tracks: {},
-  _enabled: true,
-  template:
-    new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
-  enable: function(){
-    Sound._enabled = true;
-  },
-  disable: function(){
-    Sound._enabled = false;
-  },
-  play: function(url){
-    if(!Sound._enabled) return;
-    var options = Object.extend({
-      track: 'global', url: url, replace: false
-    }, arguments[1] || {});
-
-    if(options.replace && this.tracks[options.track]) {
-      $R(0, this.tracks[options.track].id).each(function(id){
-        var sound = $('sound_'+options.track+'_'+id);
-        sound.Stop && sound.Stop();
-        sound.remove();
-      });
-      this.tracks[options.track] = null;
-    }
-
-    if(!this.tracks[options.track])
-      this.tracks[options.track] = { id: 0 };
-    else
-      this.tracks[options.track].id++;
-
-    options.id = this.tracks[options.track].id;
-    $$('body')[0].insert(
-      Prototype.Browser.IE ? new Element('bgsound',{
-        id: 'sound_'+options.track+'_'+options.id,
-        src: options.url, loop: 1, autostart: true
-      }) : Sound.template.evaluate(options));
-  }
-};
-
-if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
-  if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
-    Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>');
-  else
-    Sound.play = function(){};
-}
\ No newline at end of file
diff --git a/lib/web/varien/form.js b/lib/web/varien/form.js
index 1dd2a06be65870e02d31f8a2522961b2db644b85..99d3afc2fa654eee5251017b106c7115adeb2b7e 100644
--- a/lib/web/varien/form.js
+++ b/lib/web/varien/form.js
@@ -20,6 +20,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
+
+/**
+ * Most likely it's depracated classes.
+ * Not used anywhere among pages.
+ */
 VarienForm = Class.create();
 VarienForm.prototype = {
     initialize: function(formId, firstFieldFocus){
diff --git a/lib/web/varien/js.js b/lib/web/varien/js.js
index 7ddbca05788b5296d166f961e26b90ea69ad62a0..8511e8de3313891e76795364332904a7f1c575ce 100644
--- a/lib/web/varien/js.js
+++ b/lib/web/varien/js.js
@@ -334,38 +334,6 @@ Varien.searchForm.prototype = {
         if(this.field.value==''){
             this.field.value=this.emptyText;
         }
-    },
-
-    initAutocomplete : function(url, destinationElement){
-        new Ajax.Autocompleter(
-            this.field,
-            destinationElement,
-            url,
-            {
-                paramName: this.field.name,
-                method: 'get',
-                minChars: 2,
-                updateElement: this._selectAutocompleteItem.bind(this),
-                onShow : function(element, update) {
-                    if(!update.style.position || update.style.position=='absolute') {
-                        update.style.position = 'absolute';
-                        Position.clone(element, update, {
-                            setHeight: false,
-                            offsetTop: element.offsetHeight
-                        });
-                    }
-                    Effect.Appear(update,{duration:0});
-                }
-
-            }
-        );
-    },
-
-    _selectAutocompleteItem : function(element){
-        if(element.title){
-            this.field.value = element.title;
-        }
-        this.form.submit();
     }
 }
 /* Varien.Tabs is depricated.
diff --git a/setup/.gitignore b/setup/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..a8d6c8e247a15886b68c76fd5ab0a95f0a5773da
--- /dev/null
+++ b/setup/.gitignore
@@ -0,0 +1,3 @@
+composer.lock
+composer.phar
+vendor/*
diff --git a/setup/.htaccess b/setup/.htaccess
new file mode 100644
index 0000000000000000000000000000000000000000..a02263cb14af7fce859ec7070ccda812ec6e0383
--- /dev/null
+++ b/setup/.htaccess
@@ -0,0 +1,16 @@
+RewriteEngine On
+# The following rule tells Apache that if the requested filename
+# exists, simply serve it.
+RewriteCond %{REQUEST_FILENAME} -s [OR]
+RewriteCond %{REQUEST_FILENAME} -l [OR]
+RewriteCond %{REQUEST_FILENAME} -d
+RewriteRule ^.*$ - [NC,L]
+# The following rewrites all other queries to index.php. The
+# condition ensures that if you are using Apache aliases to do
+# mass virtual hosting, the base path will be prepended to
+# allow proper resolution of the index.php file; it will work
+# in non-aliased environments as well, providing a safe, one-size
+# fits all solution.
+RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
+RewriteRule ^(.*) - [E=BASE:%1]
+RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
\ No newline at end of file
diff --git a/setup/composer.json b/setup/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..d69927ba5fa8170d138331f6a91364eff3482758
--- /dev/null
+++ b/setup/composer.json
@@ -0,0 +1,26 @@
+{
+    "name": "Magento Setup Tool",
+    "require": {
+        "zendframework/zendframework": "2.3.1",
+        "composer/composer": "1.0.*@dev"
+    },
+    "require-dev": {
+        "phpunit/phpunit": "4.1.*",
+        "squizlabs/php_codesniffer": "1.*",
+        "phpmd/phpmd" : "1.4.*"
+    },
+    "autoload": {
+        "psr-4": {
+            "Magento\\Setup\\": "module/Magento/Setup/src/",
+            "Magento\\Config\\": "module/Magento/Config/src/",
+            "Magento\\Install\\": "module/Magento/Install/src/"
+        }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "Magento\\Setup\\Tests\\": "module/Magento/Setup/tests/",
+            "Magento\\Config\\Tests\\": "module/Magento/Config/tests/",
+            "Magento\\Install\\Tests\\": "module/Magento/Install/tests/"
+        }
+    }
+}
diff --git a/setup/config/application.config.php b/setup/config/application.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..2e0cf621a353e7e0ed9d5948eb98f3dda7af8968
--- /dev/null
+++ b/setup/config/application.config.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'modules' => [
+        'Magento\Composer',
+        'Magento\Config',
+        'Magento\Filesystem',
+        'Magento\Locale',
+        'Magento\Module',
+        'Magento\Setup',
+        'Magento\Framework',
+    ],
+    'module_listener_options' => [
+        'module_paths' => [
+            './module',
+            './vendor',
+        ],
+        'config_glob_paths' => array(
+            'config/autoload/{,*.}{global,local}.php',
+        ),
+    ],
+];
diff --git a/setup/config/autoload/global.php b/setup/config/autoload/global.php
new file mode 100644
index 0000000000000000000000000000000000000000..27854c20cabf8e465634d361ce747c46339936ed
--- /dev/null
+++ b/setup/config/autoload/global.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'parameters' => [
+        'application' => [
+            'base_path' => realpath(__DIR__ . '/../../'),
+        ],
+        'magento' => [
+            'base_path' => realpath(__DIR__ . '/../../../'),
+            'filesystem' => [
+                'module' => '/app/code/',
+                'config' => '/app/etc/',
+                'framework' => '/lib/internal/Magento/Framework/',
+                'permissions' => [
+                    'etc' => [
+                        'path' => 'app/etc',
+                    ],
+                    'var' => [
+                        'path' => 'var',
+                    ],
+                    'cache' => [
+                        'path' => 'var/cache',
+                    ],
+                    'log' => [
+                        'path' => 'var/log',
+                    ],
+                    'session' => [
+                        'path' => 'var/session',
+                    ],
+                ],
+            ],
+        ],
+    ],
+];
diff --git a/setup/index.php b/setup/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..b16368bfe991221cc7c60f3d76dbc01d8733dd85
--- /dev/null
+++ b/setup/index.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+include "vendor/autoload.php";
+
+use Zend\Mvc\Service\ServiceManagerConfig;
+use Zend\ServiceManager\ServiceManager;
+
+$configuration = include "config/application.config.php";
+
+$smConfig = new ServiceManagerConfig();
+$serviceManager = new ServiceManager($smConfig);
+$serviceManager->setService('ApplicationConfig', $configuration);
+
+$serviceManager->setAllowOverride(true);
+$serviceManager->get('ModuleManager')->loadModules();
+$serviceManager->setAllowOverride(false);
+
+$serviceManager->get('Application')
+    ->bootstrap()
+    ->run();
\ No newline at end of file
diff --git a/setup/module/Magento/Composer/Module.php b/setup/module/Magento/Composer/Module.php
new file mode 100644
index 0000000000000000000000000000000000000000..de34446a33a561aea2858b2de2c657856664001f
--- /dev/null
+++ b/setup/module/Magento/Composer/Module.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Composer;
+
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+
+class Module implements AutoloaderProviderInterface
+{
+    /**
+     * @return array
+     */
+    public function getAutoloaderConfig()
+    {
+        return [
+            'Zend\Loader\StandardAutoloader' => [
+                'namespaces' => [
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ],
+            ],
+        ];
+    }
+}
diff --git a/setup/module/Magento/Composer/src/FileResolver.php b/setup/module/Magento/Composer/src/FileResolver.php
new file mode 100644
index 0000000000000000000000000000000000000000..98dee5b025c94d4932c9d69fc8650c8074ac9fd3
--- /dev/null
+++ b/setup/module/Magento/Composer/src/FileResolver.php
@@ -0,0 +1,104 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Composer;
+
+use Zend\Stdlib\Glob;
+use Magento\Config\FileResolverInterface;
+use Magento\Config\FileIteratorFactory;
+use Magento\Config\ConfigFactory;
+
+class FileResolver implements FileResolverInterface
+{
+    /**
+     * @var \Magento\Config\FileIteratorFactory
+     */
+    protected $iteratorFactory;
+
+    /**
+     * @var \Magento\Config\ConfigFactory
+     */
+    protected $configFactory;
+
+    /**
+     * @var \Magento\Config\Config
+     */
+    protected $config;
+
+    /**
+     * @param \Magento\Config\FileIteratorFactory $iteratorFactory
+     * @param \Magento\Config\ConfigFactory $configFactory
+     * @internal param \Magento\Config\Config $config
+     */
+    public function __construct(
+        FileIteratorFactory $iteratorFactory,
+        ConfigFactory $configFactory
+    ) {
+        $this->iteratorFactory = $iteratorFactory;
+        $this->configFactory = $configFactory;
+        $this->config = $this->configFactory->create();
+    }
+
+    /**
+     * Collect files and wrap them into an Iterator object
+     *
+     * @param string $filename
+     * @return array
+     */
+    public function get($filename)
+    {
+        $paths = [];
+        $files = $this->getFiles($this->config->getMagentoModulePath() . '*/*/' . $filename);
+        foreach ($files as $file) {
+            $paths[] = $this->getRelativePath($file);
+        }
+        return $this->iteratorFactory->create($this->config->getMagentoBasePath(), $paths);
+    }
+
+    /**
+     * Retrieves relative path
+     *
+     * @param string $path
+     * @return string
+     */
+    protected function getRelativePath($path = null)
+    {
+        $basePath = $this->config->getMagentoBasePath();
+        if (strpos($path, $basePath) === 0
+            || $basePath == $path . '/') {
+            return substr($path, strlen($basePath));
+        } else {
+            return $path;
+        }
+    }
+
+    /**
+     * @param string $path
+     * @return array|false
+     */
+    protected function getFiles($path)
+    {
+        return Glob::glob($this->config->getMagentoBasePath() . $path);
+    }
+}
diff --git a/setup/module/Magento/Composer/src/Reader/Json.php b/setup/module/Magento/Composer/src/Reader/Json.php
new file mode 100644
index 0000000000000000000000000000000000000000..dd646d77dc06b162d617bff70e9ac16a9624d3ef
--- /dev/null
+++ b/setup/module/Magento/Composer/src/Reader/Json.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Module declaration reader. Reads module.xml declaration files from module /etc directories.
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Composer\Reader;
+
+use Magento\Composer\FileResolver;
+
+class Json
+{
+    /**
+     * @var \Magento\Composer\FileResolver
+     */
+    protected $fileResolver;
+
+    /**
+     * The name of file that stores configuration
+     *
+     * @var string
+     */
+    protected $fileName;
+
+    /**
+     * @param FileResolver $fileResolver
+     * @param string $fileName
+     */
+    public function __construct(
+        FileResolver $fileResolver,
+        $fileName = 'composer.json'
+    ) {
+        $this->fileResolver = $fileResolver;
+        $this->fileName = $fileName;
+    }
+
+    /**
+     * @return array
+     */
+    public function read()
+    {
+        $fileList = $this->fileResolver->get($this->fileName);
+        if (!count($fileList)) {
+            return [];
+        }
+        return $this->readFiles($fileList);
+    }
+
+    /**
+     * @param array $fileList
+     * @return array
+     * @throws \Exception
+     */
+    protected function readFiles($fileList)
+    {
+        $result = [];
+        foreach ($fileList as $content) {
+            $result[] = json_decode($content);
+        }
+        return $result;
+    }
+}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Local/Index.php b/setup/module/Magento/Config/Module.php
similarity index 51%
rename from app/code/Magento/Connect/Controller/Adminhtml/Extension/Local/Index.php
rename to setup/module/Magento/Config/Module.php
index 548041728b7ff0e25a58ebbad0c62658b4445191..6a3dc37ca4860088aa6627da0beb7fc0287c60f5 100644
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Local/Index.php
+++ b/setup/module/Magento/Config/Module.php
@@ -1,6 +1,5 @@
 <?php
 /**
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -19,27 +18,35 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Local;
 
-class Index extends \Magento\Backend\App\Action
+namespace Magento\Config;
+
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+
+class Module implements AutoloaderProviderInterface
 {
     /**
-     * Redirect to Magento Connect
-     *
-     * @return void
+     * @return array
+     */
+    public function getConfig()
+    {
+        return include __DIR__ . '/config/module.config.php';
+    }
+
+    /**
+     * @return array
      */
-    public function execute()
+    public function getAutoloaderConfig()
     {
-        $url = $this->_objectManager->get(
-            'Magento\Store\Model\StoreManagerInterface'
-        )->getStore()->getBaseUrl(
-            'web'
-        ) . 'downloader/?return=' . urlencode(
-            $this->_objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl()
+        return array(
+            'Zend\Loader\StandardAutoloader' => array(
+                'namespaces' => array(
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ),
+            ),
         );
-        $this->getResponse()->setRedirect($url);
     }
 }
diff --git a/setup/module/Magento/Config/config/module.config.php b/setup/module/Magento/Config/config/module.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..0a0f0abd5917c5139cab587a680d0fcf3eb5e033
--- /dev/null
+++ b/setup/module/Magento/Config/config/module.config.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+
+];
diff --git a/app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml b/setup/module/Magento/Config/phpunit.xml.dist
similarity index 54%
rename from app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml
rename to setup/module/Magento/Config/phpunit.xml.dist
index da60b9c71dd4d8929962129a94338b3d78a03ae3..179827cce7e2106c33fba999ba361bf94d22e17c 100644
--- a/app/code/Magento/Centinel/view/frontend/layout/checkout_onepage_index.xml
+++ b/setup/module/Magento/Config/phpunit.xml.dist
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
 /**
  * Magento
@@ -23,12 +23,29 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-centinel-centinel-authenticate-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Centinel::centinel-authenticate.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
-</layout>
+<phpunit backupGlobals="false"
+         backupStaticAttributes="false"
+         colors="true"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         processIsolation="false"
+         stopOnFailure="false"
+         syntaxCheck="false"
+         bootstrap="../../../vendor/autoload.php"
+        >
+    <testsuites>
+        <testsuite name="Magento Config Module Test Suite">
+            <directory>./tests/</directory>
+        </testsuite>
+    </testsuites>
+
+    <filter>
+        <whitelist>
+            <directory>./</directory>
+            <exclude>
+                <directory>./tests</directory>
+            </exclude>
+        </whitelist>
+    </filter>
+</phpunit>
diff --git a/setup/module/Magento/Config/src/Config.php b/setup/module/Magento/Config/src/Config.php
new file mode 100644
index 0000000000000000000000000000000000000000..f99c6239ed8664db22178d0ffafeacaf958a98e1
--- /dev/null
+++ b/setup/module/Magento/Config/src/Config.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Config;
+
+use Zend\Config\Config as ZendConfig;
+use Zend\Filter\Inflector;
+
+class Config extends ZendConfig
+{
+    /**
+     * @var Inflector
+     */
+    private $inflector;
+
+    /**
+     * @param Inflector $inflector
+     * @param array $array
+     */
+    public function __construct(Inflector $inflector, array $array)
+    {
+        $this->inflector = $inflector;
+        $this->inflector->setTarget(':name')
+            ->setRules([':name' => ['Word\CamelCaseToUnderscore', 'StringToLower']]);
+
+        foreach ($array as $key => $value) {
+            if (is_array($value)) {
+                $this->data[$key] = new static($this->inflector, $value);
+            } else {
+                $this->data[$key] = $value;
+            }
+
+            $this->count++;
+        }
+    }
+
+    /**
+     * Retrieve a value and return $default if there is no element set.
+     *
+     * @param  string $name
+     * @param  mixed  $default
+     * @return mixed
+     */
+    public function get($name, $default = null)
+    {
+        $name = $this->inflector->filter(['name' => $name]);
+
+        if (array_key_exists($name, $this->data)) {
+            return $this->data[$name];
+        }
+
+        return $default;
+    }
+
+    /**
+     * Retrieve Magento base path
+     *
+     * @return string
+     */
+    public function getMagentoBasePath()
+    {
+        return $this->magento->basePath;
+    }
+
+    /**
+     * Retrieve path to Magento modules
+     *
+     * @return string
+     */
+    public function getMagentoModulePath()
+    {
+        return $this->magento->filesystem->module;
+    }
+
+    /**
+     * Retrieve the list of Magento file permissions
+     *
+     * @return mixed
+     */
+    public function getMagentoFilePermissions()
+    {
+        return $this->magento->filesystem->permissions;
+    }
+
+    /**
+     * Retrieve path to Magento config directory
+     *
+     * @return mixed
+     */
+    public function getMagentoConfigPath()
+    {
+        return $this->magento->filesystem->config;
+    }
+}
diff --git a/setup/module/Magento/Config/src/ConfigFactory.php b/setup/module/Magento/Config/src/ConfigFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..d42a00b09015631221ef79dea7cd13564763f45d
--- /dev/null
+++ b/setup/module/Magento/Config/src/ConfigFactory.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Config;
+
+use Zend\Filter\Inflector;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+class ConfigFactory
+{
+    /**
+     * @var ServiceLocatorInterface
+     */
+    protected $serviceLocator;
+
+    /**
+     * @var array
+     */
+    protected $configuration = [];
+
+    /**
+     * @param ServiceLocatorInterface $serviceLocator
+     */
+    public function __construct(ServiceLocatorInterface $serviceLocator)
+    {
+        $this->serviceLocator = $serviceLocator;
+        $this->configuration = $this->serviceLocator->get('config')['parameters'];
+    }
+
+    /**
+     * @return Config
+     */
+    public function create()
+    {
+        return new Config(new Inflector(), $this->configuration);
+    }
+}
diff --git a/lib/internal/Magento/Framework/Connect/Ftp.php b/setup/module/Magento/Config/src/Converter/ConverterInterface.php
similarity index 66%
rename from lib/internal/Magento/Framework/Connect/Ftp.php
rename to setup/module/Magento/Config/src/Converter/ConverterInterface.php
index 62941a629d8be9f4175627e4845df899d15f5629..90ccc95343a1312ff4b18f0a4b4155a6a3f544d8 100644
--- a/lib/internal/Magento/Framework/Connect/Ftp.php
+++ b/setup/module/Magento/Config/src/Converter/ConverterInterface.php
@@ -17,18 +17,20 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ * 
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/**
- * Class to work with remote FTP server
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Connect;
+namespace Magento\Config\Converter;
 
-class Ftp extends \Magento\Framework\System\Ftp
+interface ConverterInterface
 {
+    /**
+     * Convert config
+     *
+     * @param \DOMDocument $source
+     * @return array
+     */
+    public function convert($source);
 }
diff --git a/setup/module/Magento/Config/src/Dom.php b/setup/module/Magento/Config/src/Dom.php
new file mode 100644
index 0000000000000000000000000000000000000000..8166e63e420cc3afd9c81bc537327549bbcca4ee
--- /dev/null
+++ b/setup/module/Magento/Config/src/Dom.php
@@ -0,0 +1,386 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/**
+ * Magento configuration XML DOM utility
+ */
+namespace Magento\Config;
+
+class Dom
+{
+    /**
+     * Prefix which will be used for root namespace
+     */
+    const ROOT_NAMESPACE_PREFIX = 'x';
+
+    /**
+     * Format of items in errors array to be used by default. Available placeholders - fields of \LibXMLError.
+     */
+    const ERROR_FORMAT_DEFAULT = "%message%\nLine: %line%\n";
+
+    /**
+     * Dom document
+     *
+     * @var \DOMDocument
+     */
+    protected $_dom;
+
+    /**
+     * @var Dom\NodeMergingConfig
+     */
+    protected $_nodeMergingConfig;
+
+    /**
+     * Name of attribute that specifies type of argument node
+     *
+     * @var string|null
+     */
+    protected $_typeAttributeName;
+
+    /**
+     * Schema validation file
+     *
+     * @var string
+     */
+    protected $_schemaFile;
+
+    /**
+     * Format of error messages
+     *
+     * @var string
+     */
+    protected $_errorFormat;
+
+    /**
+     * Default namespace for xml elements
+     *
+     * @var string
+     */
+    protected $_rootNamespace;
+
+    /**
+     * Build DOM with initial XML contents and specifying identifier attributes for merging
+     *
+     * Format of $idAttributes: array('/xpath/to/some/node' => 'id_attribute_name')
+     * The path to ID attribute name should not include any attribute notations or modifiers -- only node names
+     *
+     * @param string $xml
+     * @param array $idAttributes
+     * @param string $typeAttributeName
+     * @param string $schemaFile
+     * @param string $errorFormat
+     */
+    public function __construct(
+        $xml,
+        array $idAttributes = array(),
+        $typeAttributeName = null,
+        $schemaFile = null,
+        $errorFormat = self::ERROR_FORMAT_DEFAULT
+    ) {
+        $this->_schemaFile = $schemaFile;
+        $this->_nodeMergingConfig = new Dom\NodeMergingConfig(new Dom\NodePathMatcher(), $idAttributes);
+        $this->_typeAttributeName = $typeAttributeName;
+        $this->_errorFormat = $errorFormat;
+        $this->_dom = $this->_initDom($xml);
+        $this->_rootNamespace = $this->_dom->lookupNamespaceUri($this->_dom->namespaceURI);
+    }
+
+    /**
+     * Merge $xml into DOM document
+     *
+     * @param string $xml
+     * @return void
+     */
+    public function merge($xml)
+    {
+        $dom = $this->_initDom($xml);
+        $this->_mergeNode($dom->documentElement, '');
+    }
+
+    /**
+     * Recursive merging of the \DOMElement into the original document
+     *
+     * Algorithm:
+     * 1. Find the same node in original document
+     * 2. Extend and override original document node attributes and scalar value if found
+     * 3. Append new node if original document doesn't have the same node
+     *
+     * @param \DOMElement $node
+     * @param string $parentPath path to parent node
+     * @return void
+     */
+    protected function _mergeNode(\DOMElement $node, $parentPath)
+    {
+        $path = $this->_getNodePathByParent($node, $parentPath);
+
+        $matchedNode = $this->_getMatchedNode($path);
+
+        /* Update matched node attributes and value */
+        if ($matchedNode) {
+
+            //different node type
+            if ($this->_typeAttributeName && $node->hasAttribute(
+                $this->_typeAttributeName
+            ) && $matchedNode->hasAttribute(
+                $this->_typeAttributeName
+            ) && $node->getAttribute(
+                $this->_typeAttributeName
+            ) !== $matchedNode->getAttribute(
+                $this->_typeAttributeName
+            )
+            ) {
+                $parentMatchedNode = $this->_getMatchedNode($parentPath);
+                $newNode = $this->_dom->importNode($node, true);
+                $parentMatchedNode->replaceChild($newNode, $matchedNode);
+                return;
+            }
+
+            $this->_mergeAttributes($matchedNode, $node);
+            if (!$node->hasChildNodes()) {
+                return;
+            }
+            /* override node value */
+            if ($this->_isTextNode($node)) {
+                /* skip the case when the matched node has children, otherwise they get overridden */
+                if (!$matchedNode->hasChildNodes() || $this->_isTextNode($matchedNode)) {
+                    $matchedNode->nodeValue = $node->childNodes->item(0)->nodeValue;
+                }
+            } else {
+                /* recursive merge for all child nodes */
+                foreach ($node->childNodes as $childNode) {
+                    if ($childNode instanceof \DOMElement) {
+                        $this->_mergeNode($childNode, $path);
+                    }
+                }
+            }
+        } else {
+            /* Add node as is to the document under the same parent element */
+            $parentMatchedNode = $this->_getMatchedNode($parentPath);
+            $newNode = $this->_dom->importNode($node, true);
+            $parentMatchedNode->appendChild($newNode);
+        }
+    }
+
+    /**
+     * Check if the node content is text
+     *
+     * @param \DOMElement $node
+     * @return bool
+     */
+    protected function _isTextNode($node)
+    {
+        return $node->childNodes->length == 1 && $node->childNodes->item(0) instanceof \DOMText;
+    }
+
+    /**
+     * Merges attributes of the merge node to the base node
+     *
+     * @param \DOMElement $baseNode
+     * @param \DOMNode $mergeNode
+     * @return void
+     */
+    protected function _mergeAttributes($baseNode, $mergeNode)
+    {
+        foreach ($mergeNode->attributes as $attribute) {
+            $baseNode->setAttribute($this->_getAttributeName($attribute), $attribute->value);
+        }
+    }
+
+    /**
+     * Identify node path based on parent path and node attributes
+     *
+     * @param \DOMElement $node
+     * @param string $parentPath
+     * @return string
+     */
+    protected function _getNodePathByParent(\DOMElement $node, $parentPath)
+    {
+        $prefix = is_null($this->_rootNamespace) ? '' : self::ROOT_NAMESPACE_PREFIX . ':';
+        $path = $parentPath . '/' . $prefix . $node->tagName;
+        $idAttribute = $this->_nodeMergingConfig->getIdAttribute($path);
+        if (is_array($idAttribute)) {
+            $constraints = [];
+            foreach ($idAttribute as $attribute) {
+                $value = $node->getAttribute($attribute);
+                $constraints[] = "@{$attribute}='{$value}'";
+            }
+            $path .= '[' . join(' and ', $constraints) . ']';
+        } elseif ($idAttribute && ($value = $node->getAttribute($idAttribute))) {
+            $path .= "[@{$idAttribute}='{$value}']";
+        }
+        return $path;
+    }
+
+    /**
+     * Getter for node by path
+     *
+     * @param string $nodePath
+     * @throws \Exception An exception is possible if original document contains multiple nodes for identifier
+     * @return \DOMElement|null
+     */
+    protected function _getMatchedNode($nodePath)
+    {
+        $xPath = new \DOMXPath($this->_dom);
+        if ($this->_rootNamespace) {
+            $xPath->registerNamespace(self::ROOT_NAMESPACE_PREFIX, $this->_rootNamespace);
+        }
+        $matchedNodes = $xPath->query($nodePath);
+        $node = null;
+        if ($matchedNodes->length > 1) {
+            throw new \Exception("More than one node matching the query: {$nodePath}");
+        } elseif ($matchedNodes->length == 1) {
+            $node = $matchedNodes->item(0);
+        }
+        return $node;
+    }
+
+    /**
+     * Validate dom document
+     *
+     * @param \DOMDocument $dom
+     * @param string $schemaFileName
+     * @param string $errorFormat
+     * @return array of errors
+     * @throws \Exception
+     */
+    public static function validateDomDocument(
+        \DOMDocument $dom,
+        $schemaFileName,
+        $errorFormat = self::ERROR_FORMAT_DEFAULT
+    ) {
+        libxml_use_internal_errors(true);
+        try {
+            $result = $dom->schemaValidate($schemaFileName);
+            $errors = array();
+            if (!$result) {
+                $validationErrors = libxml_get_errors();
+                if (count($validationErrors)) {
+                    foreach ($validationErrors as $error) {
+                        $errors[] = self::_renderErrorMessage($error, $errorFormat);
+                    }
+                } else {
+                    $errors[] = 'Unknown validation error';
+                }
+            }
+        } catch (\Exception $exception) {
+            libxml_use_internal_errors(false);
+            throw $exception;
+        }
+        libxml_use_internal_errors(false);
+        return $errors;
+    }
+
+    /**
+     * Render error message string by replacing placeholders '%field%' with properties of \LibXMLError
+     *
+     * @param \LibXMLError $errorInfo
+     * @param string $format
+     * @return string
+     * @throws \InvalidArgumentException
+     */
+    private static function _renderErrorMessage(\LibXMLError $errorInfo, $format)
+    {
+        $result = $format;
+        foreach ($errorInfo as $field => $value) {
+            $placeholder = '%' . $field . '%';
+            $value = trim((string)$value);
+            $result = str_replace($placeholder, $value, $result);
+        }
+        if (strpos($result, '%') !== false) {
+            throw new \InvalidArgumentException("Error format '{$format}' contains unsupported placeholders.");
+        }
+        return $result;
+    }
+
+    /**
+     * DOM document getter
+     *
+     * @return \DOMDocument
+     */
+    public function getDom()
+    {
+        return $this->_dom;
+    }
+
+    /**
+     * Create DOM document based on $xml parameter
+     *
+     * @param string $xml
+     * @return \DOMDocument
+     * @throws Dom\ValidationException
+     */
+    protected function _initDom($xml)
+    {
+        $dom = new \DOMDocument();
+        $dom->loadXML($xml);
+        if ($this->_schemaFile) {
+            $errors = self::validateDomDocument($dom, $this->_schemaFile, $this->_errorFormat);
+            if (count($errors)) {
+                throw new Dom\ValidationException(implode("\n", $errors));
+            }
+        }
+        return $dom;
+    }
+
+    /**
+     * Validate self contents towards to specified schema
+     *
+     * @param string $schemaFileName absolute path to schema file
+     * @param array &$errors
+     * @return bool
+     */
+    public function validate($schemaFileName, &$errors = array())
+    {
+        $errors = self::validateDomDocument($this->_dom, $schemaFileName, $this->_errorFormat);
+        return !count($errors);
+    }
+
+    /**
+     * Set schema file
+     *
+     * @param string $schemaFile
+     * @return $this
+     */
+    public function setSchemaFile($schemaFile)
+    {
+        $this->_schemaFile = $schemaFile;
+        return $this;
+    }
+
+    /**
+     * Returns the attribute name with prefix, if there is one
+     *
+     * @param \DOMAttr $attribute
+     * @return string
+     */
+    private function _getAttributeName($attribute)
+    {
+        if (!is_null($attribute->prefix) && !empty($attribute->prefix)) {
+            $attributeName = $attribute->prefix . ':' . $attribute->name;
+        } else {
+            $attributeName = $attribute->name;
+        }
+        return $attributeName;
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem/Iterator/Filter.php b/setup/module/Magento/Config/src/Dom/NodeMergingConfig.php
similarity index 51%
rename from downloader/lib/Magento/Framework/Backup/Filesystem/Iterator/Filter.php
rename to setup/module/Magento/Config/src/Dom/NodeMergingConfig.php
index be4b15e796890eac87f31d0e97349db099d4c2ec..1c5a0e2687e9f0d53ac0fba5a54ec171d0865913 100644
--- a/downloader/lib/Magento/Framework/Backup/Filesystem/Iterator/Filter.php
+++ b/setup/module/Magento/Config/src/Dom/NodeMergingConfig.php
@@ -21,55 +21,48 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Config\Dom;
 
 /**
- * Filter \Iterator
- *
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Configuration of identifier attributes to be taken into account during merging
  */
-namespace Magento\Framework\Backup\Filesystem\Iterator;
-
-class Filter extends \FilterIterator
+class NodeMergingConfig
 {
     /**
-     * Array that is used for filtering
+     * @var NodePathMatcher
+     */
+    private $nodePathMatcher;
+
+    /**
+     * Format: array('/node/path' => '<node_id_attribute>', ...)
      *
      * @var array
      */
-    protected $_filters;
+    private $idAttributes = array();
 
     /**
-     * Constructor
-     *
-     * @param \Iterator $iterator
-     * @param array $filters list of files to skip
+     * @param NodePathMatcher $nodePathMatcher
+     * @param array $idAttributes
      */
-    public function __construct(\Iterator $iterator, array $filters)
+    public function __construct(NodePathMatcher $nodePathMatcher, array $idAttributes)
     {
-        parent::__construct($iterator);
-        $this->_filters = $filters;
+        $this->nodePathMatcher = $nodePathMatcher;
+        $this->idAttributes = $idAttributes;
     }
 
     /**
-     * Check whether the current element of the iterator is acceptable
+     * Retrieve name of an identifier attribute for a node
      *
-     * @return bool
+     * @param string $nodeXpath
+     * @return string|null
      */
-    public function accept()
+    public function getIdAttribute($nodeXpath)
     {
-        $current = $this->current()->__toString();
-        $currentFilename = $this->current()->getFilename();
-
-        if ($currentFilename == '.' || $currentFilename == '..') {
-            return false;
-        }
-
-        foreach ($this->_filters as $filter) {
-            if (false !== strpos($current, $filter)) {
-                return false;
+        foreach ($this->idAttributes as $pathPattern => $idAttribute) {
+            if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) {
+                return $idAttribute;
             }
         }
-
-        return true;
+        return null;
     }
 }
diff --git a/downloader/lib/Magento/Framework/Backup.php b/setup/module/Magento/Config/src/Dom/NodePathMatcher.php
similarity index 51%
rename from downloader/lib/Magento/Framework/Backup.php
rename to setup/module/Magento/Config/src/Dom/NodePathMatcher.php
index 703c062fb0811a6847435f94c4c0d854f6e9b216..071163db28c7a22b9fe95a559c57753f9811e7a2 100644
--- a/downloader/lib/Magento/Framework/Backup.php
+++ b/setup/module/Magento/Config/src/Dom/NodePathMatcher.php
@@ -21,38 +21,38 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Config\Dom;
 
 /**
- * Class to work with backups
- *
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Matching of XPath expressions to path patterns
  */
-namespace Magento\Framework;
-
-class Backup
+class NodePathMatcher
 {
     /**
-     * List of supported a backup types
+     * Whether a subject XPath matches to a given path pattern
      *
-     * @var array
+     * @param string $pathPattern Example: '/some/static/path' or '/some/regexp/path(/item)+'
+     * @param string $xpathSubject Example: '/some[@attr="value"]/static/ns:path'
+     * @return bool
      */
-    protected static $_allowedBackupTypes = array('db', 'snapshot', 'filesystem', 'media', 'nomedia');
+    public function match($pathPattern, $xpathSubject)
+    {
+        $pathSubject = $this->simplifyXpath($xpathSubject);
+        $pathPattern = '#^' . $pathPattern . '$#';
+        return (bool)preg_match($pathPattern, $pathSubject);
+    }
 
     /**
-     * get Backup Instance By File Name
+     * Strip off predicates and namespaces from the XPath
      *
-     * @param  string $type
-     * @throws \Magento\Framework\Exception
-     * @return \Magento\Framework\Backup\BackupInterface
+     * @param string $xpath
+     * @return string
      */
-    public static function getBackupInstance($type)
+    protected function simplifyXpath($xpath)
     {
-        $class = 'Magento\Framework\Backup\\' . ucfirst($type);
-
-        if (!in_array($type, self::$_allowedBackupTypes) || !class_exists($class, true)) {
-            throw new \Magento\Framework\Exception('Current implementation not supported this type (' . $type . ') of backup.');
-        }
-
-        return new $class();
+        $result = $xpath;
+        $result = preg_replace('/\[@[^\]]+?\]/', '', $result);
+        $result = preg_replace('/\/[^:]+?\:/', '/', $result);
+        return $result;
     }
 }
diff --git a/downloader/app/Magento/Downloader/Exception.php b/setup/module/Magento/Config/src/Dom/ValidationException.php
similarity index 84%
rename from downloader/app/Magento/Downloader/Exception.php
rename to setup/module/Magento/Config/src/Dom/ValidationException.php
index 8e265a61eeac98cdf274797b173b83dd3aa59878..dfd1fd906cb3614e50ca0a8fdd882da8d422e00e 100644
--- a/downloader/app/Magento/Downloader/Exception.php
+++ b/setup/module/Magento/Config/src/Dom/ValidationException.php
@@ -23,12 +23,10 @@
  */
 
 /**
- * Class \Exception
- *
- * @author     Magento Core Team <core@magentocommerce.com>
+ * \Exception that should be thrown by DOM model when incoming xml is not valid.
  */
-namespace Magento\Downloader;
+namespace Magento\Config\Dom;
 
-class Exception extends \Exception
+class ValidationException extends \InvalidArgumentException
 {
 }
diff --git a/downloader/lib/Magento/Framework/Connect/Package/VO.php b/setup/module/Magento/Config/src/FileIterator.php
similarity index 51%
rename from downloader/lib/Magento/Framework/Connect/Package/VO.php
rename to setup/module/Magento/Config/src/FileIterator.php
index 513afd4414ede1853ba206139d5e7d85428ed403..6a4441bfd5881a115eeeecf9061901082fe1b29e 100644
--- a/downloader/lib/Magento/Framework/Connect/Package/VO.php
+++ b/setup/module/Magento/Config/src/FileIterator.php
@@ -21,107 +21,105 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Connect\Package;
 
-class VO implements \Iterator
+namespace Magento\Config;
+
+/**
+ * Class FileIterator
+ */
+class FileIterator implements \Iterator, \Countable
 {
+    /**
+     * @var string
+     */
+    private $basePath;
+
     /**
      * @var array
      */
-    protected $properties = array(
-        'name' => '',
-        'package_type_vesrion' => '',
-        'cahnnel' => '',
-        'extends' => '',
-        'summary' => '',
-        'description' => '',
-        'authors' => '',
-        'date' => '',
-        'time' => '',
-        'version' => '',
-        'stability' => 'dev',
-        'license' => '',
-        'license_uri' => '',
-        'contents' => '',
-        'compatible' => '',
-        'hotfix' => ''
-    );
+    protected $paths = array();
 
     /**
-     * @return void
+     * @param string $basePath
+     * @param array $paths
      */
-    public function rewind()
+    public function __construct($basePath, array $paths)
     {
-        reset($this->properties);
+        $this->basePath = $basePath;
+        $this->paths = $paths;
     }
 
     /**
-     * @return bool
+     *Rewind
+     *
+     * @return void
      */
-    public function valid()
+    public function rewind()
     {
-        return current($this->properties) !== false;
+        reset($this->paths);
     }
 
     /**
+     * Current
+     *
      * @return string
      */
-    public function key()
+    public function current()
     {
-        return key($this->properties);
+        return file_get_contents($this->basePath . $this->key());
     }
 
     /**
-     * @return string
+     * Key
+     *
+     * @return mixed
      */
-    public function current()
+    public function key()
     {
-        return current($this->properties);
+        return current($this->paths);
     }
 
     /**
+     * Next
+     *
      * @return void
      */
     public function next()
     {
-        next($this->properties);
+        next($this->paths);
     }
 
     /**
-     * @param string $var
-     * @return null|string
+     * Valid
+     *
+     * @return bool
      */
-    public function __get($var)
+    public function valid()
     {
-        if (isset($this->properties[$var])) {
-            return $this->properties[$var];
-        }
-        return null;
+        return (bool) $this->key();
     }
 
     /**
-     * @param string $var
-     * @param null|string $value
-     * @return void
+     * Convert to an array
+     *
+     * @return array
      */
-    public function __set($var, $value)
+    public function toArray()
     {
-        if (is_string($value)) {
-            $value = trim($value);
-        }
-        if (isset($this->properties[$var])) {
-            if ($value === null) {
-                $value = '';
-            }
-            $this->properties[$var] = $value;
+        $result = array();
+        foreach ($this as $item) {
+            $result[$this->key()] = $item;
         }
+        return $result;
     }
 
     /**
-     * @return array
+     * Count
+     *
+     * @return int
      */
-    public function toArray()
+    public function count()
     {
-        return $this->properties;
+        return count($this->paths);
     }
 }
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Grid.php b/setup/module/Magento/Config/src/FileIteratorFactory.php
similarity index 76%
rename from app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Grid.php
rename to setup/module/Magento/Config/src/FileIteratorFactory.php
index b5f71cee5308b23eed8471a43f9e1ba0ba02557a..f41f08030c1c5f88ce5a7f4c1908b927b1bf1a61 100644
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Grid.php
+++ b/setup/module/Magento/Config/src/FileIteratorFactory.php
@@ -1,6 +1,5 @@
 <?php
 /**
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -22,18 +21,20 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
 
-class Grid extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
+namespace Magento\Config;
+
+class FileIteratorFactory
 {
     /**
-     * Grid for loading packages
+     * Create file iterator
      *
-     * @return void
+     * @param string $basePath
+     * @param array $paths
+     * @return FileIterator
      */
-    public function execute()
+    public function create($basePath, $paths)
     {
-        $this->_view->loadLayout();
-        $this->_view->renderLayout();
+        return new FileIterator($basePath, $paths);
     }
 }
diff --git a/setup/module/Magento/Config/src/FileResolverInterface.php b/setup/module/Magento/Config/src/FileResolverInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..92aa74abab62a5370e3c552e89d959e9e40148d0
--- /dev/null
+++ b/setup/module/Magento/Config/src/FileResolverInterface.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Config;
+
+interface FileResolverInterface
+{
+    /**
+     * Retrieve the list of configuration files with given name
+     *
+     * @param string $filename
+     * @return array
+     */
+    public function get($filename);
+}
diff --git a/setup/module/Magento/Config/src/GlobWrapper.php b/setup/module/Magento/Config/src/GlobWrapper.php
new file mode 100644
index 0000000000000000000000000000000000000000..5b3dffdfa2c621b4768ca4ece8d750f97df913c2
--- /dev/null
+++ b/setup/module/Magento/Config/src/GlobWrapper.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Config;
+
+/**
+ * @codeCoverageIgnore
+ */
+class GlobWrapper
+{
+    /**
+     * Find pathnames matching a pattern
+     *
+     * @param string $path
+     * @param int $flag
+     * @return array
+     */
+    public function glob($path, $flag = 0)
+    {
+        return glob($path, $flag);
+    }
+}
diff --git a/setup/module/Magento/Config/src/Reader/Filesystem.php b/setup/module/Magento/Config/src/Reader/Filesystem.php
new file mode 100644
index 0000000000000000000000000000000000000000..e6f094a8f2b6c7a95a9e2017f6f8627afb0cc6f0
--- /dev/null
+++ b/setup/module/Magento/Config/src/Reader/Filesystem.php
@@ -0,0 +1,170 @@
+<?php
+/**
+ * Filesystem configuration loader. Loads configuration from XML files
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ *
+ */
+
+namespace Magento\Config\Reader;
+
+use Magento\Config\FileResolverInterface;
+use Magento\Config\Converter\ConverterInterface;
+use Magento\Config\SchemaLocatorInterface;
+
+class Filesystem implements ReaderInterface
+{
+    /**
+     * File locator
+     *
+     * @var \Magento\Config\FileResolverInterface
+     */
+    protected $fileResolver;
+
+    /**
+     * Config converter
+     *
+     * @var \Magento\Config\Converter\ConverterInterface
+     */
+    protected $converter;
+
+    /**
+     * Path to corresponding XSD file with validation rules
+     *
+     * @var string
+     */
+    protected $schemaFile;
+
+    /**
+     * The name of file that stores configuration
+     *
+     * @var string
+     */
+    protected $fileName;
+
+    /**
+     * Class of dom configuration document used for merge
+     *
+     * @var string
+     */
+    protected $domDocumentClass;
+
+    /**
+     * List of id attributes for merge
+     *
+     * @var array
+     */
+    protected $idAttributes = array();
+
+    /**
+     * @param FileResolverInterface $fileResolver
+     * @param ConverterInterface $converter
+     * @param SchemaLocatorInterface $schemaLocator
+     * @param string $fileName
+     * @param string $domDocumentClass
+     * @param array $idAttributes
+     */
+    public function __construct(
+        FileResolverInterface $fileResolver,
+        ConverterInterface $converter,
+        SchemaLocatorInterface $schemaLocator,
+        $fileName,
+        $domDocumentClass = 'Magento\Config\Dom',
+        $idAttributes = array()
+    ) {
+        $this->fileResolver = $fileResolver;
+        $this->converter = $converter;
+        $this->fileName = $fileName;
+        $this->idAttributes = array_replace($this->idAttributes, $idAttributes);
+        $this->schemaFile = $schemaLocator->getSchema();
+        $this->domDocumentClass = $domDocumentClass;
+    }
+
+    /**
+     * Load configuration
+     *
+     * @return array
+     */
+    public function read()
+    {
+        $fileList = $this->fileResolver->get($this->fileName);
+        if (!count($fileList)) {
+            return array();
+        }
+        return $this->readFiles($fileList);
+    }
+
+    /**
+     * Read configuration files
+     *
+     * @param array $fileList
+     * @return array
+     * @throws \Exception
+     */
+    protected function readFiles($fileList)
+    {
+        /** @var \Magento\Config\Dom $configMerger */
+        $configMerger = null;
+        foreach ($fileList as $key => $content) {
+            try {
+                if (!$configMerger) {
+                    $configMerger = $this->createConfigMerger($this->domDocumentClass, $content);
+                } else {
+                    $configMerger->merge($content);
+                }
+            } catch (\Magento\Config\Dom\ValidationException $e) {
+                throw new \Exception("Invalid XML in file " . $key . ":\n" . $e->getMessage());
+            }
+        }
+
+        $errors = array();
+        if ($configMerger && !$configMerger->validate($this->schemaFile, $errors)) {
+            $message = "Invalid Document \n";
+            throw new \Exception($message . implode("\n", $errors));
+        }
+
+        $output = array();
+        if ($configMerger) {
+            $output = $this->converter->convert($configMerger->getDom());
+        }
+        return $output;
+    }
+
+    /**
+     * Return newly created instance of a config merger
+     *
+     * @param string $mergerClass
+     * @param string $initialContents
+     * @return \Magento\Config\Dom
+     * @throws \UnexpectedValueException
+     */
+    protected function createConfigMerger($mergerClass, $initialContents)
+    {
+        $result = new $mergerClass($initialContents, $this->idAttributes, null, $this->schemaFile);
+        if (!$result instanceof \Magento\Config\Dom) {
+            throw new \UnexpectedValueException(
+                "Instance of the DOM config merger is expected, got {$mergerClass} instead."
+            );
+        }
+        return $result;
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Exception.php b/setup/module/Magento/Config/src/Reader/ReaderInterface.php
similarity index 68%
rename from downloader/lib/Magento/Framework/Exception.php
rename to setup/module/Magento/Config/src/Reader/ReaderInterface.php
index 21fc68f5af38efb62209c2194917aeac75640e16..4abcabd1f10cb1a14d4e2fcf733f4623d8272600 100644
--- a/downloader/lib/Magento/Framework/Exception.php
+++ b/setup/module/Magento/Config/src/Reader/ReaderInterface.php
@@ -17,18 +17,19 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ * 
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/**
- * Class for \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework;
+namespace Magento\Config\Reader;
 
-class Exception extends \Exception
+interface ReaderInterface
 {
+    /**
+     * Read configuration scope
+     *
+     * @return array
+     */
+    public function read();
 }
diff --git a/setup/module/Magento/Config/src/Resolver.php b/setup/module/Magento/Config/src/Resolver.php
new file mode 100644
index 0000000000000000000000000000000000000000..66ded08ff0d1998836daebba160c178fde03ba6f
--- /dev/null
+++ b/setup/module/Magento/Config/src/Resolver.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Config;
+
+
+interface Resolver
+{
+    public function get();
+} 
\ No newline at end of file
diff --git a/setup/module/Magento/Config/src/Resolver/ByPattern.php b/setup/module/Magento/Config/src/Resolver/ByPattern.php
new file mode 100644
index 0000000000000000000000000000000000000000..5b7a8c5bd023885761874e8eeb7087979c44f0c9
--- /dev/null
+++ b/setup/module/Magento/Config/src/Resolver/ByPattern.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Config\Resolver;
+
+use Magento\Config\GlobWrapper;
+use Magento\Config\Resolver;
+
+class ByPattern implements Resolver
+{
+    /**
+     * @var string
+     */
+    protected $pattern;
+
+    /**
+     * @var string
+     */
+    protected $path;
+
+    /**
+     * @var \Magento\Config\GlobWrapper
+     */
+    protected $glob;
+
+    /**
+     * @param GlobWrapper $glob
+     * @param string $path
+     * @param string $pattern
+     */
+    public function __construct(
+        GlobWrapper $glob,
+        $path,
+        $pattern
+    ) {
+        $this->glob = $glob;
+        $this->path = $path;
+        $this->pattern = $pattern;
+    }
+
+    /**
+     * @return array
+     */
+    public function get()
+    {
+        return $this->glob->glob($this->path . $this->pattern);
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Backup/Exception/CantLoadSnapshot.php b/setup/module/Magento/Config/src/SchemaLocatorInterface.php
similarity index 80%
rename from downloader/lib/Magento/Framework/Backup/Exception/CantLoadSnapshot.php
rename to setup/module/Magento/Config/src/SchemaLocatorInterface.php
index 307af03008dc1a7752d20891c81c065383beea4a..7de1693d00964708d0e03ceec4298e8410d69cf8 100644
--- a/downloader/lib/Magento/Framework/Backup/Exception/CantLoadSnapshot.php
+++ b/setup/module/Magento/Config/src/SchemaLocatorInterface.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Configuration validation schema locator
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -22,13 +24,14 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/**
- * \Exception
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Backup\Exception;
+namespace Magento\Config;
 
-class CantLoadSnapshot extends \Magento\Framework\Backup\BackupException
+interface SchemaLocatorInterface
 {
+    /**
+     * Get path to merged config schema
+     *
+     * @return string|null
+     */
+    public function getSchema();
 }
diff --git a/downloader/lib/Magento/Framework/Connect/Channel/Parser.php b/setup/module/Magento/Config/src/Sorter.php
similarity index 92%
rename from downloader/lib/Magento/Framework/Connect/Channel/Parser.php
rename to setup/module/Magento/Config/src/Sorter.php
index 9b677ee90e22c725589114cff590cc230194f6cf..14369b28a4e5dd3baf0b81ddfe8650c407820aba 100644
--- a/downloader/lib/Magento/Framework/Connect/Channel/Parser.php
+++ b/setup/module/Magento/Config/src/Sorter.php
@@ -21,3 +21,9 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Config;
+
+interface Sorter
+{
+    public function sort();
+}
diff --git a/setup/module/Magento/Config/tests/Resolver/ByPatternTest.php b/setup/module/Magento/Config/tests/Resolver/ByPatternTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..c44c10a73a6d0eeab272d4159fca4f770ce3ba33
--- /dev/null
+++ b/setup/module/Magento/Config/tests/Resolver/ByPatternTest.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Config\Resolver;
+
+class ByPatternTest extends \PHPUnit_Framework_TestCase
+{
+    public function testGet()
+    {
+        $path = 'app/code/';
+        $pattern = '*/*/module.xml';
+        $globResult = array('/home/user/webroot/app/code/Magento/Core/module.xml');
+
+        $glob = $this->getMockBuilder('Magento\Config\GlobWrapper')->getMock();
+        $glob->expects($this->once())
+            ->method('glob')
+            ->with($path . $pattern)
+            ->will($this->returnValue($globResult));
+
+        /** @var \Magento\Config\GlobWrapper $glob */
+        $resolver = new ByPattern($glob, $path, $pattern);
+        $this->assertEquals($globResult, $resolver->get());
+    }
+}
diff --git a/setup/module/Magento/Filesystem/Module.php b/setup/module/Magento/Filesystem/Module.php
new file mode 100644
index 0000000000000000000000000000000000000000..73ca3871e4725b854e0a6c265d3e7075db1348b2
--- /dev/null
+++ b/setup/module/Magento/Filesystem/Module.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Filesystem;
+
+use Zend\ModuleManager\Feature\ConfigProviderInterface;
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+
+class Module implements
+    ConfigProviderInterface,
+    AutoloaderProviderInterface
+{
+    /**
+     * @return array|mixed|\Traversable
+     */
+    public function getConfig()
+    {
+        return array_merge(
+            include __DIR__ . '/config/di.config.php'
+        );
+    }
+
+    /**
+     * @return array
+     */
+    public function getAutoloaderConfig()
+    {
+        return [
+            'Zend\Loader\StandardAutoloader' => [
+                'namespaces' => [
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ],
+            ],
+        ];
+    }
+}
diff --git a/setup/module/Magento/Filesystem/config/di.config.php b/setup/module/Magento/Filesystem/config/di.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..f41fd100237d4f20876f676618bfa345d1f221fc
--- /dev/null
+++ b/setup/module/Magento/Filesystem/config/di.config.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'di' => [
+        'instance' => [
+            'preference' => [
+                'Magento\Filesystem\Driver\DriverInterface' => 'Magento\Filesystem\Driver\File',
+            ],
+        ],
+    ],
+];
diff --git a/setup/module/Magento/Filesystem/src/Directory/Read.php b/setup/module/Magento/Filesystem/src/Directory/Read.php
new file mode 100644
index 0000000000000000000000000000000000000000..84cd7a198b4482af2abc68f539f3cf83f3011880
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Directory/Read.php
@@ -0,0 +1,138 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem\Directory;
+
+use Magento\Filesystem\Driver\DriverInterface;
+use Magento\Filesystem\FilesystemException;
+
+class Read implements ReadInterface
+{
+    /**
+     * Directory path
+     *
+     * @var string
+     */
+    protected $path;
+
+    /**
+     * Filesystem driver
+     *
+     * @var \Magento\Filesystem\Driver\DriverInterface
+     */
+    protected $driver;
+
+    /**
+     * @param DriverInterface $driver
+     * @param array $config
+     */
+    public function __construct(
+        DriverInterface $driver,
+        array $config
+    ) {
+        $this->driver = $driver;
+        $this->setProperties($config);
+    }
+
+    /**
+     * Set properties from config
+     *
+     * @param array $config
+     * @return void
+     * @throws FilesystemException
+     */
+    protected function setProperties(array $config)
+    {
+        if (!empty($config['path'])) {
+            $this->path = rtrim(str_replace('\\', '/', $config['path']), '/') . '/';
+        }
+    }
+
+    /**
+     * Retrieves absolute path
+     * E.g.: /var/www/application/file.txt
+     *
+     * @param string $path
+     * @return string
+     */
+    public function getAbsolutePath($path = null)
+    {
+        return $this->driver->getAbsolutePath($this->path, $path);
+    }
+
+    /**
+     * Check a file or directory exists
+     *
+     * @param string $path [optional]
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isExist($path = null)
+    {
+        return $this->driver->isExists($this->driver->getAbsolutePath($this->path, $path));
+    }
+
+    /**
+     * Check permissions for reading file or directory
+     *
+     * @param string $path
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isReadable($path = null)
+    {
+        return $this->driver->isReadable($this->driver->getAbsolutePath($this->path, $path));
+    }
+
+    /**
+     * Check whether given path is directory
+     *
+     * @param string $path
+     * @return bool
+     */
+    public function isDirectory($path = null)
+    {
+        return $this->driver->isDirectory($this->driver->getAbsolutePath($this->path, $path));
+    }
+
+    /**
+     * Retrieve file contents from given path
+     *
+     * @param string $path
+     * @param string|null $flag
+     * @param resource|null $context
+     * @return string
+     * @throws FilesystemException
+     */
+    public function readFile($path, $flag = null, $context = null)
+    {
+        clearstatcache();
+        $result = @file_get_contents($this->getAbsolutePath($path), $flag, $context);
+        if (false === $result) {
+            throw new FilesystemException(
+                sprintf('Cannot read contents from file "%s"', $path)
+            );
+        }
+        return $result;
+    }
+}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Loadtab.php b/setup/module/Magento/Filesystem/src/Directory/ReadFactory.php
similarity index 75%
rename from app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Loadtab.php
rename to setup/module/Magento/Filesystem/src/Directory/ReadFactory.php
index e6fcb3b1dc18f3da3e430a555b26bc057bd8a441..638c4ddd641c80371c69b53b9bf6a9e1f8510239 100644
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Loadtab.php
+++ b/setup/module/Magento/Filesystem/src/Directory/ReadFactory.php
@@ -1,6 +1,5 @@
 <?php
 /**
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -22,18 +21,20 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
+namespace Magento\Filesystem\Directory;
+
+use Magento\Filesystem\Driver\File;
 
-class Loadtab extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
+class ReadFactory
 {
     /**
-     * Load Grid with Local Packages
+     * Create a readable directory
      *
-     * @return void
+     * @param array $config
+     * @return ReadInterface
      */
-    public function execute()
+    public function create(array $config)
     {
-        $this->_view->loadLayout();
-        $this->_view->renderLayout();
+        return new Read(new File(), $config);
     }
 }
diff --git a/setup/module/Magento/Filesystem/src/Directory/ReadInterface.php b/setup/module/Magento/Filesystem/src/Directory/ReadInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..9aad45fe513e80d5ef1a58bdc28013d7bb81f8bc
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Directory/ReadInterface.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem\Directory;
+
+interface ReadInterface
+{
+    /**
+     * Get absolute path
+     *
+     * @param string $path [optional]
+     * @return string
+     */
+    public function getAbsolutePath($path = null);
+
+    /**
+     * Check a file or directory exists
+     *
+     * @param string $path [optional]
+     * @return bool
+     */
+    public function isExist($path = null);
+
+    /**
+     * Check permissions for reading file or directory
+     *
+     * @param string $path
+     * @return bool
+     */
+    public function isReadable($path = null);
+
+    /**
+     * Check whether given path is directory
+     *
+     * @param string $path
+     * @return bool
+     */
+    public function isDirectory($path = null);
+
+    /**
+     * Retrieve file contents from given path
+     *
+     * @param string $path
+     * @param string|null $flag
+     * @param resource|null $context
+     * @return string
+     */
+    public function readFile($path, $flag = null, $context = null);
+}
diff --git a/setup/module/Magento/Filesystem/src/Directory/Write.php b/setup/module/Magento/Filesystem/src/Directory/Write.php
new file mode 100644
index 0000000000000000000000000000000000000000..593a128f789c81e812fd0af56bf006a0d1dc13a7
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Directory/Write.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem\Directory;
+
+use Magento\Filesystem\FilesystemException;
+
+class Write extends Read implements WriteInterface
+{
+    /**
+     * Check if given path is writable
+     *
+     * @param null $path
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isWritable($path = null)
+    {
+        return $this->driver->isWritable($this->driver->getAbsolutePath($this->path, $path));
+    }
+
+    /**
+     * Change permissions of given path
+     *
+     * @param string $path
+     * @param int $permissions
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function changePermissions($path, $permissions)
+    {
+        $absolutePath = $this->driver->getAbsolutePath($this->path, $path);
+        return $this->driver->changePermissions($absolutePath, $permissions);
+    }
+
+    /**
+     * Write contents to file in given mode
+     *
+     * @param string $path
+     * @param string $content
+     * @param string|null $mode
+     * @return int The number of bytes that were written.
+     * @throws FilesystemException
+     */
+    public function writeFile($path, $content, $mode = 'w+')
+    {
+        $result = @file_put_contents($this->getAbsolutePath($path), $content, $mode);
+        if (!$result) {
+            throw new FilesystemException(
+                sprintf('The specified "%s" file could not be written', $this->getAbsolutePath($path))
+            );
+        }
+        return $result;
+    }
+}
diff --git a/setup/module/Magento/Filesystem/src/Directory/WriteFactory.php b/setup/module/Magento/Filesystem/src/Directory/WriteFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..63bca606476d043b8625ae6a702ec556588322ed
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Directory/WriteFactory.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem\Directory;
+
+use Magento\Filesystem\Driver\File;
+
+class WriteFactory
+{
+    /**
+     * @param array $config
+     * @return \Magento\Filesystem\Directory\Write
+     */
+    public function create(array $config)
+    {
+        return new Write(new File(), $config);
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/AbstractRollback.php b/setup/module/Magento/Filesystem/src/Directory/WriteInterface.php
similarity index 58%
rename from downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/AbstractRollback.php
rename to setup/module/Magento/Filesystem/src/Directory/WriteInterface.php
index 488879bde964e7402aedf2908f914571e6c03ab6..e952d2d35b8dbbe6b5d560eed71c69d1e783eee9 100644
--- a/downloader/lib/Magento/Framework/Backup/Filesystem/Rollback/AbstractRollback.php
+++ b/setup/module/Magento/Filesystem/src/Directory/WriteInterface.php
@@ -21,36 +21,35 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Backup\Filesystem\Rollback;
+namespace Magento\Filesystem\Directory;
 
-/**
- * Filesystem rollback workers abstract class
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-abstract class AbstractRollback
+interface WriteInterface extends ReadInterface
 {
     /**
-     * Snapshot object
+     * Check if given path is writable
      *
-     * @var \Magento\Framework\Backup\Filesystem
+     * @param string $path [optional]
+     * @return bool
      */
-    protected $_snapshot;
+    public function isWritable($path = null);
 
     /**
-     * Default worker constructor
+     * Change permissions of given path
      *
-     * @param \Magento\Framework\Backup\Filesystem $snapshotObject
+     * @param string $path
+     * @param int $permissions
+     * @return bool
+     * @throws \Magento\Filesystem\FilesystemException
      */
-    public function __construct(\Magento\Framework\Backup\Filesystem $snapshotObject)
-    {
-        $this->_snapshot = $snapshotObject;
-    }
+    public function changePermissions($path, $permissions);
 
     /**
-     * Main worker's function that makes files rollback
+     * Write contents to file in given mode
      *
-     * @return void
+     * @param string $path
+     * @param string $content
+     * @param string|null $mode
+     * @return int The number of bytes that were written.
      */
-    abstract public function run();
+    public function writeFile($path, $content, $mode = 'w+');
 }
diff --git a/setup/module/Magento/Filesystem/src/DirectoryList.php b/setup/module/Magento/Filesystem/src/DirectoryList.php
new file mode 100644
index 0000000000000000000000000000000000000000..fec504358fc74175d50aeaf261b157db8f77de09
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/DirectoryList.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * Application file system directories dictionary
+ *
+ * Provides information about what directories are available in the application
+ * Serves as customizaiton point to specify different directories or add own
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem;
+
+use Magento\Config\ConfigFactory;
+
+class DirectoryList
+{
+    /**
+     * @var ConfigFactory
+     */
+    protected $configFactory;
+
+    /**
+     * @var \Magento\Config\Config
+     */
+    protected $config;
+
+    /**
+     * @var string
+     */
+    protected $root;
+
+    /**
+     * @param ConfigFactory $configFactory
+     */
+    public function __construct(ConfigFactory $configFactory)
+    {
+        $this->configFactory = $configFactory;
+        $this->config = $this->configFactory->create();
+
+        $this->root = str_replace('\\', '/', $this->config->getMagentoBasePath());
+
+        foreach ($this->config->getMagentoFilePermissions() as $code => $config) {
+            if (!$this->isAbsolute($config['path'])) {
+                $this->directories[$code]['path'] = $this->makeAbsolute($config['path']);
+            }
+        }
+    }
+
+    /**
+     * Add root dir for relative path
+     *
+     * @param string $path
+     * @return string
+     */
+    protected function makeAbsolute($path)
+    {
+        if ($path === null) {
+            $result = '';
+        } else {
+            $result = $this->root;
+            if (!empty($path)) {
+                $result .= '/' . $path;
+            }
+        }
+        return $result;
+    }
+
+    /**
+     * Verify if path is absolute
+     *
+     * @param string $path
+     * @return bool
+     */
+    protected function isAbsolute($path)
+    {
+        $path = strtr($path, '\\', '/');
+        $isUnixRoot = strpos($path, '/') === 0;
+        $isWindowsRoot = preg_match('#^\w{1}:/#', $path);
+        $isWindowsLetter = parse_url($path, PHP_URL_SCHEME) !== null;
+
+        return $isUnixRoot || $isWindowsRoot || $isWindowsLetter;
+    }
+
+    /**
+     * Get configuration for directory code
+     *
+     * @param string $code
+     * @return array
+     * @throws FilesystemException
+     */
+    public function getConfig($code)
+    {
+        if (!isset($this->directories[$code])) {
+            throw new FilesystemException(
+                sprintf('The "%s" directory is not specified in configuration', $code)
+            );
+        }
+        return $this->directories[$code];
+    }
+}
diff --git a/setup/module/Magento/Filesystem/src/Driver/DriverInterface.php b/setup/module/Magento/Filesystem/src/Driver/DriverInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..6844896369617219bda4218f676cb7bb862dcff2
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Driver/DriverInterface.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Interface of Magento filesystem driver
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem\Driver;
+
+/**
+ * Class Driver
+ */
+interface DriverInterface
+{
+    /**
+     * @param string $path
+     * @return bool
+     * @throws \Magento\Filesystem\FilesystemException
+     */
+    public function isExists($path);
+
+    /**
+     * Check permissions for reading file or directory
+     *
+     * @param string $path
+     * @return bool
+     * @throws \Magento\Filesystem\FilesystemException
+     */
+    public function isReadable($path);
+
+    /**
+     * Tells whether the filename is a regular directory
+     *
+     * @param string $path
+     * @return bool
+     * @throws \Magento\Filesystem\FilesystemException
+     */
+    public function isDirectory($path);
+
+    /**
+     * Check if given path is writable
+     *
+     * @param string $path
+     * @return bool
+     * @throws \Magento\Filesystem\FilesystemException
+     */
+    public function isWritable($path);
+
+    /**
+     * @param string $basePath
+     * @param string $path
+     * @return mixed
+     */
+    public function getAbsolutePath($basePath, $path);
+
+    /**
+     * Change permissions of given path
+     *
+     * @param string $path
+     * @param int $permissions
+     * @return bool
+     */
+    public function changePermissions($path, $permissions);
+}
diff --git a/setup/module/Magento/Filesystem/src/Driver/File.php b/setup/module/Magento/Filesystem/src/Driver/File.php
new file mode 100644
index 0000000000000000000000000000000000000000..0221aa567c339cdc4df93e0ddfaf45b159090e55
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Driver/File.php
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Origin filesystem driver
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem\Driver;
+
+use Magento\Filesystem\FilesystemException;
+
+class File implements DriverInterface
+{
+    /**
+     * Returns last warning message string
+     *
+     * @return string
+     */
+    protected function getWarningMessage()
+    {
+        $warning = error_get_last();
+        if ($warning && $warning['type'] == E_WARNING) {
+            return 'Warning!' . $warning['message'];
+        }
+        return null;
+    }
+
+    /**
+     * Is file or directory exist in file system
+     *
+     * @param string $path
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isExists($path)
+    {
+        clearstatcache();
+        $result = @file_exists($path);
+        if ($result === null) {
+            throw new FilesystemException(
+                sprintf('Error occurred during execution %s', $this->getWarningMessage())
+            );
+        }
+        return $result;
+    }
+
+    /**
+     * Check permissions for reading file or directory
+     *
+     * @param string $path
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isReadable($path)
+    {
+        clearstatcache();
+        $result = @is_readable($path);
+        if ($result === null) {
+            throw new FilesystemException(
+                sprintf('Error occurred during execution %s', $this->getWarningMessage())
+            );
+        }
+        return $result;
+    }
+
+    /**
+     * Tells whether the filename is a regular directory
+     *
+     * @param string $path
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isDirectory($path)
+    {
+        clearstatcache();
+        $result = @is_dir($path);
+        if ($result === null) {
+            throw new FilesystemException(
+                sprintf('Error occurred during execution %s', $this->getWarningMessage())
+            );
+        }
+        return $result;
+    }
+
+    /**
+     * Check if given path is writable
+     *
+     * @param string $path
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function isWritable($path)
+    {
+        clearstatcache();
+        $result = @is_writable($path);
+        if ($result === null) {
+            throw new FilesystemException(
+                sprintf('Error occurred during execution %s', $this->getWarningMessage())
+            );
+        }
+        return $result;
+    }
+
+    /**
+     * @param string $basePath
+     * @param string $path
+     * @return string
+     */
+    public function getAbsolutePath($basePath, $path)
+    {
+        return $basePath . ltrim($this->fixSeparator($path), '/');
+    }
+
+    /**
+     * Fixes path separator
+     * Utility method.
+     *
+     * @param string $path
+     * @return string
+     */
+    protected function fixSeparator($path)
+    {
+        return str_replace('\\', '/', $path);
+    }
+
+    /**
+     * Change permissions of given path
+     *
+     * @param string $path
+     * @param int $permissions
+     * @return bool
+     * @throws FilesystemException
+     */
+    public function changePermissions($path, $permissions)
+    {
+        $result = @chmod($path, $permissions);
+        if (!$result) {
+            throw new FilesystemException(
+                sprintf('Cannot change permissions for path "%s" %s', $path, $this->getWarningMessage())
+            );
+        }
+        return $result;
+    }
+}
diff --git a/setup/module/Magento/Filesystem/src/Filesystem.php b/setup/module/Magento/Filesystem/src/Filesystem.php
new file mode 100644
index 0000000000000000000000000000000000000000..3d4b51c0e1acfc8ac3c9224215d132bdc098494d
--- /dev/null
+++ b/setup/module/Magento/Filesystem/src/Filesystem.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Magento filesystem facade
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Filesystem;
+
+use Magento\Filesystem\Directory\ReadFactory;
+use Magento\Filesystem\Directory\ReadInterface;
+use Magento\Filesystem\Directory\WriteFactory;
+use Magento\Filesystem\Directory\WriteInterface;
+
+class Filesystem
+{
+    /**
+     * @var DirectoryList
+     */
+    protected $directoryList;
+
+    /**
+     * @var ReadFactory
+     */
+    protected $readFactory;
+
+    /**
+     * @var WriteFactory
+     */
+    protected $writeFactory;
+
+    /**
+     * @var ReadInterface[]
+     */
+    protected $readInstances = array();
+
+    /**
+     * @var WriteInterface[]
+     */
+    protected $writeInstances = array();
+
+    /**
+     * @param DirectoryList $directoryList
+     * @param ReadFactory $readFactory
+     * @param WriteFactory $writeFactory
+     */
+    public function __construct(
+        DirectoryList $directoryList,
+        ReadFactory $readFactory,
+        WriteFactory $writeFactory
+    ) {
+        $this->directoryList = $directoryList;
+        $this->readFactory = $readFactory;
+        $this->writeFactory = $writeFactory;
+    }
+
+    /**
+     * Create an instance of directory with write permissions
+     *
+     * @param string $code
+     * @return ReadInterface
+     */
+    public function getDirectoryRead($code)
+    {
+        if (!array_key_exists($code, $this->readInstances)) {
+            $config = $this->directoryList->getConfig($code);
+            $this->readInstances[$code] = $this->readFactory->create($config);
+        }
+        return $this->readInstances[$code];
+    }
+
+    /**
+     * Create an instance of directory with read permissions
+     *
+     * @param string $code
+     * @return WriteInterface
+     * @throws \Magento\Filesystem\FilesystemException
+     */
+    public function getDirectoryWrite($code)
+    {
+        if (!array_key_exists($code, $this->writeInstances)) {
+            $config = $this->directoryList->getConfig($code);
+            $this->writeInstances[$code] = $this->writeFactory->create($config);
+        }
+        return $this->writeInstances[$code];
+    }
+}
diff --git a/downloader/app/Magento/Downloader/Model/Downloader.php b/setup/module/Magento/Filesystem/src/FilesystemException.php
similarity index 89%
rename from downloader/app/Magento/Downloader/Model/Downloader.php
rename to setup/module/Magento/Filesystem/src/FilesystemException.php
index e829855a91ba497da6fc0c7e8a95d169ed8ed306..4dff3de719c7313135ae8de47187801e1e6e99cc 100644
--- a/downloader/app/Magento/Downloader/Model/Downloader.php
+++ b/setup/module/Magento/Filesystem/src/FilesystemException.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Magento filesystem exception
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -21,8 +23,8 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Downloader\Model;
+namespace Magento\Filesystem;
 
-class Downloader extends \Magento\Downloader\Model
+class FilesystemException extends \Exception
 {
 }
diff --git a/downloader/lib/Magento/Framework/Util.php b/setup/module/Magento/Framework/Module.php
similarity index 59%
rename from downloader/lib/Magento/Framework/Util.php
rename to setup/module/Magento/Framework/Module.php
index e66cdf0f6efe6116a4b99da09ce320adf97493d5..02f1a9d76d9ac15d92aa687062acdd9dfd025029 100644
--- a/downloader/lib/Magento/Framework/Util.php
+++ b/setup/module/Magento/Framework/Module.php
@@ -1,7 +1,5 @@
 <?php
 /**
- * Collection of various useful functions
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -20,20 +18,27 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
 namespace Magento\Framework;
 
-class Util
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+
+class Module implements AutoloaderProviderInterface
 {
     /**
-     * Return PHP version without optional suffix
-     * Scheme: major.minor.release
-     * @return string
+     * @return array
      */
-    public function getTrimmedPhpVersion()
+    public function getAutoloaderConfig()
     {
-        return implode('.', array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION));
+        return [
+            'Zend\Loader\StandardAutoloader' => [
+                'namespaces' => [
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ],
+            ],
+        ];
     }
 }
diff --git a/setup/module/Magento/Framework/src/DB/Adapter/AdapterInterface.php b/setup/module/Magento/Framework/src/DB/Adapter/AdapterInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..79c39edf1406cdec2c1bca3ea9f2f0ca6e0cc27b
--- /dev/null
+++ b/setup/module/Magento/Framework/src/DB/Adapter/AdapterInterface.php
@@ -0,0 +1,642 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Framework\DB\Adapter;
+
+use Magento\Framework\DB\Ddl\Table;
+
+/**
+ * Magento Database Adapter Interface
+ *
+ * @author      Magento Core Team <core@magentocommerce.com>
+ */
+interface AdapterInterface extends \Zend\Db\Adapter\AdapterInterface
+{
+    const INDEX_TYPE_PRIMARY = 'primary';
+
+    const INDEX_TYPE_UNIQUE = 'unique';
+
+    const INDEX_TYPE_INDEX = 'index';
+
+    const INDEX_TYPE_FULLTEXT = 'fulltext';
+
+    const FK_ACTION_CASCADE = 'CASCADE';
+
+    const FK_ACTION_SET_NULL = 'SET NULL';
+
+    const FK_ACTION_NO_ACTION = 'NO ACTION';
+
+    const FK_ACTION_RESTRICT = 'RESTRICT';
+
+    const FK_ACTION_SET_DEFAULT = 'SET DEFAULT';
+
+    const INSERT_ON_DUPLICATE = 1;
+
+    const INSERT_IGNORE = 2;
+
+    const ISO_DATE_FORMAT = 'yyyy-MM-dd';
+
+    const ISO_DATETIME_FORMAT = 'yyyy-MM-dd HH-mm-ss';
+
+    const INTERVAL_SECOND = 'SECOND';
+
+    const INTERVAL_MINUTE = 'MINUTES';
+
+    const INTERVAL_HOUR = 'HOURS';
+
+    const INTERVAL_DAY = 'DAYS';
+
+    const INTERVAL_MONTH = 'MONTHS';
+
+    const INTERVAL_YEAR = 'YEARS';
+
+    /**
+     * Error message for DDL query in transactions
+     */
+    const ERROR_DDL_MESSAGE = 'DDL statements are not allowed in transactions';
+
+    /**
+     * Error message for unfinished rollBack transaction
+     */
+    const ERROR_ROLLBACK_INCOMPLETE_MESSAGE = 'Rolled back transaction has not been completed correctly.';
+
+    /**
+     * Error message for asymmetric transaction rollback
+     */
+    const ERROR_ASYMMETRIC_ROLLBACK_MESSAGE = 'Asymmetric transaction rollback.';
+
+    /**
+     * Error message for asymmetric transaction commit
+     */
+    const ERROR_ASYMMETRIC_COMMIT_MESSAGE = 'Asymmetric transaction commit.';
+
+    /**
+     * Begin new DB transaction for connection
+     *
+     * @return \Magento\Framework\DB\Adapter\Pdo\Mysql
+     */
+    public function beginTransaction();
+
+    /**
+     * Commit DB transaction
+     *
+     * @return \Magento\Framework\DB\Adapter\Pdo\Mysql
+     */
+    public function commit();
+
+    /**
+     * Roll-back DB transaction
+     *
+     * @return \Magento\Framework\DB\Adapter\Pdo\Mysql
+     */
+    public function rollBack();
+
+    /**
+     * Retrieve DDL object for new table
+     *
+     * @param string $tableName the table name
+     * @param string $schemaName the database or schema name
+     * @return Table
+     */
+    public function newTable($tableName = null, $schemaName = null);
+
+    /**
+     * Create table from DDL object
+     *
+     * @param Table $table
+     * @throws \Zend_Db_Exception
+     * @return \Zend_Db_Statement_Interface
+     */
+    public function createTable(Table $table);
+
+    /**
+     * Drop table from database
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return boolean
+     */
+    public function dropTable($tableName, $schemaName = null);
+
+    /**
+     * Rename several tables
+     *
+     * @param array $tablePairs array('oldName' => 'Name1', 'newName' => 'Name2')
+     *
+     * @return boolean
+     * @throws \Zend_Db_Exception
+     */
+    public function renameTablesBatch(array $tablePairs);
+
+    /**
+     * Truncate a table
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function truncateTable($tableName, $schemaName = null);
+
+    /**
+     * Checks if table exists
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return boolean
+     */
+    public function isTableExists($tableName, $schemaName = null);
+
+    /**
+     * Returns short table status array
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return array|false
+     */
+    public function showTableStatus($tableName, $schemaName = null);
+
+    /**
+     * Returns the column descriptions for a table.
+     *
+     * The return value is an associative array keyed by the column name,
+     * as returned by the RDBMS.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * SCHEMA_NAME      => string; name of database or schema
+     * TABLE_NAME       => string;
+     * COLUMN_NAME      => string; column name
+     * COLUMN_POSITION  => number; ordinal position of column in table
+     * DATA_TYPE        => string; SQL datatype name of column
+     * DEFAULT          => string; default expression of column, null if none
+     * NULLABLE         => boolean; true if column can have nulls
+     * LENGTH           => number; length of CHAR/VARCHAR
+     * SCALE            => number; scale of NUMERIC/DECIMAL
+     * PRECISION        => number; precision of NUMERIC/DECIMAL
+     * UNSIGNED         => boolean; unsigned property of an integer type
+     * PRIMARY          => boolean; true if column is part of the primary key
+     * PRIMARY_POSITION => integer; position of column in primary key
+     * IDENTITY         => integer; true if column is auto-generated with unique values
+     *
+     * @param string $tableName
+     * @param string $schemaName OPTIONAL
+     * @return array
+     */
+    public function describeTable($tableName, $schemaName = null);
+
+    /**
+     * Create \Magento\Framework\DB\Ddl\Table object by data from describe table
+     *
+     * @param string $tableName
+     * @param string $newTableName
+     * @return Table
+     */
+    public function createTableByDdl($tableName, $newTableName);
+
+    /**
+     * Modify the column definition by data from describe table
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param array|string $definition
+     * @param boolean $flushData
+     * @param string $schemaName
+     * @return \Magento\Framework\DB\Adapter\Pdo\Mysql
+     */
+    public function modifyColumnByDdl($tableName, $columnName, $definition, $flushData = false, $schemaName = null);
+
+    /**
+     * Rename table
+     *
+     * @param string $oldTableName
+     * @param string $newTableName
+     * @param string $schemaName
+     * @return boolean
+     */
+    public function renameTable($oldTableName, $newTableName, $schemaName = null);
+
+    /**
+     * Adds new column to the table.
+     *
+     * Generally $defintion must be array with column data to keep this call cross-DB compatible.
+     * Using string as $definition is allowed only for concrete DB adapter.
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param array|string $definition  string specific or universal array DB Server definition
+     * @param string $schemaName
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function addColumn($tableName, $columnName, $definition, $schemaName = null);
+
+    /**
+     * Change the column name and definition
+     *
+     * For change definition of column - use modifyColumn
+     *
+     * @param string $tableName
+     * @param string $oldColumnName
+     * @param string $newColumnName
+     * @param array|string $definition
+     * @param boolean $flushData        flush table statistic
+     * @param string $schemaName
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function changeColumn(
+        $tableName,
+        $oldColumnName,
+        $newColumnName,
+        $definition,
+        $flushData = false,
+        $schemaName = null
+    );
+
+    /**
+     * Modify the column definition
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param array|string $definition
+     * @param boolean $flushData
+     * @param string $schemaName
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function modifyColumn($tableName, $columnName, $definition, $flushData = false, $schemaName = null);
+
+    /**
+     * Drop the column from table
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $schemaName
+     * @return boolean
+     */
+    public function dropColumn($tableName, $columnName, $schemaName = null);
+
+    /**
+     * Check is table column exists
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $schemaName
+     * @return boolean
+     */
+    public function tableColumnExists($tableName, $columnName, $schemaName = null);
+
+    /**
+     * Add new index to table name
+     *
+     * @param string $tableName
+     * @param string $indexName
+     * @param string|array $fields  the table column name or array of ones
+     * @param string $indexType     the index type
+     * @param string $schemaName
+     * @return \Zend_Db_Statement_Interface
+     */
+    public function addIndex($tableName, $indexName, $fields, $indexType = self::INDEX_TYPE_INDEX, $schemaName = null);
+
+    /**
+     * Drop the index from table
+     *
+     * @param string $tableName
+     * @param string $keyName
+     * @param string $schemaName
+     * @return bool|\Zend_Db_Statement_Interface
+     */
+    public function dropIndex($tableName, $keyName, $schemaName = null);
+
+    /**
+     * Returns the table index information
+     *
+     * The return value is an associative array keyed by the UPPERCASE index key (except for primary key,
+     * that is always stored under 'PRIMARY' key) as returned by the RDBMS.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * SCHEMA_NAME      => string; name of database or schema
+     * TABLE_NAME       => string; name of the table
+     * KEY_NAME         => string; the original index name
+     * COLUMNS_LIST     => array; array of index column names
+     * INDEX_TYPE       => string; lowercase, create index type
+     * INDEX_METHOD     => string; index method using
+     * type             => string; see INDEX_TYPE
+     * fields           => array; see COLUMNS_LIST
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return array
+     */
+    public function getIndexList($tableName, $schemaName = null);
+
+    /**
+     * Add new Foreign Key to table
+     * If Foreign Key with same name is exist - it will be deleted
+     *
+     * @param string $fkName
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $refTableName
+     * @param string $refColumnName
+     * @param string $onDelete
+     * @param string $onUpdate
+     * @param boolean $purge trying remove invalid data
+     * @param string $schemaName
+     * @param string $refSchemaName
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     *
+     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
+     */
+    public function addForeignKey(
+        $fkName,
+        $tableName,
+        $columnName,
+        $refTableName,
+        $refColumnName,
+        $onDelete = self::FK_ACTION_CASCADE,
+        $onUpdate = self::FK_ACTION_CASCADE,
+        $purge = false,
+        $schemaName = null,
+        $refSchemaName = null
+    );
+
+    /**
+     * Drop the Foreign Key from table
+     *
+     * @param string $tableName
+     * @param string $fkName
+     * @param string $schemaName
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function dropForeignKey($tableName, $fkName, $schemaName = null);
+
+    /**
+     * Retrieve the foreign keys descriptions for a table.
+     *
+     * The return value is an associative array keyed by the UPPERCASE foreign key,
+     * as returned by the RDBMS.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * FK_NAME          => string; original foreign key name
+     * SCHEMA_NAME      => string; name of database or schema
+     * TABLE_NAME       => string;
+     * COLUMN_NAME      => string; column name
+     * REF_SCHEMA_NAME  => string; name of reference database or schema
+     * REF_TABLE_NAME   => string; reference table name
+     * REF_COLUMN_NAME  => string; reference column name
+     * ON_DELETE        => string; action type on delete row
+     * ON_UPDATE        => string; action type on update row
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return array
+     */
+    public function getForeignKeys($tableName, $schemaName = null);
+
+    /**
+     * Creates and returns a new \Magento\Framework\DB\Select object for this adapter.
+     *
+     * @return \Zend\Db\Sql\Select
+     */
+    public function select();
+
+    /**
+     * Inserts a table row with specified data.
+     *
+     * @param mixed $table The table to insert data into.
+     * @param array $bind Column-value pairs.
+     * @return int The number of affected rows.
+     */
+    public function insert($table, array $bind);
+
+    /**
+     * Inserts a table row with specified data
+     * Special for Zero values to identity column
+     *
+     * @param string $table
+     * @param array $bind
+     * @return int The number of affected rows.
+     */
+    public function insertForce($table, array $bind);
+
+    /**
+     * Updates table rows with specified data based on a WHERE clause.
+     *
+     * @param  mixed        $table The table to update.
+     * @param  array        $bind  Column-value pairs.
+     * @param  mixed        $where UPDATE WHERE clause(s).
+     * @return int          The number of affected rows.
+     */
+    public function update($table, array $bind, $where = '');
+
+    /**
+     * Deletes table rows based on a WHERE clause.
+     *
+     * @param  mixed        $table The table to update.
+     * @param  mixed        $where DELETE WHERE clause(s).
+     * @return int          The number of affected rows.
+     */
+    public function delete($table, $where = '');
+
+    /**
+     * Prepares and executes an SQL statement with bound data.
+     *
+     * @param  mixed  $sql  The SQL statement with placeholders.
+     * @param  mixed  $bind An array of data or data itself to bind to the placeholders.
+     * @return \Zend\Db\Adapter\Driver\StatementInterface
+     */
+    public function query($sql, $bind = array());
+
+    /**
+     * Safely quotes a value for an SQL statement.
+     *
+     * If an array is passed as the value, the array values are quoted
+     * and then returned as a comma-separated string.
+     *
+     * @param mixed $value The value to quote.
+     * @param mixed $type  OPTIONAL the SQL datatype name, or constant, or null.
+     * @return mixed An SQL-safe quoted value (or string of separated values).
+     */
+    public function quote($value, $type = null);
+
+    /**
+     * Quotes a value and places into a piece of text at a placeholder.
+     *
+     * The placeholder is a question-mark; all placeholders will be replaced
+     * with the quoted value.   For example:
+     *
+     * <code>
+     * $text = "WHERE date < ?";
+     * $date = "2005-01-02";
+     * $safe = $sql->quoteInto($text, $date);
+     * // $safe = "WHERE date < '2005-01-02'"
+     * </code>
+     *
+     * @param string  $text  The text with a placeholder.
+     * @param mixed   $value The value to quote.
+     * @param string  $type  OPTIONAL SQL datatype
+     * @param integer $count OPTIONAL count of placeholders to replace
+     * @return string An SQL-safe quoted value placed into the original text.
+     */
+    public function quoteInto($text, $value, $type = null, $count = null);
+
+    /**
+     * Quotes an identifier.
+     *
+     * Accepts a string representing a qualified indentifier. For Example:
+     * <code>
+     * $adapter->quoteIdentifier('myschema.mytable')
+     * </code>
+     * Returns: "myschema"."mytable"
+     *
+     * Or, an array of one or more identifiers that may form a qualified identifier:
+     * <code>
+     * $adapter->quoteIdentifier(array('myschema','my.table'))
+     * </code>
+     * Returns: "myschema"."my.table"
+     *
+     * The actual quote character surrounding the identifiers may vary depending on
+     * the adapter.
+     *
+     * @param string|array|\Zend_Db_Expr $ident The identifier.
+     * @param boolean $auto If true, heed the AUTO_QUOTE_IDENTIFIERS config option.
+     * @return string The quoted identifier.
+     */
+    public function quoteIdentifier($ident, $auto = false);
+
+    /**
+     * Run additional environment before setup
+     *
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function startSetup();
+
+    /**
+     * Run additional environment after setup
+     *
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function endSetup();
+
+    /**
+     * Build SQL statement for condition
+     *
+     * If $condition integer or string - exact value will be filtered ('eq' condition)
+     *
+     * If $condition is array - one of the following structures is expected:
+     * - array("from" => $fromValue, "to" => $toValue)
+     * - array("eq" => $equalValue)
+     * - array("neq" => $notEqualValue)
+     * - array("like" => $likeValue)
+     * - array("in" => array($inValues))
+     * - array("nin" => array($notInValues))
+     * - array("notnull" => $valueIsNotNull)
+     * - array("null" => $valueIsNull)
+     * - array("moreq" => $moreOrEqualValue)
+     * - array("gt" => $greaterValue)
+     * - array("lt" => $lessValue)
+     * - array("gteq" => $greaterOrEqualValue)
+     * - array("lteq" => $lessOrEqualValue)
+     * - array("finset" => $valueInSet)
+     * - array("regexp" => $regularExpression)
+     * - array("seq" => $stringValue)
+     * - array("sneq" => $stringValue)
+     *
+     * If non matched - sequential array is expected and OR conditions
+     * will be built using above mentioned structure
+     *
+     * @param string $fieldName
+     * @param integer|string|array $condition
+     * @return string
+     */
+    public function prepareSqlCondition($fieldName, $condition);
+
+    /**
+     * Retrieve valid table name
+     * Check table name length and allowed symbols
+     *
+     * @param string $tableName
+     * @return string
+     */
+    public function getTableName($tableName);
+
+    /**
+     * Retrieve valid index name
+     * Check index name length and allowed symbols
+     *
+     * @param string $tableName
+     * @param string|array $fields  the columns list
+     * @param string $indexType
+     * @return string
+     */
+    public function getIndexName($tableName, $fields, $indexType = '');
+
+    /**
+     * Retrieve valid foreign key name
+     * Check foreign key name length and allowed symbols
+     *
+     * @param string $priTableName
+     * @param string $priColumnName
+     * @param string $refTableName
+     * @param string $refColumnName
+     * @return string
+     */
+    public function getForeignKeyName($priTableName, $priColumnName, $refTableName, $refColumnName);
+
+    /**
+     * Return array of table(s) checksum as table name - checksum pairs
+     *
+     * @param array|string $tableNames
+     * @param string $schemaName
+     * @return array
+     */
+    public function getTablesChecksum($tableNames, $schemaName = null);
+
+    /**
+     * Try to find installed primary key name, if not - formate new one.
+     *
+     * @param string $tableName Table name
+     * @param string $schemaName OPTIONAL
+     * @return string Primary Key name
+     */
+    public function getPrimaryKeyName($tableName, $schemaName = null);
+
+    /**
+     * Get adapter transaction level state. Return 0 if all transactions are complete
+     *
+     * @return int
+     */
+    public function getTransactionLevel();
+
+    /**
+     * Drop trigger from database
+     *
+     * @param string $triggerName
+     * @param string|null $schemaName
+     * @return bool
+     */
+    public function dropTrigger($triggerName, $schemaName = null);
+}
diff --git a/setup/module/Magento/Framework/src/DB/Adapter/Pdo/Mysql.php b/setup/module/Magento/Framework/src/DB/Adapter/Pdo/Mysql.php
new file mode 100644
index 0000000000000000000000000000000000000000..e03f7a0a65122d9f1f95411f6da82a433e3589b0
--- /dev/null
+++ b/setup/module/Magento/Framework/src/DB/Adapter/Pdo/Mysql.php
@@ -0,0 +1,2778 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Framework\DB\Adapter\Pdo;
+
+use Magento\Filesystem\Filesystem;
+use Magento\Framework\DB\Adapter\AdapterInterface;
+use Magento\Framework\DB\Ddl\Table;
+use Magento\Framework\DB\ExpressionConverter;
+use Zend\Db\Adapter\Adapter;
+use Zend\Db\Adapter\Driver\StatementInterface;
+use Zend\Db\Adapter\Driver;
+use Zend\Db\Exception\ErrorException;
+use Zend\Db\Exception\InvalidArgumentException;
+use Zend\Db\Adapter\Exception;
+use Zend\Db\Adapter\ParameterContainer;
+use Zend\Db\Adapter\Platform;
+use Zend\Db\Adapter\Profiler;
+use Zend\Db\ResultSet;
+use Zend\Db\Sql\Expression;
+use Zend\Db\Sql\Sql;
+
+class Mysql extends Adapter implements AdapterInterface
+{
+    const DEBUG_CONNECT         = 0;
+    const DEBUG_TRANSACTION     = 1;
+    const DEBUG_QUERY           = 2;
+
+
+    const LENGTH_TABLE_NAME     = 64;
+    const LENGTH_INDEX_NAME     = 64;
+    const LENGTH_FOREIGN_NAME   = 64;
+
+    /**
+     * MEMORY engine type for MySQL tables
+     */
+    const ENGINE_MEMORY = 'MEMORY';
+
+    /**
+     * Maximum number of connection retries
+     */
+    const MAX_CONNECTION_RETRIES = 10;
+
+    /**
+     * Current Transaction Level
+     *
+     * @var int
+     */
+    protected $_transactionLevel    = 0;
+
+    /**
+     * Whether transaction was rolled back or not
+     *
+     * @var bool
+     */
+    protected $_isRolledBack = false;
+
+    /**
+     * Set attribute to connection flag
+     *
+     * @var bool
+     */
+    protected $_connectionFlagsSet  = false;
+
+
+
+    /**
+     * SQL bind params. Used temporarily by regexp callback.
+     *
+     * @var array
+     */
+    protected $_bindParams          = array();
+
+    /**
+     * Autoincrement for bind value. Used by regexp callback.
+     *
+     * @var int
+     */
+    protected $_bindIncrement       = 0;
+
+    /**
+     * Write SQL debug data to file
+     *
+     * @var bool
+     */
+    protected $_debug               = false;
+
+    /**
+     * Minimum query duration time to be logged
+     *
+     * @var float
+     */
+    protected $_logQueryTime        = 0.05;
+
+    /**
+     * Log all queries (ignored minimum query duration time)
+     *
+     * @var bool
+     */
+    protected $_logAllQueries       = false;
+
+    /**
+     * Add to log call stack data (backtrace)
+     *
+     * @var bool
+     */
+    protected $_logCallStack        = false;
+
+    /**
+     * Path to SQL debug data log
+     *
+     * @var string
+     */
+    protected $_debugFile           = '/debug/pdo_mysql.log';
+
+    /**
+     * Filesystem class
+     *
+     * @var Filesystem
+     */
+    protected $_filesystem;
+
+    /**
+     * Debug timer start value
+     *
+     * @var float
+     */
+    protected $_debugTimer          = 0;
+
+    /**
+     * MySQL column - Table DDL type pairs
+     *
+     * @var array
+     */
+    protected $_ddlColumnTypes      = array(
+        Table::TYPE_BOOLEAN       => 'bool',
+        Table::TYPE_SMALLINT      => 'smallint',
+        Table::TYPE_INTEGER       => 'int',
+        Table::TYPE_BIGINT        => 'bigint',
+        Table::TYPE_FLOAT         => 'float',
+        Table::TYPE_DECIMAL       => 'decimal',
+        Table::TYPE_NUMERIC       => 'decimal',
+        Table::TYPE_DATE          => 'date',
+        Table::TYPE_TIMESTAMP     => 'timestamp',
+        Table::TYPE_DATETIME      => 'datetime',
+        Table::TYPE_TEXT          => 'text',
+        Table::TYPE_BLOB          => 'blob',
+        Table::TYPE_VARBINARY     => 'blob'
+    );
+
+    /**
+     * All possible DDL statements
+     * First 3 symbols for each statement
+     *
+     * @var string[]
+     */
+    protected $_ddlRoutines = array('alt', 'cre', 'ren', 'dro', 'tru');
+
+    /**
+     * @var String
+     */
+    protected $string;
+
+    public function __construct(
+        $driver,
+        Platform\PlatformInterface $platform = null,
+        ResultSet\ResultSetInterface $queryResultPrototype = null,
+        Profiler\ProfilerInterface $profiler = null,
+        Filesystem $filesystem = null
+    ) {
+        $this->_filesystem = $filesystem;
+        parent::__construct($driver, $platform, $queryResultPrototype, $profiler);
+    }
+
+    /**
+     * Begin new DB transaction for connection
+     *
+     * @return $this
+     * @throws \Exception
+     */
+    public function beginTransaction()
+    {
+        if ($this->_isRolledBack) {
+            throw new \Exception(AdapterInterface::ERROR_ROLLBACK_INCOMPLETE_MESSAGE);
+        }
+        if ($this->_transactionLevel === 0) {
+            $this->_debugTimer();
+            $this->getDriver()->getConnection()->beginTransaction();
+            $this->_debugStat(self::DEBUG_TRANSACTION, 'BEGIN');
+        }
+        ++$this->_transactionLevel;
+        return $this;
+    }
+
+    /**
+     * Commit DB transaction
+     *
+     * @return $this
+     * @throws \Exception
+     */
+    public function commit()
+    {
+        if ($this->_transactionLevel === 1 && !$this->_isRolledBack) {
+            $this->_debugTimer();
+            $this->getDriver()->getConnection()->commit();
+            $this->_debugStat(self::DEBUG_TRANSACTION, 'COMMIT');
+        } elseif ($this->_transactionLevel === 0) {
+            throw new \Exception(AdapterInterface::ERROR_ASYMMETRIC_COMMIT_MESSAGE);
+        } elseif ($this->_isRolledBack) {
+            throw new \Exception(AdapterInterface::ERROR_ROLLBACK_INCOMPLETE_MESSAGE);
+        }
+        --$this->_transactionLevel;
+        return $this;
+    }
+
+    /**
+     * Rollback DB transaction
+     *
+     * @return $this
+     * @throws \Exception
+     */
+    public function rollBack()
+    {
+        if ($this->_transactionLevel === 1) {
+            $this->_debugTimer();
+            $this->getDriver()->getConnection()->rollBack();
+            $this->_isRolledBack = false;
+            $this->_debugStat(self::DEBUG_TRANSACTION, 'ROLLBACK');
+        } elseif ($this->_transactionLevel === 0) {
+            throw new \Exception(AdapterInterface::ERROR_ASYMMETRIC_ROLLBACK_MESSAGE);
+        } else {
+            $this->_isRolledBack = true;
+        }
+        --$this->_transactionLevel;
+        return $this;
+    }
+
+    /**
+     * Get adapter transaction level state. Return 0 if all transactions are complete
+     *
+     * @return int
+     */
+    public function getTransactionLevel()
+    {
+        return $this->_transactionLevel;
+    }
+
+    /**
+     * Creates a PDO object and connects to the database.
+     *
+     * @return void
+     * @throws ErrorException
+     */
+    public function connect()
+    {
+        if ($this->getDriver()->getConnection()->isConnected()) {
+            return;
+        }
+
+        $this->_debugTimer();
+        $this->getDriver()->getConnection()->connect();
+        $this->_debugStat(self::DEBUG_CONNECT, '');
+    }
+
+    /**
+     * Run RAW Query
+     *
+     * @param string $sql
+     * @return StatementInterface
+     * @throws \PDOException
+     */
+    public function rawQuery($sql)
+    {
+        try {
+            $result = $this->query($sql);
+        } catch (InvalidArgumentException $e) {
+            // Convert to \PDOException to maintain backwards compatibility with usage of MySQL adapter
+            $e = $e->getPrevious();
+            if (!($e instanceof \PDOException)) {
+                $e = new \PDOException($e->getMessage(), $e->getCode());
+            }
+            throw $e;
+        }
+
+        return $result;
+    }
+
+    public function fetchAll($sql, $bind = array(), $fetchMode = null)
+    {
+        if ($sql instanceof \Zend\Db\Sql\Select) {
+            $sql = $sql->getSqlString($this->getPlatform());
+        }
+        return $this->query($sql);
+    }
+
+    /**
+     * Run RAW query and Fetch First row
+     *
+     * @param string $sql
+     * @param string|int $field
+     * @return mixed|null
+     */
+    public function rawFetchRow($sql, $field = null)
+    {
+        $result = $this->rawQuery($sql);
+
+        if ($result instanceof ResultSet\ResultSetInterface && $result->count()) {
+            $resultSet = new ResultSet\ResultSet;
+            $resultSet->initialize($result);
+
+            $row = $resultSet->toArray();
+
+            if (empty($field)) {
+                return $row;
+            } else {
+                return isset($row[0][$field]) ? $row[0][$field] : false;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Check transaction level in case of DDL query
+     *
+     * @param string $sql
+     * @return void
+     * @throws \Zend_Db_Adapter_Exception
+     */
+    protected function _checkDdlTransaction($sql)
+    {
+        if (is_string($sql) && $this->getTransactionLevel() > 0) {
+            $startSql = strtolower(substr(ltrim($sql), 0, 3));
+            if (in_array($startSql, $this->_ddlRoutines)) {
+                trigger_error(AdapterInterface::ERROR_DDL_MESSAGE, E_USER_ERROR);
+            }
+        }
+    }
+
+    /**
+     * query() is a convenience function
+     *
+     * @param string $sql
+     * @param string|array|ParameterContainer $parametersOrQueryMode
+     * @param ResultSet\ResultSetInterface $resultPrototype
+     * @throws InvalidArgumentException
+     * @return StatementInterface|ResultSet\ResultSetInterface
+     */
+    public function query(
+        $sql,
+        $parametersOrQueryMode = self::QUERY_MODE_EXECUTE,
+        ResultSet\ResultSetInterface $resultPrototype = null
+    ) {
+        return parent::query($sql, $parametersOrQueryMode, $resultPrototype);
+    }
+
+    /**
+     * Drop the Foreign Key from table
+     *
+     * @param string $tableName
+     * @param string $fkName
+     * @param string $schemaName
+     * @return $this
+     */
+    public function dropForeignKey($tableName, $fkName, $schemaName = null)
+    {
+        $foreignKeys = $this->getForeignKeys($tableName, $schemaName);
+        $fkName = strtoupper($fkName);
+        if (substr($fkName, 0, 3) == 'FK_') {
+            $fkName = substr($fkName, 3);
+        }
+        foreach (array($fkName, 'FK_' . $fkName) as $key) {
+            if (isset($foreignKeys[$key])) {
+                $sql = sprintf(
+                    'ALTER TABLE %s DROP FOREIGN KEY %s',
+                    $this->getPlatform()->quoteIdentifierChain($this->_getTableName($tableName)),
+                    $this->quoteIdentifier($foreignKeys[$key]['FK_NAME'])
+                );
+                $this->rawQuery($sql);
+            }
+        }
+        return $this;
+    }
+
+    /**
+     * Prepare table before add constraint foreign key
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $refTableName
+     * @param string $refColumnName
+     * @param string $onDelete
+     * @return $this
+     */
+    public function purgeOrphanRecords(
+        $tableName,
+        $columnName,
+        $refTableName,
+        $refColumnName,
+        $onDelete = AdapterInterface::FK_ACTION_CASCADE
+    ) {
+        $onDelete = strtoupper($onDelete);
+        if ($onDelete == AdapterInterface::FK_ACTION_CASCADE
+            || $onDelete == AdapterInterface::FK_ACTION_RESTRICT
+        ) {
+            $sql = sprintf(
+                "DELETE p.* FROM %s AS p LEFT JOIN %s AS r ON p.%s = r.%s WHERE r.%s IS NULL",
+                $this->quoteIdentifier($tableName),
+                $this->quoteIdentifier($refTableName),
+                $this->quoteIdentifier($columnName),
+                $this->quoteIdentifier($refColumnName),
+                $this->quoteIdentifier($refColumnName)
+            );
+            $this->rawQuery($sql);
+        } elseif ($onDelete == AdapterInterface::FK_ACTION_SET_NULL) {
+            $sql = sprintf(
+                "UPDATE %s AS p LEFT JOIN %s AS r ON p.%s = r.%s SET p.%s = NULL WHERE r.%s IS NULL",
+                $this->quoteIdentifier($tableName),
+                $this->quoteIdentifier($refTableName),
+                $this->quoteIdentifier($columnName),
+                $this->quoteIdentifier($refColumnName),
+                $this->quoteIdentifier($columnName),
+                $this->quoteIdentifier($refColumnName)
+            );
+            $this->query($sql);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Check does table column exist
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $schemaName
+     * @return bool
+     */
+    public function tableColumnExists($tableName, $columnName, $schemaName = null)
+    {
+        $describe = $this->describeTable($tableName, $schemaName);
+        foreach ($describe as $column) {
+            if ($column['COLUMN_NAME'] == $columnName) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Adds new column to table.
+     *
+     * Generally $defintion must be array with column data to keep this call cross-DB compatible.
+     * Using string as $definition is allowed only for concrete DB adapter.
+     * Adds primary key if needed
+     *
+     * @param   string $tableName
+     * @param   string $columnName
+     * @param   array|string $definition  string specific or universal array DB Server definition
+     * @param   string $schemaName
+     * @return  true|StatementInterface
+     * @throws  ErrorException
+     */
+    public function addColumn($tableName, $columnName, $definition, $schemaName = null)
+    {
+        if ($this->tableColumnExists($tableName, $columnName, $schemaName)) {
+            return true;
+        }
+
+        $primaryKey = '';
+        if (is_array($definition)) {
+            $definition = array_change_key_case($definition, CASE_UPPER);
+            if (empty($definition['COMMENT'])) {
+                throw new ErrorException("Impossible to create a column without comment.");
+            }
+            if (!empty($definition['PRIMARY'])) {
+                $primaryKey = sprintf(', ADD PRIMARY KEY (%s)', $this->quoteIdentifier($columnName));
+            }
+            $definition = $this->_getColumnDefinition($definition);
+        }
+
+        $sql = sprintf(
+            'ALTER TABLE %s ADD COLUMN %s %s %s',
+            $this->getPlatform()->quoteIdentifierChain($tableName),
+            $this->quoteIdentifier($columnName),
+            $definition,
+            $primaryKey
+        );
+
+        $result = $this->query($sql);
+
+        return $result;
+    }
+
+    /**
+     * Delete table column
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $schemaName
+     * @return true|StatementInterface
+     */
+    public function dropColumn($tableName, $columnName, $schemaName = null)
+    {
+        if (!$this->tableColumnExists($tableName, $columnName, $schemaName)) {
+            return true;
+        }
+
+        $alterDrop = array();
+
+        $foreignKeys = $this->getForeignKeys($tableName, $schemaName);
+        foreach ($foreignKeys as $fkProp) {
+            if ($fkProp['COLUMN_NAME'] == $columnName) {
+                $alterDrop[] = 'DROP FOREIGN KEY ' . $this->quoteIdentifier($fkProp['FK_NAME']);
+            }
+        }
+
+        /* drop index that after column removal would coincide with the existing index by indexed columns */
+        foreach ($this->getIndexList($tableName, $schemaName) as $idxData) {
+            $idxColumns = $idxData['COLUMNS_LIST'];
+            $idxColumnKey = array_search($columnName, $idxColumns);
+            if ($idxColumnKey !== false) {
+                unset($idxColumns[$idxColumnKey]);
+                if ($idxColumns && $this->_getIndexByColumns($tableName, $idxColumns, $schemaName)) {
+                    $this->dropIndex($tableName, $idxData['KEY_NAME'], $schemaName);
+                }
+            }
+        }
+
+        $alterDrop[] = 'DROP COLUMN ' . $this->quoteIdentifier($columnName);
+        $sql = sprintf(
+            'ALTER TABLE %s %s',
+            $this->getPlatform()->quoteIdentifierChain($tableName),
+            implode(', ', $alterDrop)
+        );
+
+        $result = $this->query($sql);
+
+        return $result;
+    }
+
+    /**
+     * Retrieve index information by indexed columns or return NULL, if there is no index for a column list
+     *
+     * @param string $tableName
+     * @param array $columns
+     * @param string|null $schemaName
+     * @return array|null
+     */
+    protected function _getIndexByColumns($tableName, array $columns, $schemaName)
+    {
+        foreach ($this->getIndexList($tableName, $schemaName) as $idxData) {
+            if ($idxData['COLUMNS_LIST'] === $columns) {
+                return $idxData;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Change the column name and definition
+     *
+     * For change definition of column - use modifyColumn
+     *
+     * @param string $tableName
+     * @param string $oldColumnName
+     * @param string $newColumnName
+     * @param array $definition
+     * @param boolean $flushData        flush table statistic
+     * @param string $schemaName
+     * @return StatementInterface
+     * @throws ErrorException
+     */
+    public function changeColumn(
+        $tableName,
+        $oldColumnName,
+        $newColumnName,
+        $definition,
+        $flushData = false,
+        $schemaName = null
+    ) {
+        if (!$this->tableColumnExists($tableName, $oldColumnName, $schemaName)) {
+            throw new ErrorException(
+                sprintf(
+                    'Column "%s" does not exist in table "%s".',
+                    $oldColumnName,
+                    $tableName
+                )
+            );
+        }
+
+        if (is_array($definition)) {
+            $definition = $this->_getColumnDefinition($definition);
+        }
+
+        $sql = sprintf(
+            'ALTER TABLE %s CHANGE COLUMN %s %s %s',
+            $this->getPlatform()->quoteIdentifierChain($tableName),
+            $this->quoteIdentifier($oldColumnName),
+            $this->quoteIdentifier($newColumnName),
+            $definition
+        );
+
+        $result = $this->query($sql);
+
+        if ($flushData) {
+            $this->showTableStatus($tableName, $schemaName);
+        }
+
+        return $result;
+    }
+
+    /**
+     * Modify the column definition
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param array|string $definition
+     * @param boolean $flushData
+     * @param string $schemaName
+     * @return $this
+     * @throws ErrorException
+     */
+    public function modifyColumn($tableName, $columnName, $definition, $flushData = false, $schemaName = null)
+    {
+        if (!$this->tableColumnExists($tableName, $columnName, $schemaName)) {
+            throw new ErrorException(sprintf('Column "%s" does not exist in table "%s".', $columnName, $tableName));
+        }
+        if (is_array($definition)) {
+            $definition = $this->_getColumnDefinition($definition);
+        }
+
+        $sql = sprintf(
+            'ALTER TABLE %s MODIFY COLUMN %s %s',
+            $this->getPlatform()->quoteIdentifierChain($tableName),
+            $this->quoteIdentifier($columnName),
+            $definition
+        );
+
+        $this->query($sql);
+        if ($flushData) {
+            $this->showTableStatus($tableName, $schemaName);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Show table status
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return mixed
+     */
+    public function showTableStatus($tableName, $schemaName = null)
+    {
+        $fromDbName = null;
+        if ($schemaName !== null) {
+            $fromDbName = ' FROM ' . $this->quoteIdentifier($schemaName);
+        }
+        $query = sprintf('SHOW TABLE STATUS%s LIKE %s', $fromDbName, $this->quote($tableName));
+
+        return $this->rawFetchRow($query);
+    }
+
+    /**
+     * Retrieve Create Table SQL
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return string
+     */
+    public function getCreateTable($tableName, $schemaName = null)
+    {
+        if ($schemaName) {
+            $table = array($schemaName, $tableName);
+        } else {
+            $table = $tableName;
+        }
+        $sql = 'SHOW CREATE TABLE ' . $this->getPlatform()->quoteIdentifierChain($table);
+        $ddl = $this->rawFetchRow($sql, 'Create Table');
+
+        return $ddl;
+    }
+
+    /**
+     * Retrieve the foreign keys descriptions for a table.
+     *
+     * The return value is an associative array keyed by the UPPERCASE foreign key,
+     * as returned by the RDBMS.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * FK_NAME          => string; original foreign key name
+     * SCHEMA_NAME      => string; name of database or schema
+     * TABLE_NAME       => string;
+     * COLUMN_NAME      => string; column name
+     * REF_SCHEMA_NAME  => string; name of reference database or schema
+     * REF_TABLE_NAME   => string; reference table name
+     * REF_COLUMN_NAME  => string; reference column name
+     * ON_DELETE        => string; action type on delete row
+     * ON_UPDATE        => string; action type on update row
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return array
+     */
+    public function getForeignKeys($tableName, $schemaName = null)
+    {
+        $ddl = array();
+        $createSql = $this->getCreateTable($tableName, $schemaName);
+
+        // collect CONSTRAINT
+        $regExp  = '#,\s+CONSTRAINT `([^`]*)` FOREIGN KEY \(`([^`]*)`\) '
+            . 'REFERENCES (`([^`]*)`\.)?`([^`]*)` \(`([^`]*)`\)'
+            . '( ON DELETE (RESTRICT|CASCADE|SET NULL|NO ACTION))?'
+            . '( ON UPDATE (RESTRICT|CASCADE|SET NULL|NO ACTION))?#';
+        $matches = array();
+        preg_match_all($regExp, $createSql, $matches, PREG_SET_ORDER);
+        foreach ($matches as $match) {
+            $ddl[strtoupper($match[1])] = array(
+                'FK_NAME'           => $match[1],
+                'SCHEMA_NAME'       => $schemaName,
+                'TABLE_NAME'        => $tableName,
+                'COLUMN_NAME'       => $match[2],
+                'REF_SHEMA_NAME'    => isset($match[4]) ? $match[4] : $schemaName,
+                'REF_TABLE_NAME'    => $match[5],
+                'REF_COLUMN_NAME'   => $match[6],
+                'ON_DELETE'         => isset($match[7]) ? $match[8] : '',
+                'ON_UPDATE'         => isset($match[9]) ? $match[10] : ''
+            );
+        }
+
+        return $ddl;
+    }
+
+    /**
+     * Retrieve the foreign keys tree for all tables
+     *
+     * @return array
+     */
+    public function getForeignKeysTree()
+    {
+        $tree = array();
+        foreach ($this->listTables() as $table) {
+            foreach ($this->getForeignKeys($table) as $key) {
+                $tree[$table][$key['COLUMN_NAME']] = $key;
+            }
+        }
+
+        return $tree;
+    }
+
+    /**
+     * Modify tables, used for upgrade process
+     * Change columns definitions, reset foreign keys, change tables comments and engines.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * columns => array; list of columns definitions
+     * comment => string; table comment
+     * engine  => string; table engine
+     *
+     * @param array $tables
+     * @return $this
+     */
+    public function modifyTables($tables)
+    {
+        $foreignKeys = $this->getForeignKeysTree();
+        foreach ($tables as $table => $tableData) {
+            if (!$this->isTableExists($table)) {
+                continue;
+            }
+            foreach ($tableData['columns'] as $column => $columnDefinition) {
+                if (!$this->tableColumnExists($table, $column)) {
+                    continue;
+                }
+                $droppedKeys = array();
+                foreach ($foreignKeys as $keyTable => $columns) {
+                    foreach ($columns as $columnName => $keyOptions) {
+                        if ($table == $keyOptions['REF_TABLE_NAME'] && $column == $keyOptions['REF_COLUMN_NAME']) {
+                            $this->dropForeignKey($keyTable, $keyOptions['FK_NAME']);
+                            $droppedKeys[] = $keyOptions;
+                        }
+                    }
+                }
+
+                $this->modifyColumn($table, $column, $columnDefinition);
+
+                foreach ($droppedKeys as $options) {
+                    unset($columnDefinition['identity'], $columnDefinition['primary'], $columnDefinition['comment']);
+
+                    $onDelete = $options['ON_DELETE'];
+                    $onUpdate = $options['ON_UPDATE'];
+
+                    if ($onDelete == AdapterInterface::FK_ACTION_SET_NULL
+                        || $onUpdate == AdapterInterface::FK_ACTION_SET_NULL) {
+                           $columnDefinition['nullable'] = true;
+                    }
+                    $this->modifyColumn($options['TABLE_NAME'], $options['COLUMN_NAME'], $columnDefinition);
+                    $this->addForeignKey(
+                        $options['FK_NAME'],
+                        $options['TABLE_NAME'],
+                        $options['COLUMN_NAME'],
+                        $options['REF_TABLE_NAME'],
+                        $options['REF_COLUMN_NAME'],
+                        ($onDelete) ? $onDelete : AdapterInterface::FK_ACTION_NO_ACTION,
+                        ($onUpdate) ? $onUpdate : AdapterInterface::FK_ACTION_NO_ACTION
+                    );
+                }
+            }
+            if (!empty($tableData['comment'])) {
+                $this->changeTableComment($table, $tableData['comment']);
+            }
+            if (!empty($tableData['engine'])) {
+                $this->changeTableEngine($table, $tableData['engine']);
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * Retrieve table index information
+     *
+     * The return value is an associative array keyed by the UPPERCASE index key (except for primary key,
+     * that is always stored under 'PRIMARY' key) as returned by the RDBMS.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * SCHEMA_NAME      => string; name of database or schema
+     * TABLE_NAME       => string; name of the table
+     * KEY_NAME         => string; the original index name
+     * COLUMNS_LIST     => array; array of index column names
+     * INDEX_TYPE       => string; lowercase, create index type
+     * INDEX_METHOD     => string; index method using
+     * type             => string; see INDEX_TYPE
+     * fields           => array; see COLUMNS_LIST
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return array|string|int
+     */
+    public function getIndexList($tableName, $schemaName = null)
+    {
+        $ddl = array();
+
+        $sql = sprintf(
+            'SHOW INDEX FROM %s',
+            $this->getPlatform()->quoteIdentifierChain($tableName)
+        );
+
+        foreach ($this->fetchAll($sql) as $row) {
+            $fieldKeyName   = 'Key_name';
+            $fieldNonUnique = 'Non_unique';
+            $fieldColumn    = 'Column_name';
+            $fieldIndexType = 'Index_type';
+
+            if (strtolower($row[$fieldKeyName]) == AdapterInterface::INDEX_TYPE_PRIMARY) {
+                $indexType  = AdapterInterface::INDEX_TYPE_PRIMARY;
+            } elseif ($row[$fieldNonUnique] == 0) {
+                $indexType  = AdapterInterface::INDEX_TYPE_UNIQUE;
+            } elseif (strtolower($row[$fieldIndexType]) == AdapterInterface::INDEX_TYPE_FULLTEXT) {
+                $indexType  = AdapterInterface::INDEX_TYPE_FULLTEXT;
+            } else {
+                $indexType  = AdapterInterface::INDEX_TYPE_INDEX;
+            }
+
+            $upperKeyName = strtoupper($row[$fieldKeyName]);
+            if (isset($ddl[$upperKeyName])) {
+                $ddl[$upperKeyName]['fields'][] = $row[$fieldColumn]; // for compatible
+                $ddl[$upperKeyName]['COLUMNS_LIST'][] = $row[$fieldColumn];
+            } else {
+                $ddl[$upperKeyName] = array(
+                    'SCHEMA_NAME'   => $schemaName,
+                    'TABLE_NAME'    => $tableName,
+                    'KEY_NAME'      => $row[$fieldKeyName],
+                    'COLUMNS_LIST'  => array($row[$fieldColumn]),
+                    'INDEX_TYPE'    => $indexType,
+                    'INDEX_METHOD'  => $row[$fieldIndexType],
+                    'type'          => strtolower($indexType), // for compatibility
+                    'fields'        => array($row[$fieldColumn]) // for compatibility
+                );
+            }
+        }
+
+        return $ddl;
+    }
+
+    /**
+     * Remove duplicate entry for create key
+     *
+     * @param string $table
+     * @param array $fields
+     * @param string[] $ids
+     * @return $this
+     */
+    protected function _removeDuplicateEntry($table, $fields, $ids)
+    {
+        $where = array();
+        $i = 0;
+        foreach ($fields as $field) {
+            $where[] = $this->quoteInto($field . '=?', $ids[$i++]);
+        }
+
+        if (!$where) {
+            return $this;
+        }
+        $whereCond = implode(' AND ', $where);
+        $sql = sprintf('SELECT COUNT(*) as `cnt` FROM `%s` WHERE %s', $table, $whereCond);
+
+        $cnt = $this->rawFetchRow($sql, 'cnt');
+        if ($cnt > 1) {
+            $sql = sprintf(
+                'DELETE FROM `%s` WHERE %s LIMIT %d',
+                $table,
+                $whereCond,
+                $cnt - 1
+            );
+            $this->rawQuery($sql);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Creates and returns a new \Zend\Db\Sql\Select object for this adapter.
+     *
+     * @return Sql/Select
+     */
+    public function select()
+    {
+        $sql = new Sql($this);
+        return $sql->select();
+    }
+
+    /**
+     * Start debug timer
+     *
+     * @return $this
+     */
+    protected function _debugTimer()
+    {
+        if ($this->_debug) {
+            $this->_debugTimer = microtime(true);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Logging debug information
+     *
+     * @param int $type
+     * @param string $sql
+     * @param array $bind
+     * @param StatementInterface $result
+     * @return $this
+     */
+    protected function _debugStat($type, $sql, $bind = array(), $result = null)
+    {
+        if (!$this->_debug) {
+            return $this;
+        }
+
+        $code = '## ' . getmypid() . ' ## ';
+        $nl   = "\n";
+        $time = sprintf('%.4f', microtime(true) - $this->_debugTimer);
+
+        if (!$this->_logAllQueries && $time < $this->_logQueryTime) {
+            return $this;
+        }
+        switch ($type) {
+            case self::DEBUG_CONNECT:
+                $code .= 'CONNECT' . $nl;
+                break;
+            case self::DEBUG_TRANSACTION:
+                $code .= 'TRANSACTION ' . $sql . $nl;
+                break;
+            case self::DEBUG_QUERY:
+                $code .= 'QUERY' . $nl;
+                $code .= 'SQL: ' . $sql . $nl;
+                if ($bind) {
+                    $code .= 'BIND: ' . var_export($bind, true) . $nl;
+                }
+                if ($result instanceof StatementInterface) {
+                    $code .= 'AFF: ' . $result->rowCount() . $nl;
+                }
+                break;
+        }
+        $code .= 'TIME: ' . $time . $nl;
+
+        if ($this->_logCallStack) {
+            $code .= 'TRACE: ' . Debug::backtrace(true, false) . $nl;
+        }
+
+        $code .= $nl;
+
+        $this->_debugWriteToFile($code);
+
+        return $this;
+    }
+
+    /**
+     * Write exception and thow
+     *
+     * @param \Exception $e
+     * @return void
+     * @throws \Exception
+     */
+    protected function _debugException(\Exception $e)
+    {
+        if (!$this->_debug) {
+            throw $e;
+        }
+
+        $nl   = "\n";
+        $code = 'EXCEPTION ' . $nl . $e . $nl . $nl;
+        $this->_debugWriteToFile($code);
+
+        throw $e;
+    }
+
+    /**
+     * Debug write to file process
+     *
+     * @param string $str
+     * @return void
+     */
+    protected function _debugWriteToFile($str)
+    {
+        $str = '## ' . date('Y-m-d H:i:s') . "\r\n" . $str;
+        $this->_filesystem->getDirectoryWrite('var')->writeFile($this->_debugFile, $str, FILE_APPEND | LOCK_EX);
+    }
+
+    /**
+     * Quotes a value and places into a piece of text at a placeholder.
+     *
+     * Method revrited for handle empty arrays in value param
+     *
+     * @param string  $text  The text with a placeholder.
+     * @param mixed   $value The value to quote.
+     * @param string  $type  OPTIONAL SQL datatype
+     * @param integer $count OPTIONAL count of placeholders to replace
+     * @return string An SQL-safe quoted value placed into the orignal text.
+     */
+    public function quoteInto($text, $value, $type = null, $count = null)
+    {
+        if ($value instanceof \Zend\Db\Sql\Expression) {
+            $value = $value->getExpression();
+        }
+        if ($count === null) {
+            return str_replace('?', $this->quote($value, $type), $text);
+        } else {
+            while ($count > 0) {
+                if (strpos($text, '?') !== false) {
+                    $text = substr_replace($text, $this->quote($value, $type), strpos($text, '?'), 1);
+                }
+                --$count;
+            }
+            return $text;
+        }
+    }
+
+    /**
+     * Retrieve ddl cache name
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return string
+     */
+    protected function _getTableName($tableName, $schemaName = null)
+    {
+        return ($schemaName ? $schemaName . '.' : '') . $tableName;
+    }
+
+    /**
+     * Returns the column descriptions for a table.
+     *
+     * The return value is an associative array keyed by the column name,
+     * as returned by the RDBMS.
+     *
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * SCHEMA_NAME      => string; name of database or schema
+     * TABLE_NAME       => string;
+     * COLUMN_NAME      => string; column name
+     * COLUMN_POSITION  => number; ordinal position of column in table
+     * DATA_TYPE        => string; SQL datatype name of column
+     * DEFAULT          => string; default expression of column, null if none
+     * NULLABLE         => boolean; true if column can have nulls
+     * LENGTH           => number; length of CHAR/VARCHAR
+     * SCALE            => number; scale of NUMERIC/DECIMAL
+     * PRECISION        => number; precision of NUMERIC/DECIMAL
+     * UNSIGNED         => boolean; unsigned property of an integer type
+     * PRIMARY          => boolean; true if column is part of the primary key
+     * PRIMARY_POSITION => integer; position of column in primary key
+     * IDENTITY         => integer; true if column is auto-generated with unique values
+     *
+     * @param string $tableName
+     * @param string $schemaName OPTIONAL
+     * @return array
+     */
+    public function describeTable($tableName, $schemaName = null)
+    {
+        $desc = [];
+        $ddl = new \Zend\Db\Metadata\Metadata($this);
+        $ddlTable = $ddl->getTable($tableName, $schemaName);
+        $constraints = $ddlTable->getConstraints();
+
+        foreach ($ddlTable->getColumns() as $ddlColumn) {
+            $primary = false;
+            foreach ($constraints as $constraint) {
+                $primary = in_array($ddlColumn->getName(), $constraint->getColumns()) && $constraint->isPrimaryKey();
+            }
+            $desc[$ddlColumn->getName()] = array(
+                'SCHEMA_NAME'      => null,
+                'TABLE_NAME'       => $tableName,
+                'COLUMN_NAME'      => $ddlColumn->getName(),
+                'COLUMN_POSITION'  => $ddlColumn->getOrdinalPosition(),
+                'DATA_TYPE'        => $ddlColumn->getDataType(),
+                'DEFAULT'          => $ddlColumn->getColumnDefault(),
+                'NULLABLE'         => $ddlColumn->isNullable(),
+                'LENGTH'           => $ddlColumn->getCharacterMaximumLength(),
+                'SCALE'            => $ddlColumn->getNumericScale(),
+                'PRECISION'        => $ddlColumn->getNumericPrecision(),
+                'UNSIGNED'         => $ddlColumn->isNumericUnsigned(),
+                'PRIMARY'          => $primary,
+                'PRIMARY_POSITION' => 0,
+                'IDENTITY'         => false,
+            );
+
+        }
+
+        return $desc;
+    }
+
+    /**
+     * Format described column to definition, ready to be added to ddl table.
+     * Return array with keys: name, type, length, options, comment
+     *
+     * @param  array $columnData
+     * @return array
+     */
+    public function getColumnCreateByDescribe($columnData)
+    {
+        $type = $this->_getColumnTypeByDdl($columnData);
+        $options = array();
+
+        if ($columnData['IDENTITY'] === true) {
+            $options['identity'] = true;
+        }
+        if ($columnData['UNSIGNED'] === true) {
+            $options['unsigned'] = true;
+        }
+        if ($columnData['NULLABLE'] === false
+            && !($type == Table::TYPE_TEXT && strlen($columnData['DEFAULT']) != 0)
+        ) {
+            $options['nullable'] = false;
+        }
+        if ($columnData['PRIMARY'] === true) {
+            $options['primary'] = true;
+        }
+        if (!is_null($columnData['DEFAULT'])
+            && $type != Table::TYPE_TEXT
+        ) {
+            $options['default'] = $this->quote($columnData['DEFAULT']);
+        }
+        if (strlen($columnData['SCALE']) > 0) {
+            $options['scale'] = $columnData['SCALE'];
+        }
+        if (strlen($columnData['PRECISION']) > 0) {
+            $options['precision'] = $columnData['PRECISION'];
+        }
+
+        $comment = ucwords(str_replace('_', ' ', $columnData['COLUMN_NAME']));
+
+        $result = array(
+            'name'      => $columnData['COLUMN_NAME'],
+            'type'      => $type,
+            'length'    => $columnData['LENGTH'],
+            'options'   => $options,
+            'comment'   => $comment
+        );
+
+        return $result;
+    }
+
+    /**
+     * Create \Magento\Framework\DB\Ddl\Table object by data from describe table
+     *
+     * @param string $tableName
+     * @param string $newTableName
+     * @return Table
+     */
+    public function createTableByDdl($tableName, $newTableName)
+    {
+        $describe = $this->describeTable($tableName);
+        $table = $this->newTable($newTableName)
+            ->setComment(ucwords(str_replace('_', ' ', $newTableName)));
+
+        foreach ($describe as $columnData) {
+            $columnInfo = $this->getColumnCreateByDescribe($columnData);
+
+            $table->addColumn(
+                $columnInfo['name'],
+                $columnInfo['type'],
+                $columnInfo['length'],
+                $columnInfo['options'],
+                $columnInfo['comment']
+            );
+        }
+
+        $indexes = $this->getIndexList($tableName);
+        foreach ($indexes as $indexData) {
+            /**
+             * Do not create primary index - it is created with identity column.
+             * For reliability check both name and type, because these values can start to differ in future.
+             */
+            if (($indexData['KEY_NAME'] == 'PRIMARY')
+                || ($indexData['INDEX_TYPE'] == AdapterInterface::INDEX_TYPE_PRIMARY)
+            ) {
+                continue;
+            }
+
+            $fields = $indexData['COLUMNS_LIST'];
+            $options = array('type' => $indexData['INDEX_TYPE']);
+            $table->addIndex($this->getIndexName($newTableName, $fields, $indexData['INDEX_TYPE']), $fields, $options);
+        }
+
+        $foreignKeys = $this->getForeignKeys($tableName);
+        foreach ($foreignKeys as $keyData) {
+            $fkName = $this->getForeignKeyName(
+                $newTableName,
+                $keyData['COLUMN_NAME'],
+                $keyData['REF_TABLE_NAME'],
+                $keyData['REF_COLUMN_NAME']
+            );
+            $onDelete = $this->_getDdlAction($keyData['ON_DELETE']);
+            $onUpdate = $this->_getDdlAction($keyData['ON_UPDATE']);
+
+            $table->addForeignKey(
+                $fkName,
+                $keyData['COLUMN_NAME'],
+                $keyData['REF_TABLE_NAME'],
+                $keyData['REF_COLUMN_NAME'],
+                $onDelete,
+                $onUpdate
+            );
+        }
+
+        // Set additional options
+        $tableData = $this->showTableStatus($tableName);
+        if (isset($tableData['Engine'])) {
+            $table->setOption('type', $tableData['Engine']);
+        }
+
+        return $table;
+    }
+
+    /**
+     * Modify the column definition by data from describe table
+     *
+     * @param string $tableName
+     * @param string $columnName
+     * @param array $definition
+     * @param boolean $flushData
+     * @param string $schemaName
+     * @return $this
+     */
+    public function modifyColumnByDdl($tableName, $columnName, $definition, $flushData = false, $schemaName = null)
+    {
+        $definition = array_change_key_case($definition, CASE_UPPER);
+        $definition['COLUMN_TYPE'] = $this->_getColumnTypeByDdl($definition);
+        if (array_key_exists('DEFAULT', $definition) && is_null($definition['DEFAULT'])) {
+            unset($definition['DEFAULT']);
+        }
+
+        return $this->modifyColumn($tableName, $columnName, $definition, $flushData, $schemaName);
+    }
+
+    /**
+     * Retrieve column data type by data from describe table
+     *
+     * @param array $column
+     * @return string
+     */
+    protected function _getColumnTypeByDdl($column)
+    {
+        switch ($column['DATA_TYPE']) {
+            case 'bool':
+                return Table::TYPE_BOOLEAN;
+            case 'tinytext':
+            case 'char':
+            case 'varchar':
+            case 'text':
+            case 'mediumtext':
+            case 'longtext':
+                return Table::TYPE_TEXT;
+            case 'blob':
+            case 'mediumblob':
+            case 'longblob':
+                return Table::TYPE_BLOB;
+            case 'tinyint':
+            case 'smallint':
+                return Table::TYPE_SMALLINT;
+            case 'mediumint':
+            case 'int':
+                return Table::TYPE_INTEGER;
+            case 'bigint':
+                return Table::TYPE_BIGINT;
+            case 'datetime':
+                return Table::TYPE_DATETIME;
+            case 'timestamp':
+                return Table::TYPE_TIMESTAMP;
+            case 'date':
+                return Table::TYPE_DATE;
+            case 'float':
+                return Table::TYPE_FLOAT;
+            case 'decimal':
+            case 'numeric':
+                return Table::TYPE_DECIMAL;
+        }
+    }
+
+    /**
+     * Change table storage engine
+     *
+     * @param string $tableName
+     * @param string $engine
+     * @param string $schemaName
+     * @return StatementInterface
+     */
+    public function changeTableEngine($tableName, $engine, $schemaName = null)
+    {
+        $table = $this->getPlatform()->quoteIdentifierChain($tableName);
+        $sql   = sprintf('ALTER TABLE %s ENGINE=%s', $table, $engine);
+
+        return $this->query($sql);
+    }
+
+    /**
+     * Change table comment
+     *
+     * @param string $tableName
+     * @param string $comment
+     * @param string $schemaName
+     * @return StatementInterface
+     */
+    public function changeTableComment($tableName, $comment, $schemaName = null)
+    {
+        $table = $this->getPlatform()->quoteIdentifierChain($tableName);
+        $sql   = sprintf("ALTER TABLE %s COMMENT='%s'", $table, $comment);
+
+        return $this->query($sql);
+    }
+
+    /**
+     * Inserts a table row with specified data
+     * Special for Zero values to identity column
+     *
+     * @param string $table
+     * @param array $bind
+     * @return int The number of affected rows.
+     */
+    public function insertForce($table, array $bind)
+    {
+        $this->rawQuery("SET @OLD_INSERT_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
+        $result = $this->insert($table, $bind);
+        $this->rawQuery("SET SQL_MODE=IFNULL(@OLD_INSERT_SQL_MODE,'')");
+
+        return $result;
+    }
+
+    /**
+     * Return new DDL Table object
+     *
+     * @param string $tableName the table name
+     * @param string $schemaName the database/schema name
+     * @return Table
+     */
+    public function newTable($tableName = null, $schemaName = null)
+    {
+        $table = new Table();
+        if ($tableName !== null) {
+            $table->setName($tableName);
+        }
+        if ($schemaName !== null) {
+            $table->setSchema($schemaName);
+        }
+
+        return $table;
+    }
+
+    /**
+     * Create table
+     *
+     * @param Table $table
+     * @throws ErrorException
+     * @return ResultSet\ResultSetInterface
+     */
+    public function createTable(Table $table)
+    {
+        $columns = $table->getColumns();
+        foreach ($columns as $columnEntry) {
+            if (empty($columnEntry['COMMENT'])) {
+                throw new ErrorException("Cannot create table without columns comments");
+            }
+        }
+
+        $sqlFragment    = array_merge(
+            $this->_getColumnsDefinition($table),
+            $this->_getIndexesDefinition($table),
+            $this->_getForeignKeysDefinition($table)
+        );
+        $tableOptions   = $this->_getOptionsDefinition($table);
+        $sql = sprintf(
+            "CREATE TABLE %s (\n%s\n) %s",
+            $this->quoteIdentifier($table->getName()),
+            implode(",\n", $sqlFragment),
+            implode(" ", $tableOptions)
+        );
+        return $this->query($sql);
+    }
+
+    /**
+     * Create temporary table
+     *
+     * @param Table $table
+     * @return ResultSet\ResultSetInterface
+     */
+    public function createTemporaryTable(Table $table)
+    {
+        $columns = $table->getColumns();
+        $sqlFragment    = array_merge(
+            $this->_getColumnsDefinition($table),
+            $this->_getIndexesDefinition($table),
+            $this->_getForeignKeysDefinition($table)
+        );
+        $tableOptions   = $this->_getOptionsDefinition($table);
+        $sql = sprintf(
+            "CREATE TEMPORARY TABLE %s (\n%s\n) %s",
+            $this->getPlatform()->quoteIdentifier($table->getName()),
+            implode(",\n", $sqlFragment),
+            implode(" ", $tableOptions)
+        );
+
+        return $this->query($sql);
+    }
+
+    /**
+     * Rename several tables
+     *
+     * @param array $tablePairs array('oldName' => 'Name1', 'newName' => 'Name2')
+     *
+     * @return boolean
+     * @throws ErrorException
+     */
+    public function renameTablesBatch(array $tablePairs)
+    {
+        if (count($tablePairs) == 0) {
+            throw new ErrorException('Please provide tables for rename');
+        }
+
+        $renamesList = array();
+        $tablesList  = array();
+        foreach ($tablePairs as $pair) {
+            $oldTableName  = $pair['oldName'];
+            $newTableName  = $pair['newName'];
+            $renamesList[] = sprintf('%s TO %s', $oldTableName, $newTableName);
+
+            $tablesList[$oldTableName] = $oldTableName;
+            $tablesList[$newTableName] = $newTableName;
+        }
+
+        $query = sprintf('RENAME TABLE %s', implode(',', $renamesList));
+        $this->query($query);
+
+        return true;
+    }
+
+    /**
+     * Retrieve columns and primary keys definition array for create table
+     *
+     * @param Table $table
+     * @return string[]
+     * @throws ErrorException
+     */
+    protected function _getColumnsDefinition(Table $table)
+    {
+        $definition = array();
+        $primary    = array();
+        $columns    = $table->getColumns();
+        if (empty($columns)) {
+            throw new ErrorException('Table columns are not defined');
+        }
+
+        foreach ($columns as $columnData) {
+            $columnDefinition = $this->_getColumnDefinition($columnData);
+            if ($columnData['PRIMARY']) {
+                $primary[$columnData['COLUMN_NAME']] = $columnData['PRIMARY_POSITION'];
+            }
+
+            $definition[] = sprintf(
+                '  %s %s',
+                $this->quoteIdentifier($columnData['COLUMN_NAME']),
+                $columnDefinition
+            );
+        }
+
+        // PRIMARY KEY
+        if (!empty($primary)) {
+            asort($primary, SORT_NUMERIC);
+            $primary      = array_map(array($this->getPlatform(), 'quoteIdentifier'), array_keys($primary));
+            $definition[] = sprintf('  PRIMARY KEY (%s)', implode(', ', $primary));
+        }
+
+        return $definition;
+    }
+
+    /**
+     * Retrieve table indexes definition array for create table
+     *
+     * @param Table $table
+     * @return string[]
+     */
+    protected function _getIndexesDefinition(Table $table)
+    {
+        $definition = array();
+        $indexes    = $table->getIndexes();
+        if (!empty($indexes)) {
+            foreach ($indexes as $indexData) {
+                if (!empty($indexData['TYPE'])) {
+                    switch ($indexData['TYPE']) {
+                        case 'primary':
+                            $indexType = 'PRIMARY KEY';
+                            unset($indexData['INDEX_NAME']);
+                            break;
+                        default:
+                            $indexType = strtoupper($indexData['TYPE']);
+                            break;
+                    }
+                } else {
+                    $indexType = 'KEY';
+                }
+
+                $columns = array();
+                foreach ($indexData['COLUMNS'] as $columnData) {
+                    $column = $this->quoteIdentifier($columnData['NAME']);
+                    if (!empty($columnData['SIZE'])) {
+                        $column .= sprintf('(%d)', $columnData['SIZE']);
+                    }
+                    $columns[] = $column;
+                }
+                $indexName = isset($indexData['INDEX_NAME'])
+                    ? $this->getPlatform()->quoteIdentifier($indexData['INDEX_NAME'])
+                    : '';
+                $definition[] = sprintf(
+                    '  %s %s (%s)',
+                    $indexType,
+                    $indexName,
+                    implode(', ', $columns)
+                );
+            }
+        }
+
+        return $definition;
+    }
+
+    /**
+     * Retrieve table foreign keys definition array for create table
+     *
+     * @param Table $table
+     * @return string[]
+     */
+    protected function _getForeignKeysDefinition(Table $table)
+    {
+        $definition = array();
+        $relations  = $table->getForeignKeys();
+
+        if (!empty($relations)) {
+            foreach ($relations as $fkData) {
+                $onDelete = $this->_getDdlAction($fkData['ON_DELETE']);
+                $onUpdate = $this->_getDdlAction($fkData['ON_UPDATE']);
+
+                $definition[] = sprintf(
+                    '  CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s ON UPDATE %s',
+                    $this->quoteIdentifier($fkData['FK_NAME']),
+                    $this->quoteIdentifier($fkData['COLUMN_NAME']),
+                    $this->quoteIdentifier($fkData['REF_TABLE_NAME']),
+                    $this->quoteIdentifier($fkData['REF_COLUMN_NAME']),
+                    $onDelete,
+                    $onUpdate
+                );
+            }
+        }
+
+        return $definition;
+    }
+
+    /**
+     * Retrieve table options definition array for create table
+     *
+     * @param Table $table
+     * @return string[]
+     * @throws ErrorException
+     */
+    protected function _getOptionsDefinition(Table $table)
+    {
+        $definition = array();
+        $comment    = $table->getComment();
+        if (empty($comment)) {
+            throw new ErrorException('Comment for table is required and must be defined');
+        }
+        $definition[] = $this->quoteInto('COMMENT=?', $comment);
+
+        $tableProps = array(
+            'type'              => 'ENGINE=%s',
+            'checksum'          => 'CHECKSUM=%d',
+            'auto_increment'    => 'AUTO_INCREMENT=%d',
+            'avg_row_length'    => 'AVG_ROW_LENGTH=%d',
+            'max_rows'          => 'MAX_ROWS=%d',
+            'min_rows'          => 'MIN_ROWS=%d',
+            'delay_key_write'   => 'DELAY_KEY_WRITE=%d',
+            'row_format'        => 'row_format=%s',
+            'charset'           => 'charset=%s',
+            'collate'           => 'COLLATE=%s'
+        );
+        foreach ($tableProps as $key => $mask) {
+            $v = $table->getOption($key);
+            if ($v !== null) {
+                $definition[] = sprintf($mask, $v);
+            }
+        }
+
+        return $definition;
+    }
+
+    /**
+     * Get column definition from description
+     *
+     * @param  array $options
+     * @param  null|string $ddlType
+     * @return string
+     */
+    public function getColumnDefinitionFromDescribe($options, $ddlType = null)
+    {
+        $columnInfo = $this->getColumnCreateByDescribe($options);
+        foreach ($columnInfo['options'] as $key => $value) {
+            $columnInfo[$key] = $value;
+        }
+        return $this->_getColumnDefinition($columnInfo, $ddlType);
+    }
+
+    /**
+     * Retrieve column definition fragment
+     *
+     * @param array $options
+     * @param string $ddlType Table DDL Column type constant
+     * @return string
+     * @throws ErrorException
+     */
+    protected function _getColumnDefinition($options, $ddlType = null)
+    {
+        // convert keys to uppercase
+        $options    = array_change_key_case($options, CASE_UPPER);
+        $cType      = null;
+        $cUnsigned  = false;
+        $cNullable  = true;
+        $cDefault   = false;
+        $cIdentity  = false;
+
+        // detect and validate column type
+        if ($ddlType === null) {
+            $ddlType = $this->_getDdlType($options);
+        }
+
+        if (empty($ddlType) || !isset($this->_ddlColumnTypes[$ddlType])) {
+            throw new ErrorException('Invalid column definition data');
+        }
+
+        // column size
+        $cType = $this->_ddlColumnTypes[$ddlType];
+        switch ($ddlType) {
+            case Table::TYPE_SMALLINT:
+            case Table::TYPE_INTEGER:
+            case Table::TYPE_BIGINT:
+                if (!empty($options['UNSIGNED'])) {
+                    $cUnsigned = true;
+                }
+                break;
+            case Table::TYPE_DECIMAL:
+            case Table::TYPE_NUMERIC:
+                $precision  = 10;
+                $scale      = 0;
+                $match      = array();
+                if (!empty($options['LENGTH']) && preg_match('#^\(?(\d+),(\d+)\)?$#', $options['LENGTH'], $match)) {
+                    $precision  = $match[1];
+                    $scale      = $match[2];
+                } else {
+                    if (isset($options['SCALE']) && is_numeric($options['SCALE'])) {
+                        $scale = $options['SCALE'];
+                    }
+                    if (isset($options['PRECISION']) && is_numeric($options['PRECISION'])) {
+                        $precision = $options['PRECISION'];
+                    }
+                }
+                $cType .= sprintf('(%d,%d)', $precision, $scale);
+                break;
+            case Table::TYPE_TEXT:
+            case Table::TYPE_BLOB:
+            case Table::TYPE_VARBINARY:
+                if (empty($options['LENGTH'])) {
+                    $length = Table::DEFAULT_TEXT_SIZE;
+                } else {
+                    $length = $this->_parseTextSize($options['LENGTH']);
+                }
+                if ($length <= 255) {
+                    $cType = $ddlType == Table::TYPE_TEXT ? 'varchar' : 'varbinary';
+                    $cType = sprintf('%s(%d)', $cType, $length);
+                } elseif ($length > 255 && $length <= 65536) {
+                    $cType = $ddlType == Table::TYPE_TEXT ? 'text' : 'blob';
+                } elseif ($length > 65536 && $length <= 16777216) {
+                    $cType = $ddlType == Table::TYPE_TEXT ? 'mediumtext' : 'mediumblob';
+                } else {
+                    $cType = $ddlType == Table::TYPE_TEXT ? 'longtext' : 'longblob';
+                }
+                break;
+        }
+
+        if (array_key_exists('DEFAULT', $options)) {
+            $cDefault = $options['DEFAULT'];
+        }
+        if (array_key_exists('NULLABLE', $options)) {
+            $cNullable = (bool)$options['NULLABLE'];
+        }
+        if (!empty($options['IDENTITY']) || !empty($options['AUTO_INCREMENT'])) {
+            $cIdentity = true;
+        }
+
+        /*  For cases when tables created from createTableByDdl()
+         *  where default value can be quoted already.
+         *  We need to avoid "double-quoting" here
+         */
+        if ($cDefault !== null && strlen($cDefault)) {
+            $cDefault = $this->quote(str_replace("'", '', $cDefault));
+        }
+
+        // prepare default value string
+        if ($ddlType == Table::TYPE_TIMESTAMP) {
+            if ($cDefault === null) {
+                $cDefault = new Expression('NULL');
+            } elseif (Table::TIMESTAMP_INIT == $cDefault) {
+                $cDefault = new Expression('CURRENT_TIMESTAMP');
+            } elseif ($cDefault == Table::TIMESTAMP_UPDATE) {
+                $cDefault = new Expression('0 ON UPDATE CURRENT_TIMESTAMP');
+            } elseif ($cDefault == Table::TIMESTAMP_INIT_UPDATE) {
+                $cDefault = new Expression('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP');
+            } elseif ($cNullable && !$cDefault) {
+                $cDefault = new Expression('NULL');
+            } else {
+                $cDefault = false;
+            }
+        } elseif (is_null($cDefault) && $cNullable) {
+            $cDefault = new Expression('NULL');
+        }
+
+        if (empty($options['COMMENT'])) {
+            $comment = '';
+        } else {
+            $comment = $options['COMMENT'];
+        }
+
+        //set column position
+        $after = null;
+        if (!empty($options['AFTER'])) {
+            $after = $options['AFTER'];
+        }
+
+        if ($cDefault instanceof \Zend\Db\Sql\Expression) {
+            $cDefault = $cDefault->getExpression();
+        }
+
+        return sprintf(
+            '%s%s%s%s%s COMMENT %s %s',
+            $cType,
+            $cUnsigned ? ' UNSIGNED' : '',
+            $cNullable ? ' NULL' : ' NOT NULL',
+            $cDefault !== false ? ' default ' . $cDefault : '',
+            $cIdentity ? ' auto_increment' : '',
+            $this->quote($comment),
+            $after ? 'AFTER ' . $this->quoteIdentifier($after) : ''
+        );
+    }
+
+    /**
+     * Drop table from database
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return true
+     */
+    public function dropTable($tableName, $schemaName = null)
+    {
+        $table = $this->getPlatform()->quoteIdentifierChain($tableName);
+        $query = 'DROP TABLE IF EXISTS ' . $table;
+        $this->query($query);
+
+        return true;
+    }
+
+    /**
+     * Drop temporary table from database
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return boolean
+     */
+    public function dropTemporaryTable($tableName, $schemaName = null)
+    {
+        $table = $this->getPlatform()->quoteIdentifierChain($tableName);
+        $query = 'DROP TEMPORARY TABLE IF EXISTS ' . $table;
+        $this->query($query);
+
+        return true;
+    }
+
+    /**
+     * Truncate a table
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return $this
+     * @throws ErrorException
+     */
+    public function truncateTable($tableName, $schemaName = null)
+    {
+        if (!$this->isTableExists($tableName, $schemaName)) {
+            throw new ErrorException(sprintf('Table "%s" is not exists', $tableName));
+        }
+
+        $table = $this->quoteIdentifier($this->_getTableName($tableName, $schemaName));
+        $query = 'TRUNCATE TABLE ' . $table;
+        $this->query($query);
+
+        return $this;
+    }
+
+    /**
+     * Check is a table exists
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return bool
+     */
+    public function isTableExists($tableName, $schemaName = null)
+    {
+        return $this->showTableStatus($tableName, $schemaName) !== false;
+    }
+
+    /**
+     * Rename table
+     *
+     * @param string $oldTableName
+     * @param string $newTableName
+     * @param string $schemaName
+     * @return true
+     * @throws ErrorException
+     */
+    public function renameTable($oldTableName, $newTableName, $schemaName = null)
+    {
+        if (!$this->isTableExists($oldTableName, $schemaName)) {
+            throw new ErrorException(sprintf('Table "%s" is not exists', $oldTableName));
+        }
+        if ($this->isTableExists($newTableName, $schemaName)) {
+            throw new ErrorException(sprintf('Table "%s" already exists', $newTableName));
+        }
+
+        $oldTable = $this->_getTableName($oldTableName, $schemaName);
+        $newTable = $this->_getTableName($newTableName, $schemaName);
+
+        $query = sprintf('ALTER TABLE %s RENAME TO %s', $oldTable, $newTable);
+        $this->query($query);
+
+        return true;
+    }
+
+    /**
+     * Add new index to table name
+     *
+     * @param string $tableName
+     * @param string $indexName
+     * @param string|array $fields  the table column name or array of ones
+     * @param string $indexType     the index type
+     * @param string $schemaName
+     * @return StatementInterface
+     * @throws ErrorException
+     * @throws \Exception
+     */
+    public function addIndex(
+        $tableName,
+        $indexName,
+        $fields,
+        $indexType = AdapterInterface::INDEX_TYPE_INDEX,
+        $schemaName = null
+    ) {
+        $columns = $this->describeTable($tableName, $schemaName);
+        $keyList = $this->getIndexList($tableName, $schemaName);
+
+        $query = sprintf('ALTER TABLE %s', $this->getPlatform()->quoteIdentifierChain($tableName));
+        if (isset($keyList[strtoupper($indexName)])) {
+            if ($keyList[strtoupper($indexName)]['INDEX_TYPE'] == AdapterInterface::INDEX_TYPE_PRIMARY) {
+                $query .= ' DROP PRIMARY KEY,';
+            } else {
+                $query .= sprintf(' DROP INDEX %s,', $this->quoteIdentifier($indexName));
+            }
+        }
+
+        if (!is_array($fields)) {
+            $fields = array($fields);
+        }
+
+        $fieldSql = array();
+        foreach ($fields as $field) {
+            if (!isset($columns[$field])) {
+                $msg = sprintf(
+                    'There is no field "%s" that you are trying to create an index on "%s"',
+                    $field,
+                    $tableName
+                );
+                throw new ErrorException($msg);
+            }
+            $fieldSql[] = $this->quoteIdentifier($field);
+        }
+        $fieldSql = implode(',', $fieldSql);
+
+        switch (strtolower($indexType)) {
+            case AdapterInterface::INDEX_TYPE_PRIMARY:
+                $condition = 'PRIMARY KEY';
+                break;
+            case AdapterInterface::INDEX_TYPE_UNIQUE:
+                $condition = 'UNIQUE ' . $this->quoteIdentifier($indexName);
+                break;
+            case AdapterInterface::INDEX_TYPE_FULLTEXT:
+                $condition = 'FULLTEXT ' . $this->quoteIdentifier($indexName);
+                break;
+            default:
+                $condition = 'INDEX ' . $this->quoteIdentifier($indexName);
+                break;
+        }
+
+        $query .= sprintf(' ADD %s (%s)', $condition, $fieldSql);
+
+        $cycle = true;
+        while ($cycle === true) {
+            try {
+                $result = $this->rawQuery($query);
+                $cycle  = false;
+            } catch (\Exception $e) {
+                if (in_array(strtolower($indexType), array('primary', 'unique'))) {
+                    $match = array();
+                    if (preg_match('#SQLSTATE\[23000\]: [^:]+: 1062[^\']+\'([\d-\.]+)\'#', $e->getMessage(), $match)) {
+                        $ids = explode('-', $match[1]);
+                        $this->_removeDuplicateEntry($tableName, $fields, $ids);
+                        continue;
+                    }
+                }
+                throw $e;
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * Drop the index from table
+     *
+     * @param string $tableName
+     * @param string $keyName
+     * @param string $schemaName
+     * @return true|StatementInterface
+     */
+    public function dropIndex($tableName, $keyName, $schemaName = null)
+    {
+        $indexList = $this->getIndexList($tableName, $schemaName);
+        $keyName = strtoupper($keyName);
+        if (!isset($indexList[$keyName])) {
+            return true;
+        }
+
+        if ($keyName == 'PRIMARY') {
+            $cond = 'DROP PRIMARY KEY';
+        } else {
+            $cond = 'DROP KEY ' . $this->quoteIdentifier($indexList[$keyName]['KEY_NAME']);
+        }
+        $sql = sprintf(
+            'ALTER TABLE %s %s',
+            $this->getPlatform()->quoteIdentifierChain($tableName),
+            $cond
+        );
+
+        return $this->rawQuery($sql);
+    }
+
+    /**
+     * Add new Foreign Key to table
+     * If Foreign Key with same name is exist - it will be deleted
+     *
+     * @param string $fkName
+     * @param string $tableName
+     * @param string $columnName
+     * @param string $refTableName
+     * @param string $refColumnName
+     * @param string $onDelete
+     * @param string $onUpdate
+     * @param bool $purge            trying remove invalid data
+     * @param string $schemaName
+     * @param string $refSchemaName
+     * @return StatementInterface
+     */
+    public function addForeignKey(
+        $fkName,
+        $tableName,
+        $columnName,
+        $refTableName,
+        $refColumnName,
+        $onDelete = AdapterInterface::FK_ACTION_CASCADE,
+        $onUpdate = AdapterInterface::FK_ACTION_CASCADE,
+        $purge = false,
+        $schemaName = null,
+        $refSchemaName = null
+    ) {
+        $this->dropForeignKey($tableName, $fkName, $schemaName);
+
+        if ($purge) {
+            $this->purgeOrphanRecords($tableName, $columnName, $refTableName, $refColumnName, $onDelete);
+        }
+
+        $query = sprintf(
+            'ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)',
+            $this->getPlatform()->quoteIdentifierChain($tableName),
+            $this->quoteIdentifier($fkName),
+            $this->quoteIdentifier($columnName),
+            $this->getPlatform()->quoteIdentifierChain($refTableName),
+            $this->quoteIdentifier($refColumnName)
+        );
+
+        if ($onDelete !== null) {
+            $query .= ' ON DELETE ' . strtoupper($onDelete);
+        }
+        if ($onUpdate  !== null) {
+            $query .= ' ON UPDATE ' . strtoupper($onUpdate);
+        }
+
+        $result = $this->rawQuery($query);
+        return $result;
+    }
+
+    /**
+     * Run additional environment before setup
+     *
+     * @return $this
+     */
+    public function startSetup()
+    {
+        $this->rawQuery("SET SQL_MODE=''");
+        $this->rawQuery("SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0");
+        $this->rawQuery("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
+
+        return $this;
+    }
+
+    /**
+     * Run additional environment after setup
+     *
+     * @return $this
+     */
+    public function endSetup()
+    {
+        $this->rawQuery("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'')");
+        $this->rawQuery("SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS=0, 0, 1)");
+
+        return $this;
+    }
+
+    /**
+     * Build SQL statement for condition
+     *
+     * If $condition integer or string - exact value will be filtered ('eq' condition)
+     *
+     * If $condition is array is - one of the following structures is expected:
+     * - array("from" => $fromValue, "to" => $toValue)
+     * - array("eq" => $equalValue)
+     * - array("neq" => $notEqualValue)
+     * - array("like" => $likeValue)
+     * - array("in" => array($inValues))
+     * - array("nin" => array($notInValues))
+     * - array("notnull" => $valueIsNotNull)
+     * - array("null" => $valueIsNull)
+     * - array("gt" => $greaterValue)
+     * - array("lt" => $lessValue)
+     * - array("gteq" => $greaterOrEqualValue)
+     * - array("lteq" => $lessOrEqualValue)
+     * - array("finset" => $valueInSet)
+     * - array("regexp" => $regularExpression)
+     * - array("seq" => $stringValue)
+     * - array("sneq" => $stringValue)
+     *
+     * If non matched - sequential array is expected and OR conditions
+     * will be built using above mentioned structure
+     *
+     * @param string $fieldName
+     * @param integer|string|array $condition
+     * @return string
+     */
+    public function prepareSqlCondition($fieldName, $condition)
+    {
+        $conditionKeyMap = array(
+            'eq'            => "{{fieldName}} = ?",
+            'neq'           => "{{fieldName}} != ?",
+            'like'          => "{{fieldName}} LIKE ?",
+            'nlike'         => "{{fieldName}} NOT LIKE ?",
+            'in'            => "{{fieldName}} IN(?)",
+            'nin'           => "{{fieldName}} NOT IN(?)",
+            'is'            => "{{fieldName}} IS ?",
+            'notnull'       => "{{fieldName}} IS NOT NULL",
+            'null'          => "{{fieldName}} IS NULL",
+            'gt'            => "{{fieldName}} > ?",
+            'lt'            => "{{fieldName}} < ?",
+            'gteq'          => "{{fieldName}} >= ?",
+            'lteq'          => "{{fieldName}} <= ?",
+            'finset'        => "FIND_IN_SET(?, {{fieldName}})",
+            'regexp'        => "{{fieldName}} REGEXP ?",
+            'from'          => "{{fieldName}} >= ?",
+            'to'            => "{{fieldName}} <= ?",
+            'seq'           => null,
+            'sneq'          => null
+        );
+
+        $query = '';
+        if (is_array($condition)) {
+            if (isset($condition['field_expr'])) {
+                $fieldName = str_replace('#?', $this->quoteIdentifier($fieldName), $condition['field_expr']);
+                unset($condition['field_expr']);
+            }
+            $key = key(array_intersect_key($condition, $conditionKeyMap));
+
+            if (isset($condition['from']) || isset($condition['to'])) {
+                if (isset($condition['from'])) {
+                    $from  = $this->_prepareSqlDateCondition($condition, 'from');
+                    $query = $this->_prepareQuotedSqlCondition($conditionKeyMap['from'], $from, $fieldName);
+                }
+
+                if (isset($condition['to'])) {
+                    $query .= empty($query) ? '' : ' AND ';
+                    $to     = $this->_prepareSqlDateCondition($condition, 'to');
+                    $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
+                }
+            } elseif (array_key_exists($key, $conditionKeyMap)) {
+                $value = $condition[$key];
+                if (($key == 'seq') || ($key == 'sneq')) {
+                    $key = $this->_transformStringSqlCondition($key, $value);
+                }
+                $query = $this->_prepareQuotedSqlCondition($conditionKeyMap[$key], $value, $fieldName);
+            } else {
+                $queries = array();
+                foreach ($condition as $orCondition) {
+                    $queries[] = sprintf('(%s)', $this->prepareSqlCondition($fieldName, $orCondition));
+                }
+
+                $query = sprintf('(%s)', implode(' OR ', $queries));
+            }
+        } else {
+            $query = $this->_prepareQuotedSqlCondition($conditionKeyMap['eq'], (string)$condition, $fieldName);
+        }
+
+        return $query;
+    }
+
+    /**
+     * Prepare Sql condition
+     *
+     * @param  string $text Condition value
+     * @param  mixed $value
+     * @param  string $fieldName
+     * @return string
+     */
+    protected function _prepareQuotedSqlCondition($text, $value, $fieldName)
+    {
+        $sql = $this->quoteInto($text, $value);
+        $sql = str_replace('{{fieldName}}', $fieldName, $sql);
+        return $sql;
+    }
+
+    /**
+     * Transforms sql condition key 'seq' / 'sneq' that is used for comparing string values to its analog:
+     * - 'null' / 'notnull' for empty strings
+     * - 'eq' / 'neq' for non-empty strings
+     *
+     * @param string $conditionKey
+     * @param mixed $value
+     * @return string
+     */
+    protected function _transformStringSqlCondition($conditionKey, $value)
+    {
+        $value = (string) $value;
+        if ($value == '') {
+            return ($conditionKey == 'seq') ? 'null' : 'notnull';
+        } else {
+            return ($conditionKey == 'seq') ? 'eq' : 'neq';
+        }
+    }
+
+    /**
+     * Get Interval Unit SQL fragment
+     *
+     * @param int $interval
+     * @param string $unit
+     * @return string
+     * @throws ErrorException
+     */
+    protected function _getIntervalUnitSql($interval, $unit)
+    {
+        if (!isset($this->_intervalUnits[$unit])) {
+            throw new ErrorException(sprintf('Undefined interval unit "%s" specified', $unit));
+        }
+
+        return sprintf('INTERVAL %d %s', $interval, $this->_intervalUnits[$unit]);
+    }
+
+    /**
+     * Add time values (intervals) to a date value
+     *
+     * @see INTERVAL_* constants for $unit
+     *
+     * @param \Zend_Db_Expr|string $date   quoted field name or SQL statement
+     * @param int $interval
+     * @param string $unit
+     * @return \Zend_Db_Expr
+     */
+    public function getDateAddSql($date, $interval, $unit)
+    {
+        $expr = sprintf('DATE_ADD(%s, %s)', $date, $this->_getIntervalUnitSql($interval, $unit));
+        return new Expression($expr);
+    }
+
+    /**
+     * Subtract time values (intervals) to a date value
+     *
+     * @see INTERVAL_* constants for $expr
+     *
+     * @param \Zend_Db_Expr|string $date   quoted field name or SQL statement
+     * @param int|string $interval
+     * @param string $unit
+     * @return \Zend_Db_Expr
+     */
+    public function getDateSubSql($date, $interval, $unit)
+    {
+        $expr = sprintf('DATE_SUB(%s, %s)', $date, $this->_getIntervalUnitSql($interval, $unit));
+        return new Expression($expr);
+    }
+
+    /**
+     * Minus superfluous characters from hash.
+     *
+     * @param  string $hash
+     * @param  string $prefix
+     * @param  int $maxCharacters
+     * @return string
+     */
+    protected function _minusSuperfluous($hash, $prefix, $maxCharacters)
+    {
+         $diff        = strlen($hash) + strlen($prefix) -  $maxCharacters;
+         $superfluous = $diff / 2;
+         $odd         = $diff % 2;
+         $hash        = substr($hash, $superfluous, - ($superfluous + $odd));
+         return $hash;
+    }
+
+    /**
+     * Retrieve valid table name
+     * Check table name length and allowed symbols
+     *
+     * @param string $tableName
+     * @return string
+     */
+    public function getTableName($tableName)
+    {
+        $prefix = 't_';
+        if (strlen($tableName) > self::LENGTH_TABLE_NAME) {
+            $shortName = ExpressionConverter::shortName($tableName);
+            if (strlen($shortName) > self::LENGTH_TABLE_NAME) {
+                $hash = md5($tableName);
+                if (strlen($prefix.$hash) > self::LENGTH_TABLE_NAME) {
+                    $tableName = $this->_minusSuperfluous($hash, $prefix, self::LENGTH_TABLE_NAME);
+                } else {
+                    $tableName = $prefix . $hash;
+                }
+            } else {
+                $tableName = $shortName;
+            }
+        }
+
+        return $tableName;
+    }
+
+    /**
+     * Retrieve valid index name
+     * Check index name length and allowed symbols
+     *
+     * @param string $tableName
+     * @param string|string[] $fields  the columns list
+     * @param string $indexType
+     * @return string
+     */
+    public function getIndexName($tableName, $fields, $indexType = '')
+    {
+        if (is_array($fields)) {
+            $fields = implode('_', $fields);
+        }
+
+        switch (strtolower($indexType)) {
+            case AdapterInterface::INDEX_TYPE_UNIQUE:
+                $prefix = 'unq_';
+                $shortPrefix = 'u_';
+                break;
+            case AdapterInterface::INDEX_TYPE_FULLTEXT:
+                $prefix = 'fti_';
+                $shortPrefix = 'f_';
+                break;
+            case AdapterInterface::INDEX_TYPE_INDEX:
+            default:
+                $prefix = 'idx_';
+                $shortPrefix = 'i_';
+        }
+
+        $hash = $tableName . '_' . $fields;
+
+        if (strlen($hash) + strlen($prefix) > self::LENGTH_INDEX_NAME) {
+            $short = ExpressionConverter::shortName($prefix . $hash);
+            if (strlen($short) > self::LENGTH_INDEX_NAME) {
+                $hash = md5($hash);
+                if (strlen($hash) + strlen($shortPrefix) > self::LENGTH_INDEX_NAME) {
+                    $hash = $this->_minusSuperfluous($hash, $shortPrefix, self::LENGTH_INDEX_NAME);
+                }
+            } else {
+                $hash = $short;
+            }
+        } else {
+            $hash = $prefix . $hash;
+        }
+
+        return strtoupper($hash);
+    }
+
+    /**
+     * Retrieve valid foreign key name
+     * Check foreign key name length and allowed symbols
+     *
+     * @param string $priTableName
+     * @param string $priColumnName
+     * @param string $refTableName
+     * @param string $refColumnName
+     * @return string
+     */
+    public function getForeignKeyName($priTableName, $priColumnName, $refTableName, $refColumnName)
+    {
+        $prefix = 'fk_';
+        $hash = sprintf('%s_%s_%s_%s', $priTableName, $priColumnName, $refTableName, $refColumnName);
+        if (strlen($prefix.$hash) > self::LENGTH_FOREIGN_NAME) {
+            $short = ExpressionConverter::shortName($prefix . $hash);
+            if (strlen($short) > self::LENGTH_FOREIGN_NAME) {
+                $hash = md5($hash);
+                if (strlen($prefix.$hash) > self::LENGTH_FOREIGN_NAME) {
+                    $hash = $this->_minusSuperfluous($hash, $prefix, self::LENGTH_FOREIGN_NAME);
+                } else {
+                    $hash = $prefix . $hash;
+                }
+            } else {
+                $hash = $short;
+            }
+        } else {
+            $hash = $prefix . $hash;
+        }
+
+        return strtoupper($hash);
+    }
+
+    /**
+     * Stop updating indexes
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return $this
+     */
+    public function disableTableKeys($tableName, $schemaName = null)
+    {
+        $query     = sprintf(
+            'ALTER TABLE %s DISABLE KEYS',
+            $this->getPlatform()->quoteIdentifierChain($tableName)
+        );
+        $this->query($query);
+
+        return $this;
+    }
+
+    /**
+     * Re-create missing indexes
+     *
+     * @param string $tableName
+     * @param string $schemaName
+     * @return $this
+     */
+    public function enableTableKeys($tableName, $schemaName = null)
+    {
+        $tableName = $this->_getTableName($tableName, $schemaName);
+        $query     = sprintf(
+            'ALTER TABLE %s ENABLE KEYS',
+            $this->getPlatform()->quoteIdentifierChain($tableName)
+        );
+        $this->query($query);
+
+        return $this;
+    }
+
+    /**
+     * Calculate checksum for table or for group of tables
+     *
+     * @param array|string $tableNames array of tables names | table name
+     * @param string $schemaName schema name
+     * @return array
+     */
+    public function getTablesChecksum($tableNames, $schemaName = null)
+    {
+        $result     = array();
+        $tableNames = is_array($tableNames) ? $tableNames : array($tableNames);
+
+        foreach ($tableNames as $tableName) {
+            $query = 'CHECKSUM TABLE ' . $this->_getTableName($tableName, $schemaName);
+            $checkSumArray      = $this->fetchRow($query);
+            $result[$tableName] = $checkSumArray['Checksum'];
+        }
+
+        return $result;
+    }
+
+    /**
+     * Render SQL FOR UPDATE clause
+     *
+     * @param string $sql
+     * @return string
+     */
+    public function forUpdate($sql)
+    {
+        return sprintf('%s FOR UPDATE', $sql);
+    }
+
+    /**
+     * Prepare insert data
+     *
+     * @param mixed $row
+     * @param array $bind
+     * @return string
+     */
+    protected function _prepareInsertData($row, &$bind)
+    {
+        $row = (array)$row;
+        $line = array();
+        foreach ($row as $value) {
+            if ($value instanceof \Zend_Db_Expr) {
+                $line[] = $value->__toString();
+            } else {
+                $line[] = '?';
+                $bind[] = $value;
+            }
+        }
+        $line = implode(', ', $line);
+
+        return sprintf('(%s)', $line);
+    }
+
+    /**
+     * Return ddl type
+     *
+     * @param array $options
+     * @return string
+     */
+    protected function _getDdlType($options)
+    {
+        $ddlType = null;
+        if (isset($options['TYPE'])) {
+            $ddlType = $options['TYPE'];
+        } elseif (isset($options['COLUMN_TYPE'])) {
+            $ddlType = $options['COLUMN_TYPE'];
+        }
+
+        return $ddlType;
+    }
+
+    /**
+     * Return DDL action
+     *
+     * @param string $action
+     * @return string
+     */
+    protected function _getDdlAction($action)
+    {
+        switch ($action) {
+            case AdapterInterface::FK_ACTION_CASCADE:
+                return Table::ACTION_CASCADE;
+            case AdapterInterface::FK_ACTION_SET_NULL:
+                return Table::ACTION_SET_NULL;
+            case AdapterInterface::FK_ACTION_RESTRICT:
+                return Table::ACTION_RESTRICT;
+            default:
+                return Table::ACTION_NO_ACTION;
+        }
+    }
+
+    /**
+     * Prepare sql date condition
+     *
+     * @param array $condition
+     * @param string $key
+     * @return string
+     */
+    protected function _prepareSqlDateCondition($condition, $key)
+    {
+        if (empty($condition['date'])) {
+            if (empty($condition['datetime'])) {
+                $result = $condition[$key];
+            } else {
+                $result = $this->formatDate($condition[$key]);
+            }
+        } else {
+            $result = $this->formatDate($condition[$key]);
+        }
+
+        return $result;
+    }
+
+    /**
+     * Try to find installed primary key name, if not - formate new one.
+     *
+     * @param string $tableName Table name
+     * @param string $schemaName OPTIONAL
+     * @return string Primary Key name
+     */
+    public function getPrimaryKeyName($tableName, $schemaName = null)
+    {
+        $indexes = $this->getIndexList($tableName, $schemaName);
+        if (isset($indexes['PRIMARY'])) {
+            return $indexes['PRIMARY']['KEY_NAME'];
+        } else {
+            return 'PK_' . strtoupper($tableName);
+        }
+    }
+
+    /**
+     * Parse text size
+     * Returns max allowed size if value great it
+     *
+     * @param string|int $size
+     * @return int
+     */
+    protected function _parseTextSize($size)
+    {
+        $size = trim($size);
+        $last = strtolower(substr($size, -1));
+
+        switch ($last) {
+            case 'k':
+                $size = intval($size) * 1024;
+                break;
+            case 'm':
+                $size = intval($size) * 1024 * 1024;
+                break;
+            case 'g':
+                $size = intval($size) * 1024 * 1024 * 1024;
+                break;
+        }
+
+        if (empty($size)) {
+            return Table::DEFAULT_TEXT_SIZE;
+        }
+        if ($size >= Table::MAX_TEXT_SIZE) {
+            return Table::MAX_TEXT_SIZE;
+        }
+
+        return intval($size);
+    }
+
+    /**
+     * Converts fetched blob into raw binary PHP data.
+     * The MySQL drivers do it nice, no processing required.
+     *
+     * @param mixed $value
+     * @return mixed
+     */
+    public function decodeVarbinary($value)
+    {
+        return $value;
+    }
+
+    /**
+     * Create trigger
+     *
+     * @param \Magento\Framework\DB\Ddl\Trigger $trigger
+     * @throws ErrorException
+     * @return StatementInterface
+     */
+    public function createTrigger(\Magento\Framework\DB\Ddl\Trigger $trigger)
+    {
+        if (!$trigger->getStatements()) {
+            throw new ErrorException(sprintf(__('Trigger %s has not statements available'), $trigger->getName()));
+        }
+
+        $statements = implode("\n", $trigger->getStatements());
+
+        $sql = sprintf(
+            "CREATE TRIGGER %s %s %s ON %s FOR EACH ROW\nBEGIN\n%s\nEND",
+            $trigger->getName(),
+            $trigger->getTime(),
+            $trigger->getEvent(),
+            $trigger->getTable(),
+            $statements
+        );
+
+        return $this->query($sql);
+    }
+
+    /**
+     * Drop trigger from database
+     *
+     * @param string $triggerName
+     * @param string|null $schemaName
+     * @return bool
+     * @throws \InvalidArgumentException
+     */
+    public function dropTrigger($triggerName, $schemaName = null)
+    {
+        if (empty($triggerName)) {
+            throw new \InvalidArgumentException(__('Trigger name is not defined'));
+        }
+
+        $triggerName = ($schemaName ? $schemaName . '.' : '') . $triggerName;
+
+        $sql = 'DROP TRIGGER IF EXISTS ' . $this->quoteIdentifier($triggerName);
+        $this->query($sql);
+
+        return true;
+    }
+
+    /**
+     * Check if all transactions have been committed
+     *
+     * @return void
+     */
+    public function __destruct()
+    {
+        if ($this->_transactionLevel > 0) {
+            trigger_error('Some transactions have not been committed or rolled back', E_USER_ERROR);
+        }
+    }
+
+    /**
+     * Quotes an identifier.
+     *
+     */
+    public function quoteIdentifier($ident, $auto = false)
+    {
+        return $this->getPlatform()->quoteIdentifier($ident);
+    }
+
+    /**
+     * Safely quotes a value for an SQL statement.
+     *
+     * If an array is passed as the value, the array values are quoted
+     * and then returned as a comma-separated string.
+     *
+     * @param mixed $value The value to quote.
+     * @param mixed $type OPTIONAL the SQL datatype name, or constant, or null.
+     * @return mixed An SQL-safe quoted value (or string of separated values).
+     */
+    public function quote($value, $type = null)
+    {
+        return $this->getPlatform()->quoteValueList($value);
+    }
+
+    /**
+     * Deletes table rows based on a WHERE clause.
+     *
+     * @param  mixed $table The table to update.
+     * @param  mixed $where DELETE WHERE clause(s).
+     * @return int          The number of affected rows.
+     */
+    public function delete($table, $where = '')
+    {
+        $sql = new Sql($this);
+        $delete = $sql->delete($this->_getTableName($table));
+        $delete->where($where);
+
+        $sqlString = $sql->getSqlStringForSqlObject($delete);
+        $result = $this->query($sqlString);
+        return $result->count();
+    }
+
+    /**
+     * Updates table rows with specified data based on a WHERE clause.
+     *
+     * @param  mixed $table The table to update.
+     * @param  array $bind Column-value pairs.
+     * @param  mixed $where UPDATE WHERE clause(s).
+     * @return int          The number of affected rows.
+     */
+    public function update($table, array $bind, $where = '')
+    {
+        $sql = new Sql($this);
+        $update = $sql->update($this->_getTableName($table));
+        $update->where($where);
+        $update->set($bind);
+        $updateString = $sql->getSqlStringForSqlObject($update);
+        $result = $this->query($updateString);
+        return $result->count();
+    }
+
+    /**
+     * Inserts a table row with specified data.
+     *
+     * @param mixed $table The table to insert data into.
+     * @param array $bind Column-value pairs.
+     * @param boolean $onDuplicate
+     * @return int The number of affected rows.
+     */
+    public function insert($table, array $bind, $onDuplicate = false)
+    {
+        $sql = new Sql($this);
+        $insert = $sql->insert($this->_getTableName($table));
+        $insert->values($bind);
+
+        $sqlString = $sql->getSqlStringForSqlObject($insert);
+        if ($onDuplicate) {
+            $sqlString .= ' ON DUPLICATE KEY UPDATE ';
+            $parts = [];
+            foreach (array_keys($bind) as $filed) {
+                $parts[] = $this->quoteIdentifier($filed) . '=VALUES(' . $this->quoteIdentifier($filed) . ')';
+            }
+            $sqlString .= implode(', ', $parts);
+        }
+
+        $result = $this->query($sqlString);
+        return $result->count();
+    }
+}
diff --git a/setup/module/Magento/Framework/src/DB/Ddl/Table.php b/setup/module/Magento/Framework/src/DB/Ddl/Table.php
new file mode 100644
index 0000000000000000000000000000000000000000..f45c9b09e8ab64cc967628920c62a0ac9eda292b
--- /dev/null
+++ b/setup/module/Magento/Framework/src/DB/Ddl/Table.php
@@ -0,0 +1,685 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+
+/**
+ * Data Definition for table
+ *
+ * @author      Magento Core Team <core@magentocommerce.com>
+ */
+namespace Magento\Framework\DB\Ddl;
+
+use Magento\Framework\DB\Adapter\AdapterInterface;
+use Zend\Db\Exception\ErrorException;
+
+class Table
+{
+    /**
+     * Types of columns
+     */
+    const TYPE_BOOLEAN = 'boolean';
+
+    const TYPE_SMALLINT = 'smallint';
+
+    const TYPE_INTEGER = 'integer';
+
+    const TYPE_BIGINT = 'bigint';
+
+    const TYPE_FLOAT = 'float';
+
+    const TYPE_NUMERIC = 'numeric';
+
+    const TYPE_DECIMAL = 'decimal';
+
+    const TYPE_DATE = 'date';
+
+    const TYPE_TIMESTAMP = 'timestamp';
+
+    // Capable to support date-time from 1970 + auto-triggers in some RDBMS
+    const TYPE_DATETIME = 'datetime';
+
+    // Capable to support long date-time before 1970
+    const TYPE_TEXT = 'text';
+
+    const TYPE_BLOB = 'blob';
+
+    // Used for back compatibility, when query param can't use statement options
+    const TYPE_VARBINARY = 'varbinary';
+
+    // A real blob, stored as binary inside DB
+
+    /**
+     * Default and maximal TEXT and BLOB columns sizes we can support for different DB systems.
+     */
+    const DEFAULT_TEXT_SIZE = 1024;
+
+    const MAX_TEXT_SIZE = 2147483648;
+
+    const MAX_VARBINARY_SIZE = 2147483648;
+
+    /**
+     * Default values for timestampses - fill with current timestamp on inserting record, on changing and both cases
+     */
+    const TIMESTAMP_INIT_UPDATE = 'TIMESTAMP_INIT_UPDATE';
+
+    const TIMESTAMP_INIT = 'TIMESTAMP_INIT';
+
+    const TIMESTAMP_UPDATE = 'TIMESTAMP_UPDATE';
+
+    /**
+     * Actions used for foreign keys
+     */
+    const ACTION_CASCADE = 'CASCADE';
+
+    const ACTION_SET_NULL = 'SET NULL';
+
+    const ACTION_NO_ACTION = 'NO ACTION';
+
+    const ACTION_RESTRICT = 'RESTRICT';
+
+    const ACTION_SET_DEFAULT = 'SET DEFAULT';
+
+    /**
+     * Name of table
+     *
+     * @var string
+     */
+    protected $_tableName;
+
+    /**
+     * Schema name
+     *
+     * @var string
+     */
+    protected $_schemaName;
+
+    /**
+     * Comment for Table
+     *
+     * @var string
+     */
+    protected $_tableComment;
+
+    /**
+     * Column descriptions for a table
+     *
+     * Is an associative array keyed by the uppercase column name
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * COLUMN_NAME      => string; column name
+     * COLUMN_POSITION  => number; ordinal position of column in table
+     * DATA_TYPE        => string; constant datatype of column
+     * DEFAULT          => string; default expression of column, null if none
+     * NULLABLE         => boolean; true if column can have nulls
+     * LENGTH           => number; length of CHAR/VARCHAR/INT
+     * SCALE            => number; scale of NUMERIC/DECIMAL
+     * PRECISION        => number; precision of NUMERIC/DECIMAL
+     * UNSIGNED         => boolean; unsigned property of an integer type
+     * PRIMARY          => boolean; true if column is part of the primary key
+     * PRIMARY_POSITION => integer; position of column in primary key
+     * IDENTITY         => integer; true if column is auto-generated with unique values
+     * COMMENT          => string; column description
+     *
+     * @var array
+     */
+    protected $_columns = array();
+
+    /**
+     * Index descriptions for a table
+     *
+     * Is an associative array keyed by the uppercase index name
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * INDEX_NAME       => string; index name
+     * COLUMNS          => array; array of index columns
+     * TYPE             => string; Optional special index type
+     *
+     * COLUMNS is an associative array keyed by the uppercase column name
+     * The value of each COLUMNS array element is an associative array
+     * with the following keys:
+     *
+     * NAME             => string; The column name
+     * SIZE             => int|null; Length of index column (always null if index is unique)
+     * POSITION         => int; Position in index
+     *
+     * @var array
+     */
+    protected $_indexes = array();
+
+    /**
+     * Foreign key descriptions for a table
+     *
+     * Is an associative array keyed by the uppercase foreign key name
+     * The value of each array element is an associative array
+     * with the following keys:
+     *
+     * FK_NAME          => string; The foreign key name
+     * COLUMN_NAME      => string; The column name in table
+     * REF_TABLE_NAME   => string; Reference table name
+     * REF_COLUMN_NAME  => string; Reference table column name
+     * ON_DELETE        => string; Integrity Actions, default NO ACTION
+     * ON_UPDATE        => string; Integrity Actions, default NO ACTION
+     *
+     * Valid Integrity Actions:
+     * CASCADE | SET NULL | NONE | RESTRICT | SET DEFAULT
+     *
+     * @var array
+     */
+    protected $_foreignKeys = array();
+
+    /**
+     * Additional table options
+     *
+     * @var array
+     */
+    protected $_options = array('type' => 'INNODB', 'charset' => 'utf8', 'collate' => 'utf8_general_ci');
+
+    /**
+     * Set table name
+     *
+     * @param string $name
+     * @return $this
+     */
+    public function setName($name)
+    {
+        $this->_tableName = $name;
+        if ($this->_tableComment === null) {
+            $this->_tableComment = $name;
+        }
+        return $this;
+    }
+
+    /**
+     * Set schema name
+     *
+     * @param string $name
+     * @return $this
+     */
+    public function setSchema($name)
+    {
+        $this->_schemaName = $name;
+        return $this;
+    }
+
+    /**
+     * Set comment for table
+     *
+     * @param string $comment
+     * @return $this
+     */
+    public function setComment($comment)
+    {
+        $this->_tableComment = $comment;
+        return $this;
+    }
+
+    /**
+     * Retrieve name of table
+     *
+     * @return string
+     * @throws ErrorException
+     */
+    public function getName()
+    {
+        if (is_null($this->_tableName)) {
+            throw new ErrorException('Table name is not defined');
+        }
+        return $this->_tableName;
+    }
+
+    /**
+     * Get schema name
+     *
+     * @return string|null
+     */
+    public function getSchema()
+    {
+        return $this->_schemaName;
+    }
+
+    /**
+     * Return comment for table
+     *
+     * @return string
+     */
+    public function getComment()
+    {
+        return $this->_tableComment;
+    }
+
+    /**
+     * Adds column to table.
+     *
+     * $options contains additional options for columns. Supported values are:
+     * - 'unsigned', for number types only. Default: FALSE.
+     * - 'precision', for numeric and decimal only. Default: taken from $size, if not set there then 0.
+     * - 'scale', for numeric and decimal only. Default: taken from $size, if not set there then 10.
+     * - 'default'. Default: not set.
+     * - 'nullable'. Default: TRUE.
+     * - 'primary', add column to primary index. Default: do not add.
+     * - 'primary_position', only for column in primary index. Default: count of primary columns + 1.
+     * - 'identity' or 'auto_increment'. Default: FALSE.
+     *
+     * @param string $name the column name
+     * @param string $type the column data type
+     * @param string|int|array $size the column length
+     * @param array $options array of additional options
+     * @param string $comment column description
+     * @return $this
+     * @throws \Zend\Db\Exception\ExceptionInterface
+     */
+    public function addColumn($name, $type, $size = null, $options = array(), $comment = null)
+    {
+        $position = count($this->_columns);
+        $default = false;
+        $nullable = true;
+        $length = null;
+        $scale = null;
+        $precision = null;
+        $unsigned = false;
+        $primary = false;
+        $primaryPosition = 0;
+        $identity = false;
+
+        // Prepare different properties
+        switch ($type) {
+            case self::TYPE_BOOLEAN:
+                break;
+
+            case self::TYPE_SMALLINT:
+            case self::TYPE_INTEGER:
+            case self::TYPE_BIGINT:
+                if (!empty($options['unsigned'])) {
+                    $unsigned = true;
+                }
+
+                break;
+
+            case self::TYPE_FLOAT:
+                if (!empty($options['unsigned'])) {
+                    $unsigned = true;
+                }
+                break;
+
+            case self::TYPE_DECIMAL:
+            case self::TYPE_NUMERIC:
+                $match = array();
+                $scale = 10;
+                $precision = 0;
+                // parse size value
+                if (is_array($size)) {
+                    if (count($size) == 2) {
+                        $size = array_values($size);
+                        $precision = $size[0];
+                        $scale = $size[1];
+                    }
+                } elseif (preg_match('#^(\d+),(\d+)$#', $size, $match)) {
+                    $precision = $match[1];
+                    $scale = $match[2];
+                }
+                // check options
+                if (isset($options['precision'])) {
+                    $precision = $options['precision'];
+                }
+
+                if (isset($options['scale'])) {
+                    $scale = $options['scale'];
+                }
+
+                if (!empty($options['unsigned'])) {
+                    $unsigned = true;
+                }
+                break;
+            case self::TYPE_DATE:
+            case self::TYPE_DATETIME:
+            case self::TYPE_TIMESTAMP:
+                break;
+            case self::TYPE_TEXT:
+            case self::TYPE_BLOB:
+            case self::TYPE_VARBINARY:
+                $length = $size;
+                break;
+            default:
+                throw new ErrorException('Invalid column data type "' . $type . '"');
+        }
+
+        if (array_key_exists('default', $options)) {
+            $default = $options['default'];
+        }
+        if (array_key_exists('nullable', $options)) {
+            $nullable = (bool)$options['nullable'];
+        }
+        if (!empty($options['primary'])) {
+            $primary = true;
+            if (isset($options['primary_position'])) {
+                $primaryPosition = (int)$options['primary_position'];
+            } else {
+                $primaryPosition = 0;
+                foreach ($this->_columns as $v) {
+                    if ($v['PRIMARY']) {
+                        $primaryPosition++;
+                    }
+                }
+            }
+        }
+        if (!empty($options['identity']) || !empty($options['auto_increment'])) {
+            $identity = true;
+        }
+
+        if ($comment === null) {
+            $comment = ucfirst($name);
+        }
+
+        $upperName = strtoupper($name);
+        $this->_columns[$upperName] = array(
+            'COLUMN_NAME' => $name,
+            'COLUMN_TYPE' => $type,
+            'COLUMN_POSITION' => $position,
+            'DATA_TYPE' => $type,
+            'DEFAULT' => $default,
+            'NULLABLE' => $nullable,
+            'LENGTH' => $length,
+            'SCALE' => $scale,
+            'PRECISION' => $precision,
+            'UNSIGNED' => $unsigned,
+            'PRIMARY' => $primary,
+            'PRIMARY_POSITION' => $primaryPosition,
+            'IDENTITY' => $identity,
+            'COMMENT' => $comment
+        );
+
+        return $this;
+    }
+
+    /**
+     * Add Foreign Key to table
+     *
+     * @param string $fkName        the foreign key name
+     * @param string $column        the foreign key column name
+     * @param string $refTable      the reference table name
+     * @param string $refColumn     the reference table column name
+     * @param string $onDelete      the action on delete row
+     * @param string $onUpdate      the action on update
+     * @return $this
+     * @throws ErrorException
+     */
+    public function addForeignKey($fkName, $column, $refTable, $refColumn, $onDelete = null, $onUpdate = null)
+    {
+        $upperName = strtoupper($fkName);
+
+        // validate column name
+        if (!isset($this->_columns[strtoupper($column)])) {
+            throw new ErrorException('Undefined column "' . $column . '"');
+        }
+
+        switch ($onDelete) {
+            case self::ACTION_CASCADE:
+            case self::ACTION_RESTRICT:
+            case self::ACTION_SET_DEFAULT:
+            case self::ACTION_SET_NULL:
+                break;
+            default:
+                $onDelete = self::ACTION_NO_ACTION;
+        }
+
+        switch ($onUpdate) {
+            case self::ACTION_CASCADE:
+            case self::ACTION_RESTRICT:
+            case self::ACTION_SET_DEFAULT:
+            case self::ACTION_SET_NULL:
+                break;
+            default:
+                $onUpdate = self::ACTION_NO_ACTION;
+        }
+
+        $this->_foreignKeys[$upperName] = array(
+            'FK_NAME' => $fkName,
+            'COLUMN_NAME' => $column,
+            'REF_TABLE_NAME' => $refTable,
+            'REF_COLUMN_NAME' => $refColumn,
+            'ON_DELETE' => $onDelete,
+            'ON_UPDATE' => $onUpdate
+        );
+
+        return $this;
+    }
+
+    /**
+     * Add index to table
+     *
+     * @param string $indexName the index name
+     * @param array|string $fields array of columns or column string
+     * @param array $options array of additional options
+     * @return $this
+     * @throws ErrorException
+     */
+    public function addIndex($indexName, $fields, $options = array())
+    {
+        $idxType = AdapterInterface::INDEX_TYPE_INDEX;
+        $position = 0;
+        $columns = array();
+        if (!is_array($fields)) {
+            $fields = array($fields);
+        }
+
+        foreach ($fields as $columnData) {
+            $columnSize = null;
+            $columnPos = $position;
+            if (is_string($columnData)) {
+                $columnName = $columnData;
+            } elseif (is_array($columnData)) {
+                if (!isset($columnData['name'])) {
+                    throw new ErrorException('Invalid index column data');
+                }
+
+                $columnName = $columnData['name'];
+                if (!empty($columnData['size'])) {
+                    $columnSize = (int)$columnData['size'];
+                }
+                if (!empty($columnData['position'])) {
+                    $columnPos = (int)$columnData['position'];
+                }
+            } else {
+                continue;
+            }
+
+            $columns[strtoupper(
+                $columnName
+            )] = array(
+                'NAME' => $columnName,
+                'SIZE' => $columnSize,
+                'POSITION' => $columnPos
+            );
+
+            $position++;
+        }
+
+        if (empty($columns)) {
+            throw new ErrorException('Columns for index are not defined');
+        }
+
+        if (!empty($options['type'])) {
+            $idxType = $options['type'];
+        }
+
+        $this->_indexes[strtoupper(
+            $indexName
+        )] = array(
+            'INDEX_NAME' => $indexName,
+            'COLUMNS' => $this->normalizeIndexColumnPosition($columns),
+            'TYPE' => $idxType
+        );
+
+        return $this;
+    }
+
+    /**
+     * Retrieve array of table columns
+     *
+     * @param bool $normalized
+     * @see $this->_columns
+     * @return array
+     */
+    public function getColumns($normalized = true)
+    {
+        if ($normalized) {
+            return $this->normalizeColumnPosition($this->_columns);
+        }
+        return $this->_columns;
+    }
+
+    /**
+     * Set column, formatted according to DDL Table format, into columns structure
+     *
+     * @param array $column
+     * @see $this->_columns
+     * @return $this
+     */
+    public function setColumn($column)
+    {
+        $upperName = strtoupper($column['COLUMN_NAME']);
+        $this->_columns[$upperName] = $column;
+        return $this;
+    }
+
+    /**
+     * Retrieve array of table indexes
+     *
+     * @see $this->_indexes
+     * @return array
+     */
+    public function getIndexes()
+    {
+        return $this->_indexes;
+    }
+
+    /**
+     * Retrieve array of table foreign keys
+     *
+     * @see $this->_foreignKeys
+     * @return array
+     */
+    public function getForeignKeys()
+    {
+        return $this->_foreignKeys;
+    }
+
+    /**
+     * Set table option
+     *
+     * @param string $key
+     * @param string $value
+     * @return $this
+     */
+    public function setOption($key, $value)
+    {
+        $this->_options[$key] = $value;
+        return $this;
+    }
+
+    /**
+     * Retrieve table option value by option name
+     * Return null if option does not exits
+     *
+     * @param string $key
+     * @return null|string
+     */
+    public function getOption($key)
+    {
+        if (!isset($this->_options[$key])) {
+            return null;
+        }
+        return $this->_options[$key];
+    }
+
+    /**
+     * Retrieve array of table options
+     *
+     * @return array
+     */
+    public function getOptions()
+    {
+        return $this->_options;
+    }
+
+    /**
+     * Index column position comparison function
+     *
+     * @param array $a
+     * @param array $b
+     * @return int
+     */
+    protected function sortIndexColumnPosition($a, $b)
+    {
+        return $a['POSITION'] - $b['POSITION'];
+    }
+
+    /**
+     * table column position comparison function
+     *
+     * @param array $a
+     * @param array $b
+     * @return int
+     */
+    protected function sortColumnPosition($a, $b)
+    {
+        return $a['COLUMN_POSITION'] - $b['COLUMN_POSITION'];
+    }
+
+    /**
+     * Normalize positon of index columns array
+     *
+     * @param array $columns
+     * @return array
+     */
+    protected function normalizeIndexColumnPosition($columns)
+    {
+        uasort($columns, array($this, 'sortIndexColumnPosition'));
+        $position = 0;
+        foreach (array_keys($columns) as $columnId) {
+            $columns[$columnId]['POSITION'] = $position;
+            $position++;
+        }
+        return $columns;
+    }
+
+    /**
+     * Normalize position of table columns array
+     *
+     * @param array $columns
+     * @return array
+     */
+    protected function normalizeColumnPosition($columns)
+    {
+        uasort($columns, array($this, 'sortColumnPosition'));
+        $position = 0;
+        foreach (array_keys($columns) as $columnId) {
+            $columns[$columnId]['COLUMN_POSITION'] = $position;
+            $position++;
+        }
+        return $columns;
+    }
+}
diff --git a/setup/module/Magento/Framework/src/DB/Ddl/Trigger.php b/setup/module/Magento/Framework/src/DB/Ddl/Trigger.php
new file mode 100644
index 0000000000000000000000000000000000000000..828345793e3c4b2682b38139eaa7ae9144ae6247
--- /dev/null
+++ b/setup/module/Magento/Framework/src/DB/Ddl/Trigger.php
@@ -0,0 +1,271 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Framework\DB\Ddl;
+
+use Zend\Db\Exception\ErrorException;
+
+class Trigger
+{
+    /**#@+
+     * Trigger times
+     */
+    const TIME_BEFORE = 'BEFORE';
+
+    const TIME_AFTER = 'AFTER';
+    /**#@-*/
+
+    /**#@+
+     * Trigger events
+     */
+    const EVENT_INSERT = 'INSERT';
+
+    const EVENT_UPDATE = 'UPDATE';
+
+    const EVENT_DELETE = 'DELETE';
+
+    /**#@-*/
+
+    /**
+     * List of times available for trigger
+     *
+     * @var array
+     */
+    protected static $listOfTimes = array(self::TIME_BEFORE, self::TIME_AFTER);
+
+    /**
+     * List of events available for trigger
+     *
+     * @var array
+     */
+    protected static $listOfEvents = array(self::EVENT_INSERT, self::EVENT_UPDATE, self::EVENT_DELETE);
+
+    /**
+     * Name of trigger
+     *
+     * @var string
+     */
+    protected $name;
+
+    /**
+     * Time of trigger
+     *
+     * @var string
+     */
+    protected $time;
+
+    /**
+     * Time of trigger
+     *
+     * @var string
+     */
+    protected $event;
+
+    /**
+     * Table name
+     *
+     * @var string
+     */
+    protected $tableName;
+
+    /**
+     * List of statements for trigger body
+     *
+     * @var array
+     */
+    protected $statements = array();
+
+    /**
+     * Set trigger name
+     *
+     * @param string $name
+     * @throws \InvalidArgumentException
+     * @return Trigger
+     */
+    public function setName($name)
+    {
+        if (!is_string($name)) {
+            throw new \InvalidArgumentException(__('Trigger name should be a string'));
+        }
+
+        $this->name = strtolower($name);
+        return $this;
+    }
+
+    /**
+     * Retrieve name of trigger
+     *
+     * @throws ErrorException
+     * @return string
+     */
+    public function getName()
+    {
+        if (empty($this->name)) {
+            throw new ErrorException(__('Trigger name is not defined'));
+        }
+        return $this->name;
+    }
+
+    /**
+     * Set trigger time
+     *
+     * @param string $time
+     * @throws \InvalidArgumentException
+     * @return Trigger
+     */
+    public function setTime($time)
+    {
+        if (in_array($time, self::$listOfTimes)) {
+            $this->time = strtoupper($time);
+        } else {
+            throw new \InvalidArgumentException(__('Trigger unsupported time type'));
+        }
+        return $this;
+    }
+
+    /**
+     * Retrieve time of trigger
+     *
+     * @throws ErrorException
+     * @return string
+     */
+    public function getTime()
+    {
+        if (is_null($this->time)) {
+            throw new ErrorException(__('Trigger time is not defined'));
+        }
+        return $this->time;
+    }
+
+    /**
+     * Set trigger event
+     *
+     * @param string $event
+     * @throws \InvalidArgumentException
+     * @return Trigger
+     */
+    public function setEvent($event)
+    {
+        if (in_array($event, self::$listOfEvents)) {
+            $this->event = strtoupper($event);
+        } else {
+            throw new \InvalidArgumentException(__('Trigger unsupported event type'));
+        }
+        return $this;
+    }
+
+    /**
+     * Retrieve event of trigger
+     *
+     * @throws ErrorException
+     * @return string
+     */
+    public function getEvent()
+    {
+        if (is_null($this->event)) {
+            throw new ErrorException(__('Trigger event is not defined'));
+        }
+        return $this->event;
+    }
+
+    /**
+     * Set table name
+     *
+     * @param string $name
+     * @throws \InvalidArgumentException
+     * @return Trigger
+     */
+    public function setTable($name)
+    {
+        if (!is_string($name)) {
+            throw new \InvalidArgumentException(__('Trigger table name should be a string'));
+        }
+        $this->tableName = strtolower($name);
+        return $this;
+    }
+
+    /**
+     * Retrieve table name
+     *
+     * @throws ErrorException
+     * @return string
+     */
+    public function getTable()
+    {
+        if (empty($this->tableName)) {
+            throw new ErrorException(__('Trigger table name is not defined'));
+        }
+        return $this->tableName;
+    }
+
+    /**
+     * Add statement to trigger
+     *
+     * @param string $statement
+     * @throws \InvalidArgumentException
+     * @return Trigger
+     */
+    public function addStatement($statement)
+    {
+        if (!is_string($statement)) {
+            throw new \InvalidArgumentException(__('Trigger statement should be a string'));
+        }
+
+        $statement = trim($statement);
+        $statement = rtrim($statement, ';') . ';';
+
+        $this->statements[] = $statement;
+
+        return $this;
+    }
+
+    /**
+     * Retrieve list of statements of trigger
+     *
+     * @return array
+     */
+    public function getStatements()
+    {
+        return $this->statements;
+    }
+
+    /**
+     * Retrieve list of times available for trigger
+     *
+     * @return array
+     */
+    public static function getListOfTimes()
+    {
+        return self::$listOfTimes;
+    }
+
+    /**
+     * Retrieve list of events available for trigger
+     *
+     * @return array
+     */
+    public static function getListOfEvents()
+    {
+        return self::$listOfEvents;
+    }
+}
diff --git a/setup/module/Magento/Framework/src/DB/ExpressionConverter.php b/setup/module/Magento/Framework/src/DB/ExpressionConverter.php
new file mode 100644
index 0000000000000000000000000000000000000000..b0dffbb5cf0cbae51f78b7e7a402781c8f78ddd0
--- /dev/null
+++ b/setup/module/Magento/Framework/src/DB/ExpressionConverter.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Framework\DB;
+
+class ExpressionConverter
+{
+    /**
+     * Dictionary for generate short name
+     *
+     * @var array
+     */
+    protected static $_translateMap = array(
+        'address'       => 'addr',
+        'admin'         => 'adm',
+        'attribute'     => 'attr',
+        'enterprise'    => 'ent',
+        'catalog'       => 'cat',
+        'category'      => 'ctgr',
+        'customer'      => 'cstr',
+        'notification'  => 'ntfc',
+        'product'       => 'prd',
+        'session'       => 'sess',
+        'user'          => 'usr',
+        'entity'        => 'entt',
+        'datetime'      => 'dtime',
+        'decimal'       => 'dec',
+        'varchar'       => 'vchr',
+        'index'         => 'idx',
+        'compare'       => 'cmp',
+        'bundle'        => 'bndl',
+        'option'        => 'opt',
+        'gallery'       => 'glr',
+        'media'         => 'mda',
+        'value'         => 'val',
+        'link'          => 'lnk',
+        'title'         => 'ttl',
+        'super'         => 'spr',
+        'label'         => 'lbl',
+        'website'       => 'ws',
+        'aggregat'      => 'aggr',
+        'minimal'       => 'min',
+        'inventory'     => 'inv',
+        'status'        => 'sts',
+        'agreement'     => 'agrt',
+        'layout'        => 'lyt',
+        'resource'      => 'res',
+        'directory'     => 'dir',
+        'downloadable'  => 'dl',
+        'element'       => 'elm',
+        'fieldset'      => 'fset',
+        'checkout'      => 'chkt',
+        'newsletter'    => 'nlttr',
+        'shipping'      => 'shpp',
+        'calculation'   => 'calc',
+        'search'        => 'srch',
+        'query'         => 'qr'
+    );
+
+    /**
+     * Convert name using dictionary
+     *
+     * @param string $name
+     * @return string
+     */
+    public static function shortName($name)
+    {
+        return strtr($name, self::$_translateMap);
+    }
+
+    /**
+     * Add or replace translate to dictionary
+     *
+     * @param string $from
+     * @param string $to
+     * @return void
+     */
+    public static function addTranslate($from, $to)
+    {
+        self::$_translateMap[$from] = $to;
+    }
+}
diff --git a/setup/module/Magento/Framework/src/Math/Random.php b/setup/module/Magento/Framework/src/Math/Random.php
new file mode 100644
index 0000000000000000000000000000000000000000..ff025bee9d75939c273d1780db156b017fc3a225
--- /dev/null
+++ b/setup/module/Magento/Framework/src/Math/Random.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Framework\Math;
+
+/**
+ * Random data generator
+ */
+class Random
+{
+    /**#@+
+     * Frequently used character classes
+     */
+    const CHARS_LOWERS = 'abcdefghijklmnopqrstuvwxyz';
+
+    const CHARS_UPPERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+
+    const CHARS_DIGITS = '0123456789';
+
+    /**#@-*/
+
+    /**
+     * Get random string
+     *
+     * @param int         $length
+     * @param null|string $chars
+     * @return string
+     */
+    public function getRandomString($length, $chars = null)
+    {
+        $str = '';
+        if (null === $chars) {
+            $chars = self::CHARS_LOWERS . self::CHARS_UPPERS . self::CHARS_DIGITS;
+        }
+
+        if (function_exists('openssl_random_pseudo_bytes')) {
+            // use openssl lib if it is installed
+            for ($i = 0, $lc = strlen($chars) - 1; $i < $length; $i++) {
+                $bytes = openssl_random_pseudo_bytes(PHP_INT_SIZE);
+                $hex = bin2hex($bytes); // hex() doubles the length of the string
+                $rand = abs(hexdec($hex) % $lc); // random integer from 0 to $lc
+                $str .= $chars[$rand]; // random character in $chars
+            }
+        } elseif ($fp = @fopen('/dev/urandom', 'rb')) {
+            // attempt to use /dev/urandom if it exists but openssl isn't available
+            for ($i = 0, $lc = strlen($chars) - 1; $i < $length; $i++) {
+                $bytes = @fread($fp, PHP_INT_SIZE);
+                $hex = bin2hex($bytes); // hex() doubles the length of the string
+                $rand = abs(hexdec($hex) % $lc); // random integer from 0 to $lc
+                $str .= $chars[$rand]; // random character in $chars
+            }
+            fclose($fp);
+        } else {
+            // fallback to mt_rand() if all else fails
+            mt_srand(10000000 * (double)microtime());
+            for ($i = 0, $lc = strlen($chars) - 1; $i < $length; $i++) {
+                $rand = mt_rand(0, $lc); // random integer from 0 to $lc
+                $str .= $chars[$rand]; // random character in $chars
+            }
+        }
+
+        return $str;
+    }
+}
diff --git a/setup/module/Magento/Locale/Module.php b/setup/module/Magento/Locale/Module.php
new file mode 100644
index 0000000000000000000000000000000000000000..d7a8c7b94307b5a69387cb45afc933d9ca1e800d
--- /dev/null
+++ b/setup/module/Magento/Locale/Module.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale;
+
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+
+class Module implements AutoloaderProviderInterface
+{
+    /**
+     * @return array
+     */
+    public function getAutoloaderConfig()
+    {
+        return [
+            'Zend\Loader\StandardAutoloader' => [
+                'namespaces' => [
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ],
+            ],
+        ];
+    }
+}
diff --git a/setup/module/Magento/Locale/src/Data/Country.php b/setup/module/Magento/Locale/src/Data/Country.php
new file mode 100644
index 0000000000000000000000000000000000000000..12c108028d471e2c548de6841b3afdcdcd5ff31a
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Data/Country.php
@@ -0,0 +1,308 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale\Data;
+
+class Country implements ListInterface
+{
+    /**
+     * @var array
+     */
+    protected $data = [
+        'AD' => 'Andorra',
+        'AE' => 'United Arab Emirates',
+        'AF' => 'Afghanistan',
+        'AG' => 'Antigua and Barbuda',
+        'AI' => 'Anguilla',
+        'AL' => 'Albania',
+        'AM' => 'Armenia',
+        'AN' => 'Netherlands Antilles',
+        'AO' => 'Angola',
+        'AQ' => 'Antarctica',
+        'AR' => 'Argentina',
+        'AS' => 'American Samoa',
+        'AT' => 'Austria',
+        'AU' => 'Australia',
+        'AW' => 'Aruba',
+        'AX' => 'Ã…land Islands',
+        'AZ' => 'Azerbaijan',
+        'BA' => 'Bosnia and Herzegovina',
+        'BB' => 'Barbados',
+        'BD' => 'Bangladesh',
+        'BE' => 'Belgium',
+        'BF' => 'Burkina Faso',
+        'BG' => 'Bulgaria',
+        'BH' => 'Bahrain',
+        'BI' => 'Burundi',
+        'BJ' => 'Benin',
+        'BL' => 'Saint Barthélemy',
+        'BM' => 'Bermuda',
+        'BN' => 'Brunei',
+        'BO' => 'Bolivia',
+        'BQ' => 'British Antarctic Territory',
+        'BR' => 'Brazil',
+        'BS' => 'Bahamas',
+        'BT' => 'Bhutan',
+        'BV' => 'Bouvet Island',
+        'BW' => 'Botswana',
+        'BY' => 'Belarus',
+        'BZ' => 'Belize',
+        'CA' => 'Canada',
+        'CC' => 'Cocos [Keeling] Islands',
+        'CD' => 'Congo - Kinshasa',
+        'CF' => 'Central African Republic',
+        'CG' => 'Congo - Brazzaville',
+        'CH' => 'Switzerland',
+        'CI' => 'Côte d’Ivoire',
+        'CK' => 'Cook Islands',
+        'CL' => 'Chile',
+        'CM' => 'Cameroon',
+        'CN' => 'China',
+        'CO' => 'Colombia',
+        'CR' => 'Costa Rica',
+        'CS' => 'Serbia and Montenegro',
+        'CT' => 'Canton and Enderbury Islands',
+        'CU' => 'Cuba',
+        'CV' => 'Cape Verde',
+        'CX' => 'Christmas Island',
+        'CY' => 'Cyprus',
+        'CZ' => 'Czech Republic',
+        'DD' => 'East Germany',
+        'DE' => 'Germany',
+        'DJ' => 'Djibouti',
+        'DK' => 'Denmark',
+        'DM' => 'Dominica',
+        'DO' => 'Dominican Republic',
+        'DZ' => 'Algeria',
+        'EC' => 'Ecuador',
+        'EE' => 'Estonia',
+        'EG' => 'Egypt',
+        'EH' => 'Western Sahara',
+        'ER' => 'Eritrea',
+        'ES' => 'Spain',
+        'ET' => 'Ethiopia',
+        'FI' => 'Finland',
+        'FJ' => 'Fiji',
+        'FK' => 'Falkland Islands',
+        'FM' => 'Micronesia',
+        'FO' => 'Faroe Islands',
+        'FQ' => 'French Southern and Antarctic Territories',
+        'FR' => 'France',
+        'FX' => 'Metropolitan France',
+        'GA' => 'Gabon',
+        'GB' => 'United Kingdom',
+        'GD' => 'Grenada',
+        'GE' => 'Georgia',
+        'GF' => 'French Guiana',
+        'GG' => 'Guernsey',
+        'GH' => 'Ghana',
+        'GI' => 'Gibraltar',
+        'GL' => 'Greenland',
+        'GM' => 'Gambia',
+        'GN' => 'Guinea',
+        'GP' => 'Guadeloupe',
+        'GQ' => 'Equatorial Guinea',
+        'GR' => 'Greece',
+        'GS' => 'South Georgia and the South Sandwich Islands',
+        'GT' => 'Guatemala',
+        'GU' => 'Guam',
+        'GW' => 'Guinea-Bissau',
+        'GY' => 'Guyana',
+        'HK' => 'Hong Kong SAR China',
+        'HM' => 'Heard Island and McDonald Islands',
+        'HN' => 'Honduras',
+        'HR' => 'Croatia',
+        'HT' => 'Haiti',
+        'HU' => 'Hungary',
+        'ID' => 'Indonesia',
+        'IE' => 'Ireland',
+        'IL' => 'Israel',
+        'IM' => 'Isle of Man',
+        'IN' => 'India',
+        'IO' => 'British Indian Ocean Territory',
+        'IQ' => 'Iraq',
+        'IR' => 'Iran',
+        'IS' => 'Iceland',
+        'IT' => 'Italy',
+        'JE' => 'Jersey',
+        'JM' => 'Jamaica',
+        'JO' => 'Jordan',
+        'JP' => 'Japan',
+        'JT' => 'Johnston Island',
+        'KE' => 'Kenya',
+        'KG' => 'Kyrgyzstan',
+        'KH' => 'Cambodia',
+        'KI' => 'Kiribati',
+        'KM' => 'Comoros',
+        'KN' => 'Saint Kitts and Nevis',
+        'KP' => 'North Korea',
+        'KR' => 'South Korea',
+        'KW' => 'Kuwait',
+        'KY' => 'Cayman Islands',
+        'KZ' => 'Kazakhstan',
+        'LA' => 'Laos',
+        'LB' => 'Lebanon',
+        'LC' => 'Saint Lucia',
+        'LI' => 'Liechtenstein',
+        'LK' => 'Sri Lanka',
+        'LR' => 'Liberia',
+        'LS' => 'Lesotho',
+        'LT' => 'Lithuania',
+        'LU' => 'Luxembourg',
+        'LV' => 'Latvia',
+        'LY' => 'Libya',
+        'MA' => 'Morocco',
+        'MC' => 'Monaco',
+        'MD' => 'Moldova',
+        'ME' => 'Montenegro',
+        'MF' => 'Saint Martin',
+        'MG' => 'Madagascar',
+        'MH' => 'Marshall Islands',
+        'MI' => 'Midway Islands',
+        'MK' => 'Macedonia',
+        'ML' => 'Mali',
+        'MM' => 'Myanmar [Burma]',
+        'MN' => 'Mongolia',
+        'MO' => 'Macau SAR China',
+        'MP' => 'Northern Mariana Islands',
+        'MQ' => 'Martinique',
+        'MR' => 'Mauritania',
+        'MS' => 'Montserrat',
+        'MT' => 'Malta',
+        'MU' => 'Mauritius',
+        'MV' => 'Maldives',
+        'MW' => 'Malawi',
+        'MX' => 'Mexico',
+        'MY' => 'Malaysia',
+        'MZ' => 'Mozambique',
+        'NA' => 'Namibia',
+        'NC' => 'New Caledonia',
+        'NE' => 'Niger',
+        'NF' => 'Norfolk Island',
+        'NG' => 'Nigeria',
+        'NI' => 'Nicaragua',
+        'NL' => 'Netherlands',
+        'NO' => 'Norway',
+        'NP' => 'Nepal',
+        'NQ' => 'Dronning Maud Land',
+        'NR' => 'Nauru',
+        'NT' => 'Neutral Zone',
+        'NU' => 'Niue',
+        'NZ' => 'New Zealand',
+        'OM' => 'Oman',
+        'PA' => 'Panama',
+        'PC' => 'Pacific Islands Trust Territory',
+        'PE' => 'Peru',
+        'PF' => 'French Polynesia',
+        'PG' => 'Papua New Guinea',
+        'PH' => 'Philippines',
+        'PK' => 'Pakistan',
+        'PL' => 'Poland',
+        'PM' => 'Saint Pierre and Miquelon',
+        'PN' => 'Pitcairn Islands',
+        'PR' => 'Puerto Rico',
+        'PS' => 'Palestinian Territories',
+        'PT' => 'Portugal',
+        'PU' => 'U.S. Miscellaneous Pacific Islands',
+        'PW' => 'Palau',
+        'PY' => 'Paraguay',
+        'PZ' => 'Panama Canal Zone',
+        'QA' => 'Qatar',
+        'RE' => 'Réunion',
+        'RO' => 'Romania',
+        'RS' => 'Serbia',
+        'RU' => 'Russia',
+        'RW' => 'Rwanda',
+        'SA' => 'Saudi Arabia',
+        'SB' => 'Solomon Islands',
+        'SC' => 'Seychelles',
+        'SD' => 'Sudan',
+        'SE' => 'Sweden',
+        'SG' => 'Singapore',
+        'SH' => 'Saint Helena',
+        'SI' => 'Slovenia',
+        'SJ' => 'Svalbard and Jan Mayen',
+        'SK' => 'Slovakia',
+        'SL' => 'Sierra Leone',
+        'SM' => 'San Marino',
+        'SN' => 'Senegal',
+        'SO' => 'Somalia',
+        'SR' => 'Suriname',
+        'ST' => 'São Tomé and Príncipe',
+        'SU' => 'Union of Soviet Socialist Republics',
+        'SV' => 'El Salvador',
+        'SY' => 'Syria',
+        'SZ' => 'Swaziland',
+        'TC' => 'Turks and Caicos Islands',
+        'TD' => 'Chad',
+        'TF' => 'French Southern Territories',
+        'TG' => 'Togo',
+        'TH' => 'Thailand',
+        'TJ' => 'Tajikistan',
+        'TK' => 'Tokelau',
+        'TL' => 'Timor-Leste',
+        'TM' => 'Turkmenistan',
+        'TN' => 'Tunisia',
+        'TO' => 'Tonga',
+        'TR' => 'Turkey',
+        'TT' => 'Trinidad and Tobago',
+        'TV' => 'Tuvalu',
+        'TW' => 'Taiwan',
+        'TZ' => 'Tanzania',
+        'UA' => 'Ukraine',
+        'UG' => 'Uganda',
+        'UM' => 'U.S. Minor Outlying Islands',
+        'US' => 'United States',
+        'UY' => 'Uruguay',
+        'UZ' => 'Uzbekistan',
+        'VA' => 'Vatican City',
+        'VC' => 'Saint Vincent and the Grenadines',
+        'VD' => 'North Vietnam',
+        'VE' => 'Venezuela',
+        'VG' => 'British Virgin Islands',
+        'VI' => 'U.S. Virgin Islands',
+        'VN' => 'Vietnam',
+        'VU' => 'Vanuatu',
+        'WF' => 'Wallis and Futuna',
+        'WK' => 'Wake Island',
+        'WS' => 'Samoa',
+        'YD' => 'People\'s Democratic Republic of Yemen',
+        'YE' => 'Yemen',
+        'YT' => 'Mayotte',
+        'ZA' => 'South Africa',
+        'ZM' => 'Zambia',
+        'ZW' => 'Zimbabwe',
+        'ZZ' => 'Unknown or Invalid Region',
+    ];
+
+    /**
+     * Retrieve list of countries
+     *
+     * @return array
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+} 
\ No newline at end of file
diff --git a/setup/module/Magento/Locale/src/Data/Currency.php b/setup/module/Magento/Locale/src/Data/Currency.php
new file mode 100644
index 0000000000000000000000000000000000000000..3474a16f295b1861fe55c23540b381e19b2f8e46
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Data/Currency.php
@@ -0,0 +1,212 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale\Data;
+
+class Currency implements ListInterface
+{
+    /**
+     * @var array
+     */
+    protected $data = [
+        'AED' => 'United Arab Emirates Dirham',
+        'AFN' => 'Afghan Afghani',
+        'ALL' => 'Albanian Lek',
+        'AMD' => 'Armenian Dram',
+        'ANG' => 'Netherlands Antillean Guilder',
+        'AOA' => 'Angolan Kwanza',
+        'ARS' => 'Argentine Peso',
+        'AUD' => 'Australian Dollar',
+        'AWG' => 'Aruban Florin',
+        'AZM' => 'Azerbaijani Manat (1993-2006)',
+        'AZN' => 'Azerbaijani Manat',
+        'BAM' => 'Bosnia-Herzegovina Convertible Mark',
+        'BBD' => 'Barbadian Dollar',
+        'BDT' => 'Bangladeshi Taka',
+        'BGN' => 'Bulgarian Lev',
+        'BHD' => 'Bahraini Dinar',
+        'BIF' => 'Burundian Franc',
+        'BMD' => 'Bermudan Dollar',
+        'BND' => 'Brunei Dollar',
+        'BOB' => 'Bolivian Boliviano',
+        'BRL' => 'Brazilian Real',
+        'BSD' => 'Bahamian Dollar',
+        'BTN' => 'Bhutanese Ngultrum',
+        'BUK' => 'Burmese Kyat',
+        'BWP' => 'Botswanan Pula',
+        'BYR' => 'Belarusian Ruble',
+        'BZD' => 'Belize Dollar',
+        'CAD' => 'Canadian Dollar',
+        'CDF' => 'Congolese Franc',
+        'CHE' => 'WIR Euro',
+        'CHF' => 'Swiss Franc',
+        'CHW' => 'WIR Franc',
+        'CLP' => 'Chilean Peso',
+        'CNY' => 'Chinese Yuan Renminbi',
+        'COP' => 'Colombian Peso',
+        'CRC' => 'Costa Rican Colón',
+        'CUP' => 'Cuban Peso',
+        'CVE' => 'Cape Verdean Escudo',
+        'CZK' => 'Czech Republic Koruna',
+        'DJF' => 'Djiboutian Franc',
+        'DKK' => 'Danish Krone',
+        'DOP' => 'Dominican Peso',
+        'DZD' => 'Algerian Dinar',
+        'EEK' => 'Estonian Kroon',
+        'EGP' => 'Egyptian Pound',
+        'ERN' => 'Eritrean Nakfa',
+        'ETB' => 'Ethiopian Birr',
+        'EUR' => 'Euro',
+        'FJD' => 'Fijian Dollar',
+        'FKP' => 'Falkland Islands Pound',
+        'GBP' => 'British Pound Sterling',
+        'GEK' => 'Georgian Kupon Larit',
+        'GEL' => 'Georgian Lari',
+        'GHS' => 'Ghanaian Cedi',
+        'GIP' => 'Gibraltar Pound',
+        'GMD' => 'Gambian Dalasi',
+        'GNF' => 'Guinean Franc',
+        'GQE' => 'Equatorial Guinean Ekwele',
+        'GTQ' => 'Guatemalan Quetzal',
+        'GYD' => 'Guyanaese Dollar',
+        'HKD' => 'Hong Kong Dollar',
+        'HNL' => 'Honduran Lempira',
+        'HRK' => 'Croatian Kuna',
+        'HTG' => 'Haitian Gourde',
+        'HUF' => 'Hungarian Forint',
+        'IDR' => 'Indonesian Rupiah',
+        'ILS' => 'Israeli New Sheqel',
+        'INR' => 'Indian Rupee',
+        'IQD' => 'Iraqi Dinar',
+        'IRR' => 'Iranian Rial',
+        'ISK' => 'Icelandic Króna',
+        'JMD' => 'Jamaican Dollar',
+        'JOD' => 'Jordanian Dinar',
+        'JPY' => 'Japanese Yen',
+        'KES' => 'Kenyan Shilling',
+        'KGS' => 'Kyrgystani Som',
+        'KHR' => 'Cambodian Riel',
+        'KMF' => 'Comorian Franc',
+        'KPW' => 'North Korean Won',
+        'KRW' => 'South Korean Won',
+        'KWD' => 'Kuwaiti Dinar',
+        'KYD' => 'Cayman Islands Dollar',
+        'KZT' => 'Kazakhstan Tenge',
+        'LAK' => 'Laotian Kip',
+        'LBP' => 'Lebanese Pound',
+        'LKR' => 'Sri Lanka Rupee',
+        'LRD' => 'Liberian Dollar',
+        'LSL' => 'Lesotho Loti',
+        'LTL' => 'Lithuanian Litas',
+        'LVL' => 'Latvian Lats',
+        'LYD' => 'Libyan Dinar',
+        'MAD' => 'Moroccan Dirham',
+        'MDL' => 'Moldovan Leu',
+        'MGA' => 'Malagasy Ariary',
+        'MKD' => 'Macedonian Denar',
+        'MMK' => 'Myanma Kyat',
+        'MNT' => 'Mongolian Tugrik',
+        'MOP' => 'Macanese Pataca',
+        'MRO' => 'Mauritanian Ouguiya',
+        'MUR' => 'Mauritian Rupee',
+        'MVR' => 'Maldivian Rufiyaa',
+        'MWK' => 'Malawian Kwacha',
+        'MXN' => 'Mexican Peso',
+        'MYR' => 'Malaysian Ringgit',
+        'MZN' => 'Mozambican Metical',
+        'NAD' => 'Namibian Dollar',
+        'NGN' => 'Nigerian Naira',
+        'NIC' => 'Nicaraguan Cordoba',
+        'NOK' => 'Norwegian Krone',
+        'NPR' => 'Nepalese Rupee',
+        'NZD' => 'New Zealand Dollar',
+        'OMR' => 'Omani Rial',
+        'PAB' => 'Panamanian Balboa',
+        'PEN' => 'Peruvian Nuevo Sol',
+        'PGK' => 'Papua New Guinean Kina',
+        'PHP' => 'Philippine Peso',
+        'PKR' => 'Pakistani Rupee',
+        'PLN' => 'Polish Zloty',
+        'PYG' => 'Paraguayan Guarani',
+        'QAR' => 'Qatari Rial',
+        'RHD' => 'Rhodesian Dollar',
+        'ROL' => 'Old Romanian Leu',
+        'RON' => 'Romanian Leu',
+        'RSD' => 'Serbian Dinar',
+        'RUB' => 'Russian Ruble',
+        'RWF' => 'Rwandan Franc',
+        'SAR' => 'Saudi Riyal',
+        'SBD' => 'Solomon Islands Dollar',
+        'SCR' => 'Seychellois Rupee',
+        'SDG' => 'Sudanese Pound',
+        'SEK' => 'Swedish Krona',
+        'SGD' => 'Singapore Dollar',
+        'SHP' => 'Saint Helena Pound',
+        'SKK' => 'Slovak Koruna',
+        'SLL' => 'Sierra Leonean Leone',
+        'SOS' => 'Somali Shilling',
+        'SRD' => 'Surinamese Dollar',
+        'STD' => 'São Tomé and Príncipe Dobra',
+        'SVC' => 'Salvadoran Colón',
+        'SYP' => 'Syrian Pound',
+        'SZL' => 'Swazi Lilangeni',
+        'THB' => 'Thai Baht',
+        'TJS' => 'Tajikistani Somoni',
+        'TMM' => 'Turkmenistani Manat',
+        'TND' => 'Tunisian Dinar',
+        'TOP' => 'Tongan Paʻanga',
+        'TRL' => 'Old Turkish Lira',
+        'TRY' => 'Turkish Lira',
+        'TTD' => 'Trinidad and Tobago Dollar',
+        'TWD' => 'New Taiwan Dollar',
+        'TZS' => 'Tanzanian Shilling',
+        'UAH' => 'Ukrainian Hryvnia',
+        'UGX' => 'Ugandan Shilling',
+        'USD' => 'US Dollar',
+        'UYU' => 'Uruguayan Peso',
+        'UZS' => 'Uzbekistan Som',
+        'VEB' => 'Venezuelan Bolívar',
+        'VEF' => 'Venezuelan Bolívar Fuerte',
+        'VND' => 'Vietnamese Dong',
+        'VUV' => 'Vanuatu Vatu',
+        'WST' => 'Samoan Tala',
+        'XCD' => 'East Caribbean Dollar',
+        'XOF' => 'CFA Franc BCEAO',
+        'XPF' => 'CFP Franc',
+        'YER' => 'Yemeni Rial',
+        'ZAR' => 'South African Rand',
+        'ZMK' => 'Zambian Kwacha',
+        'ZWD' => 'Zimbabwean Dollar',
+    ];
+
+    /**
+     * Retrieve list of currencies
+     *
+     * @return array
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+} 
\ No newline at end of file
diff --git a/setup/module/Magento/Locale/src/Data/Language.php b/setup/module/Magento/Locale/src/Data/Language.php
new file mode 100644
index 0000000000000000000000000000000000000000..dc2850e2f8a7393db5a988343f9dd59377804cfc
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Data/Language.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale\Data;
+
+class Language implements ListInterface
+{
+    /**
+     * @var array
+     */
+    protected $data = [
+        'af' => 'Afrikaans',
+        'ar' => 'Arabic',
+        'az' => 'Azerbaijani',
+        'be' => 'Belarusian',
+        'bg' => 'Bulgarian',
+        'bn' => 'Bengali',
+        'bs' => 'Bosnian',
+        'ca' => 'Catalan',
+        'cs' => 'Czech',
+        'cy' => 'Welsh',
+        'da' => 'Danish',
+        'de_AT' => 'Austrian German',
+        'de_CH' => 'Swiss High German',
+        'de' => 'German',
+        'el' => 'Greek',
+        'en_AU' => 'Australian English',
+        'en_CA' => 'Canadian English',
+        'en_GB' => 'British English',
+        'en' => 'English',
+        'en_US' => 'U.S. English',
+        'es' => 'Spanish',
+        'es_ES' => 'Iberian Spanish',
+        'et' => 'Estonian',
+        'fa' => 'Persian',
+        'fi' => 'Finnish',
+        'fil' => 'Filipino',
+        'fr_CA' => 'Canadian French',
+        'fr' => 'French',
+        'gl' => 'Galician',
+        'gu' => 'Gujarati',
+        'he' => 'Hebrew',
+        'hi' => 'Hindi',
+        'hr' => 'Croatian',
+        'hu' => 'Hungarian',
+        'id' => 'Indonesian',
+        'is' => 'Icelandic',
+        'it' => 'Italian',
+        'ja' => 'Japanese',
+        'ka' => 'Georgian',
+        'km' => 'Khmer',
+        'ko' => 'Korean',
+        'lo' => 'Lao',
+        'lt' => 'Lithuanian',
+        'lv' => 'Latvian',
+        'mk' => 'Macedonian',
+        'mn' => 'Mongolian',
+        'ms' => 'Malay',
+        'nb' => 'Norwegian Bokmål',
+        'nl' => 'Dutch',
+        'nn' => 'Norwegian Nynorsk',
+        'pl' => 'Polish',
+        'pt_BR' => 'Brazilian Portuguese',
+        'pt_PT' => 'Iberian Portuguese',
+        'ro' => 'Romanian',
+        'ru' => 'Russian',
+        'sk' => 'Slovak',
+        'sl' => 'Slovenian',
+        'sq' => 'Albanian',
+        'sr' => 'Serbian',
+        'sv' => 'Swedish',
+        'sw' => 'Swahili',
+        'th' => 'Thai',
+        'tr' => 'Turkish',
+        'uk' => 'Ukrainian',
+        'vi' => 'Vietnamese',
+        'zh' => 'Chinese',
+    ];
+
+    /**
+     * Retrieve list of languages
+     *
+     * @return array
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+} 
\ No newline at end of file
diff --git a/setup/module/Magento/Locale/src/Data/ListInterface.php b/setup/module/Magento/Locale/src/Data/ListInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..44a724553670f28b35dae8a6555c6ca0d994c8eb
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Data/ListInterface.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale\Data;
+
+interface ListInterface
+{
+    /**
+     * @return array
+     */
+    public function getData();
+}
diff --git a/setup/module/Magento/Locale/src/Data/Locale.php b/setup/module/Magento/Locale/src/Data/Locale.php
new file mode 100644
index 0000000000000000000000000000000000000000..5cad33ceb78b4ceec04b287336fa8fe046b8b97c
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Data/Locale.php
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale\Data;
+
+class Locale implements ListInterface
+{
+    /**
+     * @var array
+     */
+    protected $data = [
+        'af_ZA',
+        'ar_DZ', 'ar_EG', 'ar_KW', 'ar_MA', 'ar_SA',
+        'az_AZ',
+        'be_BY',
+        'bg_BG',
+        'bn_BD',
+        'bs_BA',
+        'ca_ES',
+        'cs_CZ',
+        'cy_GB',
+        'da_DK',
+        'de_AT', 'de_CH', 'de_DE',
+        'el_GR',
+        'en_AU', 'en_CA', 'en_GB', 'en_IE', 'en_NZ', 'en_US',
+        'es_AR', 'es_CL', 'es_CO', 'es_CR', 'es_ES', 'es_MX', 'es_PA', 'es_PE', 'es_VE',
+        'et_EE',
+        'fa_IR',
+        'fi_FI',
+        'fil_PH',
+        'fr_CA', 'fr_FR',
+        'gl_ES',
+        'gu_IN',
+        'he_IL',
+        'hi_IN',
+        'hr_HR',
+        'hu_HU',
+        'id_ID',
+        'is_IS',
+        'it_CH', 'it_IT',
+        'ja_JP',
+        'ka_GE',
+        'km_KH',
+        'ko_KR',
+        'lo_LA',
+        'lt_LT',
+        'lv_LV',
+        'mk_MK',
+        'mn_MN',
+        'ms_MY',
+        'nb_NO',
+        'nl_NL',
+        'nn_NO',
+        'pl_PL',
+        'pt_BR', 'pt_PT',
+        'ro_RO',
+        'ru_RU',
+        'sk_SK',
+        'sl_SI',
+        'sq_AL',
+        'sr_RS',
+        'sv_SE',
+        'sw_KE',
+        'th_TH',
+        'tr_TR',
+        'uk_UA',
+        'vi_VN',
+        'zh_CN', 'zh_HK', 'zh_TW',
+    ];
+
+    /**
+     * Retrieve list of locales
+     *
+     * @return array
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+} 
\ No newline at end of file
diff --git a/setup/module/Magento/Locale/src/Data/Timezone.php b/setup/module/Magento/Locale/src/Data/Timezone.php
new file mode 100644
index 0000000000000000000000000000000000000000..3514bdd0186899afe319f79a24c43e5b764361fb
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Data/Timezone.php
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale\Data;
+
+class Timezone implements ListInterface
+{
+    /**
+     * @var array
+     */
+    protected $data = [
+        'Australia/Darwin' => 'AUS Central Standard Time',
+        'Australia/Sydney' => 'AUS Eastern Standard Time',
+        'Asia/Kabul' => 'Afghanistan Standard Time',
+        'America/Anchorage' => 'Alaskan Standard Time',
+        'Asia/Riyadh' => 'Arab Standard Time',
+        'Asia/Dubai' => 'Arabian Standard Time',
+        'Asia/Baghdad' => 'Arabic Standard Time',
+        'America/Buenos_Aires' => 'Argentina Standard Time',
+        'Asia/Yerevan' => 'Armenian Standard Time',
+        'America/Halifax' => 'Atlantic Standard Time',
+        'Asia/Baku' => 'Azerbaijan Standard Time',
+        'Atlantic/Azores' => 'Azores Standard Time',
+        'America/Regina' => 'Canada Central Standard Time',
+        'Atlantic/Cape_Verde' => 'Cape Verde Standard Time',
+        'Australia/Adelaide' => 'Cen. Australia Standard Time',
+        'America/Guatemala' => 'Central America Standard Time',
+        'Asia/Dhaka' => 'Central Asia Standard Time',
+        'America/Manaus' => 'Central Brazilian Standard Time',
+        'Europe/Budapest' => 'Central Europe Standard Time',
+        'Europe/Warsaw' => 'Central European Standard Time',
+        'Pacific/Guadalcanal' => 'Central Pacific Standard Time',
+        'America/Chicago' => 'Central Standard Time',
+        'America/Mexico_City' => 'Central Standard Time (Mexico)',
+        'Asia/Shanghai' => 'China Standard Time',
+        'Etc/GMT+12' => 'Dateline Standard Time',
+        'Africa/Nairobi' => 'E. Africa Standard Time',
+        'Australia/Brisbane' => 'E. Australia Standard Time',
+        'Europe/Minsk' => 'E. Europe Standard Time',
+        'America/Sao_Paulo' => 'E. South America Standard Time',
+        'America/New_York' => 'Eastern Standard Time',
+        'Africa/Cairo' => 'Egypt Standard Time',
+        'Asia/Yekaterinburg' => 'Ekaterinburg Standard Time',
+        'Europe/Kiev' => 'FLE Standard Time',
+        'Pacific/Fiji' => 'Fiji Standard Time',
+        'Europe/London' => 'GMT Standard Time',
+        'Europe/Istanbul' => 'GTB Standard Time',
+        'Etc/GMT-3' => 'Georgian Standard Time',
+        'America/Godthab' => 'Greenland Standard Time',
+        'Atlantic/Reykjavik' => 'Greenwich Standard Time',
+        'Pacific/Honolulu' => 'Hawaiian Standard Time',
+        'Asia/Calcutta' => 'India Standard Time',
+        'Asia/Tehran' => 'Iran Standard Time',
+        'Asia/Jerusalem' => 'Israel Standard Time',
+        'Asia/Amman' => 'Jordan Standard Time',
+        'Asia/Seoul' => 'Korea Standard Time',
+        'Indian/Mauritius' => 'Mauritius Standard Time',
+        'America/Chihuahua' => 'Mexico Standard Time 2',
+        'Atlantic/South_Georgia' => 'Mid-Atlantic Standard Time',
+        'Asia/Beirut' => 'Middle East Standard Time',
+        'America/Montevideo' => 'Montevideo Standard Time',
+        'Africa/Casablanca' => 'Morocco Standard Time',
+        'America/Denver' => 'Mountain Standard Time',
+        'Asia/Rangoon' => 'Myanmar Standard Time',
+        'Asia/Novosibirsk' => 'N. Central Asia Standard Time',
+        'Africa/Windhoek' => 'Namibia Standard Time',
+        'Asia/Katmandu' => 'Nepal Standard Time',
+        'Pacific/Auckland' => 'New Zealand Standard Time',
+        'America/St_Johns' => 'Newfoundland Standard Time',
+        'Asia/Irkutsk' => 'North Asia East Standard Time',
+        'Asia/Krasnoyarsk' => 'North Asia Standard Time',
+        'America/Santiago' => 'Pacific SA Standard Time',
+        'America/Los_Angeles' => 'Pacific Standard Time',
+        'America/Tijuana' => 'Pacific Standard Time (Mexico)',
+        'Asia/Karachi' => 'Pakistan Standard Time',
+        'Europe/Paris' => 'Romance Standard Time',
+        'Europe/Moscow' => 'Russian Standard Time',
+        'Etc/GMT+3' => 'SA Eastern Standard Time',
+        'America/Bogota' => 'SA Pacific Standard Time',
+        'America/La_Paz' => 'SA Western Standard Time',
+        'Asia/Bangkok' => 'SE Asia Standard Time',
+        'Pacific/Apia' => 'Samoa Standard Time',
+        'Asia/Singapore' => 'Singapore Standard Time',
+        'Africa/Johannesburg' => 'South Africa Standard Time',
+        'Asia/Colombo' => 'Sri Lanka Standard Time',
+        'Asia/Taipei' => 'Taipei Standard Time',
+        'Australia/Hobart' => 'Tasmania Standard Time',
+        'Asia/Tokyo' => 'Tokyo Standard Time',
+        'Pacific/Tongatapu' => 'Tonga Standard Time',
+        'Etc/GMT+5' => 'US Eastern Standard Time',
+        'America/Phoenix' => 'US Mountain Standard Time',
+        'America/Caracas' => 'Venezuela Standard Time',
+        'Asia/Vladivostok' => 'Vladivostok Standard Time',
+        'Australia/Perth' => 'W. Australia Standard Time',
+        'Africa/Lagos' => 'W. Central Africa Standard Time',
+        'Europe/Berlin' => 'W. Europe Standard Time',
+        'Asia/Tashkent' => 'West Asia Standard Time',
+        'Pacific/Port_Moresby' => 'West Pacific Standard Time',
+        'Asia/Yakutsk' => 'Yakutsk Standard Time',
+    ];
+
+    /**
+     * Retrieve list of timezones
+     *
+     * @return array
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+} 
\ No newline at end of file
diff --git a/setup/module/Magento/Locale/src/Lists.php b/setup/module/Magento/Locale/src/Lists.php
new file mode 100644
index 0000000000000000000000000000000000000000..4f236f3a91a8e5f07d9096ca106d3d0298c1086d
--- /dev/null
+++ b/setup/module/Magento/Locale/src/Lists.php
@@ -0,0 +1,128 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Locale;
+
+class Lists
+{
+    /**
+     * @var Data\Country
+     */
+    protected $country;
+
+    /**
+     * @var Data\Currency
+     */
+    protected $currency;
+
+    /**
+     * @var Data\Language
+     */
+    protected $language;
+
+    /**
+     * @var Locale
+     */
+    protected $locale;
+
+    /**
+     * @var Data\Timezone
+     */
+    protected $timezone;
+
+    /**
+     * @param Data\Country $country
+     * @param Data\Currency $currency
+     * @param Data\Language $language
+     * @param Data\Timezone $timezone
+     * @param Data\Locale $locale
+     */
+    public function __construct(
+        Data\Country $country,
+        Data\Currency $currency,
+        Data\Language $language,
+        Data\Timezone $timezone,
+        Data\Locale $locale
+    ) {
+        $this->country = $country;
+        $this->currency = $currency;
+        $this->language = $language;
+        $this->timezone = $timezone;
+        $this->locale = $locale;
+    }
+
+    /**
+     * Retrieve list of timezones
+     *
+     * @return array
+     */
+    public function getTimezoneList()
+    {
+        $list = [];
+        foreach ($this->timezone->getData() as $code => $value) {
+            $list[$code] = $value . ' (' . $code . ')';
+        }
+        asort($list);
+        return $list;
+    }
+
+    /**
+     * Retrieve list of currencies
+     *
+     * @return array
+     */
+    public function getCurrencyList()
+    {
+        $list = $this->currency->getData();
+        foreach ($this->currency->getData() as $code => $value) {
+            $list[$code] = $value . ' (' . $code . ')';
+        }
+        asort($list);
+        return $list;
+    }
+
+    /**
+     * Retrieve list of locales
+     *
+     * @return  array
+     */
+    public function getLocaleList()
+    {
+        $languages = $this->language->getData();
+        $countries = $this->country->getData();
+
+        $list = [];
+        foreach ($this->locale->getData() as $code) {
+            if (strstr($code, '_')) {
+                $data = explode('_', $code);
+                if (!isset($languages[$data[0]]) || !isset($countries[$data[1]])) {
+                    continue;
+                }
+                $list[$code] = $languages[$data[0]] . ' (' . $countries[$data[1]] . ')';
+            }
+        }
+        asort($list);
+        return $list;
+    }
+}
diff --git a/setup/module/Magento/Module/Module.php b/setup/module/Magento/Module/Module.php
new file mode 100644
index 0000000000000000000000000000000000000000..9cfec3e3b782a6ea3c01838f365b8665e15a47ca
--- /dev/null
+++ b/setup/module/Magento/Module/Module.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module;
+
+use Zend\ModuleManager\Feature\ConfigProviderInterface;
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+
+class Module implements
+    ConfigProviderInterface,
+    AutoloaderProviderInterface
+{
+    /**
+     * @return array|mixed|\Traversable
+     */
+    public function getConfig()
+    {
+        return array_merge(
+            include __DIR__ . '/config/module.config.php',
+            include __DIR__ . '/config/di.config.php'
+        );
+    }
+
+    /**
+     * @return array
+     */
+    public function getAutoloaderConfig()
+    {
+        return [
+            'Zend\Loader\StandardAutoloader' => [
+                'namespaces' => [
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ],
+            ],
+        ];
+    }
+}
diff --git a/setup/module/Magento/Module/config/di.config.php b/setup/module/Magento/Module/config/di.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..980766c79cf884321c183c4cfb01eff5b05523d8
--- /dev/null
+++ b/setup/module/Magento/Module/config/di.config.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'di' => [
+        'instance' => [
+            'preference' => [
+                'Magento\Module\Dependency\ManagerInterface' => 'Magento\Module\Dependency\Manager',
+                'Magento\Module\Setup\Connection\AdapterInterface' => 'Magento\Module\Setup\Connection\Adapter',
+                'Magento\Module\Resource\ResourceInterface' => 'Magento\Module\Resource\Resource',
+                'Magento\Module\ModuleListInterface' => 'Magento\Module\ModuleList'
+            ]
+        ],
+    ],
+];
diff --git a/lib/internal/Magento/Framework/Connect/Channel/Parser.php b/setup/module/Magento/Module/config/module.config.php
similarity index 80%
rename from lib/internal/Magento/Framework/Connect/Channel/Parser.php
rename to setup/module/Magento/Module/config/module.config.php
index 9b677ee90e22c725589114cff590cc230194f6cf..d5ba5073e80105b50591a7dd00ef9be4413e81d4 100644
--- a/lib/internal/Magento/Framework/Connect/Channel/Parser.php
+++ b/setup/module/Magento/Module/config/module.config.php
@@ -18,6 +18,8 @@
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
  *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+
+return [];
diff --git a/setup/module/Magento/Module/src/Converter/Dom.php b/setup/module/Magento/Module/src/Converter/Dom.php
new file mode 100644
index 0000000000000000000000000000000000000000..4a05701bb47dc93b7f50fc09b70965c1e476e638
--- /dev/null
+++ b/setup/module/Magento/Module/src/Converter/Dom.php
@@ -0,0 +1,172 @@
+<?php
+/**
+ * Module declaration xml converter. Converts declaration DOM Document to internal array representation.
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module\Converter;
+
+use Magento\Config\Converter\ConverterInterface;
+
+class Dom implements ConverterInterface
+{
+    /**
+     * Convert config
+     *
+     * @param \DOMDocument $source
+     * @return array
+     * @throws \Exception
+     */
+    public function convert($source)
+    {
+        $modules = array();
+        $xpath = new \DOMXPath($source);
+        /** @var $moduleNode \DOMNode */
+        foreach ($xpath->query('/config/module') as $moduleNode) {
+            $moduleData = array();
+            $moduleAttributes = $moduleNode->attributes;
+            $nameNode = $moduleAttributes->getNamedItem('name');
+            if (is_null($nameNode)) {
+                throw new \Exception('Attribute "name" is required for module node.');
+            }
+            $moduleData['name'] = $nameNode->nodeValue;
+            $versionNode = $moduleAttributes->getNamedItem('schema_version');
+            if (is_null($versionNode)) {
+                throw new \Exception('Attribute "schema_version" is required for module node.');
+            }
+            $moduleData['schema_version'] = $versionNode->nodeValue;
+            $activeNode = $moduleAttributes->getNamedItem('active');
+            if (is_null($activeNode)) {
+                throw new \Exception('Attribute "active" is required for module node.');
+            }
+            $moduleData['active'] = $activeNode->nodeValue == 'false' ? false : true;
+            $moduleData['dependencies'] = array(
+                'modules' => array(),
+                'extensions' => array('strict' => array(), 'alternatives' => array())
+            );
+            /** @var $childNode \DOMNode */
+            foreach ($moduleNode->childNodes as $childNode) {
+                switch ($childNode->nodeName) {
+                    case 'depends':
+                        $moduleData['dependencies'] = array_merge(
+                            $moduleData['dependencies'],
+                            $this->convertExtensionDependencies($childNode)
+                        );
+                        break;
+                    case 'sequence':
+                        $moduleData['dependencies'] = array_merge(
+                            $moduleData['dependencies'],
+                            $this->convertModuleDependencies($childNode)
+                        );
+                        break;
+                }
+            }
+            // Use module name as a key in the result array to allow quick access to module configuration
+            $modules[$nameNode->nodeValue] = $moduleData;
+        }
+        return $modules;
+    }
+
+    /**
+     * Convert extension depends node into assoc array
+     *
+     * @param \DOMNode $dependsNode
+     * @return array
+     * @throws \Exception
+     */
+    protected function convertExtensionDependencies(\DOMNode $dependsNode)
+    {
+        $dependencies = array('extensions' => array('strict' => array(), 'alternatives' => array()));
+        /** @var $childNode \DOMNode */
+        foreach ($dependsNode->childNodes as $childNode) {
+            switch ($childNode->nodeName) {
+                case 'extension':
+                    $dependencies['extensions']['strict'][] = $this->convertExtensionNode($childNode);
+                    break;
+                case 'choice':
+                    $alternatives = array();
+                    /** @var $extensionNode \DOMNode */
+                    foreach ($childNode->childNodes as $extensionNode) {
+                        switch ($extensionNode->nodeName) {
+                            case 'extension':
+                                $alternatives[] = $this->convertExtensionNode($extensionNode);
+                                break;
+                        }
+                    }
+                    if (empty($alternatives)) {
+                        throw new \Exception('Node "choice" cannot be empty.');
+                    }
+                    $dependencies['extensions']['alternatives'][] = $alternatives;
+                    break;
+            }
+        }
+        return $dependencies;
+    }
+
+    /**
+     * Convert extension node into assoc array
+     *
+     * @param \DOMNode $extensionNode
+     * @return array
+     * @throws \Exception
+     */
+    protected function convertExtensionNode(\DOMNode $extensionNode)
+    {
+        $extensionData = array();
+        $nameNode = $extensionNode->attributes->getNamedItem('name');
+        if (is_null($nameNode)) {
+            throw new \Exception('Attribute "name" is required for extension node.');
+        }
+        $extensionData['name'] = $nameNode->nodeValue;
+        $minVersionNode = $extensionNode->attributes->getNamedItem('minVersion');
+        if (!is_null($minVersionNode)) {
+            $extensionData['minVersion'] = $minVersionNode->nodeValue;
+        }
+        return $extensionData;
+    }
+
+    /**
+     * Convert module depends node into assoc array
+     *
+     * @param \DOMNode $dependsNode
+     * @return array
+     * @throws \Exception
+     */
+    protected function convertModuleDependencies(\DOMNode $dependsNode)
+    {
+        $dependencies = array('modules' => array());
+        /** @var $childNode \DOMNode */
+        foreach ($dependsNode->childNodes as $childNode) {
+            switch ($childNode->nodeName) {
+                case 'module':
+                    $nameNode = $childNode->attributes->getNamedItem('name');
+                    if (is_null($nameNode)) {
+                        throw new \Exception('Attribute "name" is required for module node.');
+                    }
+                    $dependencies['modules'][] = $nameNode->nodeValue;
+                    break;
+            }
+        }
+        return $dependencies;
+    }
+}
diff --git a/setup/module/Magento/Module/src/Dependency/Manager.php b/setup/module/Magento/Module/src/Dependency/Manager.php
new file mode 100644
index 0000000000000000000000000000000000000000..16c836a56d50eb8fc3a39fe7e50ffb01c3c03c46
--- /dev/null
+++ b/setup/module/Magento/Module/src/Dependency/Manager.php
@@ -0,0 +1,143 @@
+<?php
+/**
+ * Dependency manager, checks if all dependencies on modules and extensions are satisfied
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module\Dependency;
+
+class Manager implements ManagerInterface
+{
+    /**
+     * Check dependencies of the given module
+     *
+     * @param array $moduleConfig
+     * @param array $activeModules
+     * @return void
+     * @throws \Exception
+     */
+    public function checkModuleDependencies(array $moduleConfig, array $activeModules = array())
+    {
+        // Check that required modules are active
+        if ($activeModules) {
+            foreach ($moduleConfig['dependencies']['modules'] as $moduleName) {
+                if (!isset($activeModules[$moduleName])) {
+                    throw new \Exception(
+                        "Module '{$moduleConfig['name']}' depends on '{$moduleName}' that is missing or not active."
+                    );
+                }
+            }
+        }
+
+        // Check that required extensions are loaded
+        foreach ($moduleConfig['dependencies']['extensions']['strict'] as $extensionData) {
+            $extensionName = $extensionData['name'];
+            $minVersion = isset($extensionData['minVersion']) ? $extensionData['minVersion'] : null;
+            if (!$this->isPhpExtensionLoaded($extensionName, $minVersion)) {
+                throw new \Exception(
+                    "Module '{$moduleConfig['name']}' depends on '{$extensionName}' PHP extension that is not loaded."
+                );
+            }
+        }
+        foreach ($moduleConfig['dependencies']['extensions']['alternatives'] as $altExtensions) {
+            $this->checkAlternativeExtensions($moduleConfig['name'], $altExtensions);
+        }
+    }
+
+    /**
+     * Recursively identify all module dependencies and detect circular ones
+     *
+     * @param string $moduleName
+     * @param array $modules
+     * @param array $usedModules
+     * @return array
+     * @throws \Exception
+     */
+    public function getExtendedModuleDependencies($moduleName, array $modules, array $usedModules = array())
+    {
+        $usedModules[] = $moduleName;
+        $dependencyList = $modules[$moduleName]['dependencies']['modules'];
+        foreach ($dependencyList as $relModuleName) {
+            if (in_array($relModuleName, $usedModules)) {
+                throw new \Exception(
+                    "Module '{$moduleName}' cannot depend on '{$relModuleName}' since it creates circular dependency."
+                );
+            }
+            if (empty($modules[$relModuleName])) {
+                continue;
+            }
+            $relDependencies = $this->getExtendedModuleDependencies($relModuleName, $modules, $usedModules);
+            $dependencyList = array_unique(array_merge($dependencyList, $relDependencies));
+        }
+        return $dependencyList;
+    }
+
+    /**
+     * Check if at least one of the extensions is loaded
+     *
+     * @param string $moduleName
+     * @param array $altExtensions
+     * @return void
+     * @throws \Exception
+     */
+    protected function checkAlternativeExtensions($moduleName, array $altExtensions)
+    {
+        $extensionNames = array();
+        foreach ($altExtensions as $extensionData) {
+            $extensionName = $extensionData['name'];
+            $minVersion = isset($extensionData['minVersion']) ? $extensionData['minVersion'] : null;
+            if ($this->isPhpExtensionLoaded($extensionName, $minVersion)) {
+                return;
+            }
+            $extensionNames[] = $extensionName;
+        }
+        if (!empty($extensionNames)) {
+            throw new \Exception(
+                "Module '{$moduleName}' depends on at least one of the following PHP extensions: " . implode(
+                    ',',
+                    $extensionNames
+                ) . '.'
+            );
+        }
+        return;
+    }
+
+    /**
+     * Check if required version of PHP extension is loaded
+     *
+     * @param string $extensionName
+     * @param string|null $minVersion
+     * @return boolean
+     */
+    protected function isPhpExtensionLoaded($extensionName, $minVersion = null)
+    {
+        if (extension_loaded($extensionName)) {
+            if (is_null($minVersion)) {
+                return true;
+            } elseif (version_compare($minVersion, phpversion($extensionName), '<=')) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Autoload/Simple.php b/setup/module/Magento/Module/src/Dependency/ManagerInterface.php
similarity index 56%
rename from downloader/lib/Magento/Framework/Autoload/Simple.php
rename to setup/module/Magento/Module/src/Dependency/ManagerInterface.php
index 845d601277e868af69e8a7e715a52124afd24f81..393b106238839097e4c1bee937a2b0c7eb3dd4d6 100644
--- a/downloader/lib/Magento/Framework/Autoload/Simple.php
+++ b/setup/module/Magento/Module/src/Dependency/ManagerInterface.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Dependency manager, checks if all dependencies on modules and extensions are satisfied
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -21,43 +23,29 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Autoload;
 
-class Simple
-{
-    /**
-     * @var object
-     */
-    private static $_instance;
-
-    /**
-     * @return object
-     */
-    public static function instance()
-    {
-        if (!self::$_instance) {
-            $class = __CLASS__;
-            self::$_instance = new $class();
-        }
-        return self::$_instance;
-    }
+namespace Magento\Module\Dependency;
 
+interface ManagerInterface
+{
     /**
+     * Check dependencies of the given module
+     *
+     * @param array $moduleConfig
+     * @param array $activeModules
      * @return void
+     * @throws \Exception
      */
-    public static function register()
-    {
-        spl_autoload_register(array(self::instance(), 'autoload'));
-    }
+    public function checkModuleDependencies(array $moduleConfig, array $activeModules = array());
 
     /**
-     * @param string $class
-     * @return void
+     * Recursively identify all module dependencies and detect circular ones
+     *
+     * @param string $moduleName
+     * @param array $modules
+     * @param array $usedModules
+     * @return array
+     * @throws \Exception
      */
-    public function autoload($class)
-    {
-        $classFile = str_replace(' ', '/', ucwords(str_replace('_', ' ', $class)));
-        $classFile .= '.php';
-        @include $classFile;
-    }
+    public function getExtendedModuleDependencies($moduleName, array $modules, array $usedModules = array());
 }
diff --git a/setup/module/Magento/Module/src/Dir.php b/setup/module/Magento/Module/src/Dir.php
new file mode 100644
index 0000000000000000000000000000000000000000..e310ad25e9f17f74f0d5fad57df69d74ee791ea0
--- /dev/null
+++ b/setup/module/Magento/Module/src/Dir.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Encapsulates directories structure of a Magento module
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Module;
+
+use Magento\Filesystem\Directory\ReadInterface;
+use Magento\Filesystem\Filesystem;
+
+class Dir
+{
+    const MODULES_DIR = 'code';
+
+    /**
+     * Modules root directory
+     *
+     * @var ReadInterface
+     */
+    protected $_modulesDirectory;
+
+    /**
+     * @param Filesystem $filesystem
+     */
+    public function __construct(Filesystem $filesystem)
+    {
+        $this->_modulesDirectory = $filesystem->getDirectoryRead(self::MODULES_DIR);
+    }
+
+    /**
+     * Retrieve full path to a directory of certain type within a module
+     *
+     * @param string $moduleName Fully-qualified module name
+     * @param string $type Type of module's directory to retrieve
+     * @return string
+     * @throws \InvalidArgumentException
+     */
+    public function getDir($moduleName, $type = '')
+    {
+        $path = str_replace(' ', '/', ucwords(str_replace('_', ' ', $moduleName)));
+        if ($type) {
+            if (!in_array($type, array('etc', 'sql', 'data', 'i18n', 'view'))) {
+                throw new \InvalidArgumentException("Directory type '{$type}' is not recognized.");
+            }
+            $path .= '/' . $type;
+        }
+
+        $result = $this->_modulesDirectory->getAbsolutePath($path);
+
+        return $result;
+    }
+}
diff --git a/setup/module/Magento/Module/src/FileResolver.php b/setup/module/Magento/Module/src/FileResolver.php
new file mode 100644
index 0000000000000000000000000000000000000000..3ac2052067b93e087fbb1e1ba767bc97c54a242b
--- /dev/null
+++ b/setup/module/Magento/Module/src/FileResolver.php
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module;
+
+use Magento\Config\Config;
+use Zend\Stdlib\Glob;
+use Magento\Config\FileResolverInterface;
+use Magento\Config\FileIteratorFactory;
+use Magento\Config\ConfigFactory;
+
+class FileResolver implements FileResolverInterface
+{
+    /**
+     * @var FileIteratorFactory
+     */
+    protected $iteratorFactory;
+
+    /**
+     * @var ConfigFactory
+     */
+    protected $configFactory;
+
+    /**
+     * @var Config
+     */
+    protected $config;
+
+    /**
+     * @param FileIteratorFactory $iteratorFactory
+     * @param ConfigFactory $configFactory
+     * @internal param Config $config
+     */
+    public function __construct(
+        FileIteratorFactory $iteratorFactory,
+        ConfigFactory $configFactory
+    ) {
+        $this->iteratorFactory = $iteratorFactory;
+        $this->configFactory = $configFactory;
+        $this->config = $this->configFactory->create();
+    }
+
+    /**
+     * @param string $filename
+     * @return array
+     */
+    public function get($filename)
+    {
+        $paths = [];
+
+        // Collect files by /app/code/*/*/etc/{filename} pattern
+        $files = $this->getFiles($this->config->getMagentoModulePath() . '*/*/etc/' . $filename);
+        foreach ($files as $file) {
+            $paths[] = $this->getRelativePath($file);
+        }
+
+        // Collect files by /app/etc/*/{filename} pattern
+        $files = $this->getFiles($this->config->getMagentoConfigPath() . '*/' . $filename);
+        foreach ($files as $file) {
+            $paths[] = $this->getRelativePath($file);
+        }
+
+        return $this->iteratorFactory->create($this->config->getMagentoBasePath(), $paths);
+    }
+
+    /**
+     * Retrieves relative path
+     *
+     * @param string $path
+     * @return string
+     */
+    protected function getRelativePath($path = null)
+    {
+        $basePath = $this->config->getMagentoBasePath();
+        if (strpos($path, $basePath) === 0
+            || $basePath == $path . '/') {
+            $result = substr($path, strlen($basePath));
+        } else {
+            $result = $path;
+        }
+        return $result;
+    }
+
+    /**
+     * @param string $path
+     * @return array|false
+     */
+    protected function getFiles($path)
+    {
+        return Glob::glob($this->config->getMagentoBasePath() . $path);
+    }
+}
diff --git a/setup/module/Magento/Module/src/ModuleList.php b/setup/module/Magento/Module/src/ModuleList.php
new file mode 100644
index 0000000000000000000000000000000000000000..e436707fe0a842671ea4605db0fea5a2b8f8eb7c
--- /dev/null
+++ b/setup/module/Magento/Module/src/ModuleList.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module;
+
+use Magento\Module\Reader\Filesystem;
+
+class ModuleList implements ModuleListInterface
+{
+    /**
+     * @var array
+     */
+    protected $data;
+
+    /**
+     * @param Filesystem $reader
+     */
+    public function __construct(Filesystem $reader)
+    {
+        $this->data = $reader->read();
+    }
+
+    /**
+     * Get configuration of all declared active modules
+     *
+     * @return array
+     */
+    public function getModules()
+    {
+        return $this->data;
+    }
+
+    /**
+     * Get module configuration
+     *
+     * @param string $moduleName
+     * @return array|null
+     */
+    public function getModule($moduleName)
+    {
+        return isset($this->data[$moduleName]) ? $this->data[$moduleName] : null;
+    }
+}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Index.php b/setup/module/Magento/Module/src/ModuleListInterface.php
similarity index 73%
rename from app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Index.php
rename to setup/module/Magento/Module/src/ModuleListInterface.php
index 435e540486a15b00fbd05d06d59c6b0de0bf8429..eb15a1ad64625ddaa8aec37af966c96f8ccebb7b 100644
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Index.php
+++ b/setup/module/Magento/Module/src/ModuleListInterface.php
@@ -1,6 +1,5 @@
 <?php
 /**
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -22,19 +21,23 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
 
-class Index extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
+namespace Magento\Module;
+
+interface ModuleListInterface
 {
     /**
-     * Redirect to edit Extension Package action
+     * Get configuration of all declared active modules
      *
-     * @return void
+     * @return array
      */
-    public function execute()
-    {
-        $this->_title->add(__('Package Extensions'));
+    public function getModules();
 
-        $this->_forward('edit');
-    }
+    /**
+     * Get module configuration
+     *
+     * @param string $moduleName
+     * @return array
+     */
+    public function getModule($moduleName);
 }
diff --git a/setup/module/Magento/Module/src/Reader/Filesystem.php b/setup/module/Magento/Module/src/Reader/Filesystem.php
new file mode 100644
index 0000000000000000000000000000000000000000..8cf18d1e709ae74e2a9b9280376b4d98572f1642
--- /dev/null
+++ b/setup/module/Magento/Module/src/Reader/Filesystem.php
@@ -0,0 +1,148 @@
+<?php
+/**
+ * Module declaration reader. Reads module.xml declaration files from module /etc directories.
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module\Reader;
+
+use Magento\Config\Reader\Filesystem as ConfigFilesystem;
+use Magento\Module\FileResolver;
+use Magento\Module\Converter\Dom;
+use Magento\Module\SchemaLocator;
+use Magento\Module\Dependency\ManagerInterface;
+
+class Filesystem extends ConfigFilesystem
+{
+    /**
+     * @var \Magento\Module\Dependency\ManagerInterface
+     */
+    protected $dependencyManager;
+
+    /**
+     * @var array
+     */
+    protected $idAttributes = array(
+        '/config/module' => 'name',
+        '/config/module/depends/extension' => 'name',
+        '/config/module/depends/choice/extension' => 'name',
+        '/config/module/sequence/module' => 'name'
+    );
+
+    /**
+     * @param FileResolver $fileResolver
+     * @param Dom $converter
+     * @param SchemaLocator $schemaLocator
+     * @param ManagerInterface $dependencyManager
+     * @param string $fileName
+     * @param string $domDocumentClass
+     * @param array $idAttributes
+     */
+    public function __construct(
+        FileResolver $fileResolver,
+        Dom $converter,
+        SchemaLocator $schemaLocator,
+        ManagerInterface $dependencyManager,
+        $fileName = 'module.xml',
+        $domDocumentClass = 'Magento\Config\Dom',
+        $idAttributes = array()
+    ) {
+        parent::__construct(
+            $fileResolver,
+            $converter,
+            $schemaLocator,
+            $fileName,
+            $domDocumentClass,
+            $idAttributes
+        );
+        $this->dependencyManager = $dependencyManager;
+    }
+
+    /**
+     * Load configuration
+     *
+     * @return array
+     */
+    public function read()
+    {
+        $activeModules = $this->filterActiveModules(parent::read());
+        return $this->sortModules($activeModules);
+    }
+
+    /**
+     * Retrieve declarations of active modules
+     *
+     * @param array $modules
+     * @return array
+     */
+    protected function filterActiveModules(array $modules)
+    {
+        $activeModules = array();
+        foreach ($modules as $moduleName => $moduleConfig) {
+            if ($moduleConfig['active']) {
+                $activeModules[$moduleName] = $moduleConfig;
+            }
+        }
+        return $activeModules;
+    }
+
+    /**
+     * Sort module declarations based on module dependencies
+     *
+     * @param array $modules
+     * @return array
+     */
+    protected function sortModules(array $modules)
+    {
+        /**
+         * The following map is needed only for sorting
+         * (in order not to add extra information about dependencies to module config)
+         */
+        $moduleDependencyMap = array();
+        foreach (array_keys($modules) as $moduleName) {
+            $moduleDependencyMap[] = array(
+                'moduleName' => $moduleName,
+                'dependencies' => $this->dependencyManager->getExtendedModuleDependencies($moduleName, $modules)
+            );
+        }
+
+        // Use "bubble sorting" because usort does not check each pair of elements and in this case it is important
+        $modulesCount = count($moduleDependencyMap);
+        for ($i = 0; $i < $modulesCount - 1; $i++) {
+            for ($j = $i; $j < $modulesCount; $j++) {
+                if (in_array($moduleDependencyMap[$j]['moduleName'], $moduleDependencyMap[$i]['dependencies'])) {
+                    $temp = $moduleDependencyMap[$i];
+                    $moduleDependencyMap[$i] = $moduleDependencyMap[$j];
+                    $moduleDependencyMap[$j] = $temp;
+                }
+            }
+        }
+
+        $sortedModules = array();
+        foreach ($moduleDependencyMap as $moduleDependencyPair) {
+            $sortedModules[$moduleDependencyPair['moduleName']] = $modules[$moduleDependencyPair['moduleName']];
+        }
+
+        return $sortedModules;
+    }
+}
diff --git a/setup/module/Magento/Module/src/Resource/Resource.php b/setup/module/Magento/Module/src/Resource/Resource.php
new file mode 100644
index 0000000000000000000000000000000000000000..83f7ca1dd4444645edb7a3c52967e877e014cfd8
--- /dev/null
+++ b/setup/module/Magento/Module/src/Resource/Resource.php
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Module\Resource;
+
+use Zend\Db\Sql\Sql;
+use Zend\Db\ResultSet;
+use Magento\Framework\DB\Adapter\AdapterInterface;
+use Magento\Module\ResourceInterface;
+
+/**
+ * Resource Resource Model
+ */
+class Resource implements ResourceInterface
+{
+    const MAIN_TABLE = 'core_resource';
+
+    /**
+     * Database versions
+     *
+     * @var array
+     */
+    protected static $versions = null;
+
+    /**
+     * Table prefix
+     * @var string
+     */
+    protected $tablePrefix;
+
+    /**
+     * @param AdapterInterface $adapter
+     */
+    public function __construct(AdapterInterface $adapter)
+    {
+        $this->adapter = $adapter;
+    }
+
+    /**
+     * Set table prefix
+     *
+     * @param string $tablePrefix
+     * @return void
+     */
+    public function setTablePrefix($tablePrefix)
+    {
+        $this->tablePrefix = $tablePrefix;
+    }
+
+    protected function loadVersionDb()
+    {
+        self::$versions = array();
+        // Db version column always exists
+
+        if ($this->adapter->isTableExists($this->getMainTable())) {
+            $select = $this->adapter->select()->from($this->getMainTable());
+            $sql = new Sql($this->adapter);
+            $selectString = $sql->getSqlStringForSqlObject($select);
+            $results = $this->adapter->query($selectString);
+            if ($results instanceof ResultSet\ResultSetInterface && $results->count()) {
+                foreach ($results as $row) {
+                    self::$versions[$row['code']] = $row['version'];
+                }
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getDbVersion($resName)
+    {
+        if (!$this->adapter) {
+            return false;
+        }
+        $this->loadVersionDb();
+        return isset(self::$versions[$resName]) ? self::$versions[$resName] : false;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function setDbVersion($resName, $version)
+    {
+        $dbModuleInfo = array('code' => $resName, 'version' => $version);
+
+        if ($this->getDbVersion($resName)) {
+            self::$versions[$resName] = $version;
+            return $this->adapter->update(
+                $this->getMainTable(),
+                $dbModuleInfo,
+                array('code = ?' => $resName)
+            );
+        } else {
+            self::$versions[$resName] = $version;
+            return $this->adapter->insert($this->getMainTable(), $dbModuleInfo);
+        }
+    }
+
+    protected function getMainTable()
+    {
+        return $this->adapter->getTableName($this->tablePrefix . self::MAIN_TABLE);
+    }
+}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Load.php b/setup/module/Magento/Module/src/ResourceInterface.php
similarity index 70%
rename from app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Load.php
rename to setup/module/Magento/Module/src/ResourceInterface.php
index 17e8335259e6897851086a9a1067601f662cfde8..78dfdbb9d368378fb0c9d40f27481c150a82fd98 100644
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Load.php
+++ b/setup/module/Magento/Module/src/ResourceInterface.php
@@ -21,23 +21,27 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Module;
 
 /**
- * Block for grid with packages.
- *
- * @author      Magento Core Team <core@magentocommerce.com>
+ * Resource Model Interface
  */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Tab;
-
-class Load extends \Magento\Backend\Block\Template
+interface ResourceInterface
 {
     /**
-     * Retrieve Grid Block HTML
+     * Get Module version from DB
+     *
+     * @param string $resName
+     * @return false|string
+     */
+    public function getDbVersion($resName);
+
+    /**
+     * Set module version into DB
      *
-     * @return string
+     * @param string $resName
+     * @param string $version
+     * @return int
      */
-    public function getPackageGridHtml()
-    {
-        return $this->getChildHtml('local_package_grid');
-    }
+    public function setDbVersion($resName, $version);
 }
diff --git a/lib/internal/Magento/Framework/Connect/Channel/Generator.php b/setup/module/Magento/Module/src/SchemaLocator.php
similarity index 53%
rename from lib/internal/Magento/Framework/Connect/Channel/Generator.php
rename to setup/module/Magento/Module/src/SchemaLocator.php
index 87a328eb958ef2334b95b559f6cbd2fffad46e24..b1ebfeb737608e51d29f585d847fc110d2e76e29 100644
--- a/lib/internal/Magento/Framework/Connect/Channel/Generator.php
+++ b/setup/module/Magento/Module/src/SchemaLocator.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Modules configuration schema locator
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -21,59 +23,48 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Connect\Channel;
 
-use Magento\Framework\Xml\Generator as XmlGenerator;
+namespace Magento\Module;
+
+use Magento\Config\SchemaLocatorInterface;
+use Magento\Config\ConfigFactory;
 
-class Generator extends XmlGenerator
+class SchemaLocator implements SchemaLocatorInterface
 {
     /**
-     * @var string
+     * @var ConfigFactory
      */
-    protected $_file = 'channel.xml';
+    protected $configFactory;
 
     /**
-     * @var XmlGenerator
+     * @var string
      */
-    protected $_generator = null;
+    protected $schemaName;
 
     /**
-     * @param string $file
+     * @param ConfigFactory $configFactory
+     * @param string $schemaName
      */
-    public function __construct($file = '')
-    {
-        if ($file) {
-            $this->_file = $file;
-        }
-        return $this;
+    public function __construct(
+        ConfigFactory $configFactory,
+        $schemaName = 'module.xsd'
+    ) {
+        $this->configFactory = $configFactory;
+        $this->config = $this->configFactory->create();
+        $this->schemaName = $schemaName;
     }
 
     /**
+     * Get path to merged config schema
+     *
      * @return string
      */
-    public function getFile()
-    {
-        return $this->_file;
-    }
-
-    /**
-     * @return XmlGenerator
-     */
-    public function getGenerator()
+    public function getSchema()
     {
-        if (is_null($this->_generator)) {
-            $this->_generator = new XmlGenerator();
-        }
-        return $this->_generator;
-    }
+        $path = $this->config->magento->basePath
+            . $this->config->magento->filesystem->framework
+            . 'Module/etc/' . $this->schemaName;
 
-    /**
-     * @param array $content
-     * @return $this
-     */
-    public function save($content)
-    {
-        $xmlContent = $this->getGenerator()->arrayToXml($content)->save($this->getFile());
-        return $this;
+        return realpath($path);
     }
 }
diff --git a/setup/module/Magento/Module/src/Setup.php b/setup/module/Magento/Module/src/Setup.php
new file mode 100644
index 0000000000000000000000000000000000000000..f600dd7ffbf1cc1024f5d6a9cb0660968eef143e
--- /dev/null
+++ b/setup/module/Magento/Module/src/Setup.php
@@ -0,0 +1,677 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Module;
+
+use Magento\Module\Setup\Connection\AdapterInterface;
+use Magento\Module\Setup\FileResolver as SetupFileResolver;
+use Magento\Module\Resource\Resource;
+use Magento\Module\Updater\SetupInterface;
+use Magento\Setup\Model\Logger;
+
+class Setup implements SetupInterface
+{
+    /**
+     * Setup resource name
+     * @var string
+     */
+    protected $resourceName;
+
+    /**
+     * Setup module configuration object
+     *
+     * @var array
+     */
+    protected $moduleConfig;
+
+    /**
+     * Call afterApplyAllUpdates method flag
+     *
+     * @var boolean
+     */
+    protected $callAfterApplyAllUpdates = false;
+
+    /**
+     * Setup Connection
+     *
+     * @var \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    protected $connection = null;
+
+    /**
+     * Tables cache array
+     *
+     * @var array
+     */
+    protected $tables = array();
+
+    /**
+     * Tables data cache array
+     *
+     * @var array
+     */
+    protected $setupCache = array();
+
+    /**
+     * @var ResourceInterface
+     */
+    protected $resource;
+
+    /**
+     * Filesystem instance
+     *
+     * @var \Magento\Filesystem\Filesystem
+     */
+    protected $filesystem;
+
+    /**
+     * @var SetupFileResolver
+     */
+    protected $setupFileResolver;
+
+    /**
+     * @var Logger
+     */
+    protected $logger;
+
+    /**
+     * @var string
+     */
+    protected $tablePrefix;
+
+    /**
+     * @param AdapterInterface $connection
+     * @param ModuleListInterface $moduleList
+     * @param SetupFileResolver $setupFileResolver
+     * @param Logger $logger
+     * @param $moduleName
+     * @param array $connectionConfig
+     */
+    public function __construct(
+        AdapterInterface $connection,
+        ModuleListInterface $moduleList,
+        SetupFileResolver $setupFileResolver,
+        Logger $logger,
+        $moduleName,
+        array $connectionConfig = array()
+    ) {
+        $this->logger = $logger;
+        $this->connection = $connection->getConnection($connectionConfig);
+        $this->moduleConfig = $moduleList->getModule($moduleName);
+        $this->resource = new Resource($this->connection);
+        $this->setupFileResolver = $setupFileResolver;
+        $this->resourceName = $setupFileResolver->getResourceCode($moduleName);
+    }
+
+    /**
+     * Get connection object
+     *
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    public function getConnection()
+    {
+        return $this->connection;
+    }
+
+    /**
+     * Add table placeholder/table name relation
+     *
+     * @param string $tableName
+     * @param string $realTableName
+     * @return $this
+     */
+    public function setTable($tableName, $realTableName)
+    {
+        $this->tables[$tableName] = $realTableName;
+        return $this;
+    }
+
+    /**
+     * Set table prefix
+     *
+     * @param string $tablePrefix
+     * @return void
+     */
+    public function setTablePrefix($tablePrefix)
+    {
+        $this->tablePrefix = $tablePrefix;
+        $this->resource->setTablePrefix($this->tablePrefix);
+    }
+
+    /**
+     * Get table name (validated by db adapter) by table placeholder
+     *
+     * @param string|array $tableName
+     * @return string
+     */
+    public function getTable($tableName)
+    {
+        $tablePrefix = (string)$this->tablePrefix;
+        if ($tablePrefix && strpos($tableName, $tablePrefix) !== 0) {
+            $tableName = $tablePrefix . $tableName;
+        }
+
+        $cacheKey = $this->getTableCacheName($tableName);
+        if (!isset($this->tables[$cacheKey])) {
+            $this->tables[$cacheKey] = $this->connection->getTableName($tableName);
+        }
+        return $this->tables[$cacheKey];
+    }
+
+    /**
+     * Retrieve table name for cache
+     *
+     * @param string|array $tableName
+     * @return string
+     */
+    protected function getTableCacheName($tableName)
+    {
+        if (is_array($tableName)) {
+            return join('_', $tableName);
+        }
+        return $tableName;
+    }
+
+    /**
+     * Apply data updates to the system after upgrading.
+     *
+     * @return $this
+     */
+    public function applyDataUpdates()
+    {
+        return $this;
+    }
+
+    /**
+     * Apply module resource install, upgrade and data scripts
+     *
+     * @return $this|true
+     */
+    public function applyUpdates()
+    {
+        if (!$this->resourceName) {
+            return $this;
+        }
+        $dbVer = $this->resource->getDbVersion($this->resourceName);
+        $configVer = $this->moduleConfig['schema_version'];
+
+        // Module is installed
+        if ($dbVer !== false) {
+            $status = version_compare($configVer, $dbVer);
+            switch ($status) {
+                case self::VERSION_COMPARE_LOWER:
+                    $this->_rollbackResourceDb($configVer, $dbVer);
+                    break;
+                case self::VERSION_COMPARE_GREATER:
+                    $this->_upgradeResourceDb($dbVer, $configVer);
+                    break;
+                default:
+                    return true;
+                    break;
+            }
+        } elseif ($configVer) {
+            $this->_installResourceDb($configVer);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Run resource installation file
+     *
+     * @param string $newVersion
+     * @return $this
+     */
+    protected function _installResourceDb($newVersion)
+    {
+        $oldVersion = $this->_modifyResourceDb(self::TYPE_DB_INSTALL, '', $newVersion);
+        $this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion);
+        $this->resource->setDbVersion($this->resourceName, $newVersion);
+
+        return $this;
+    }
+
+    /**
+     * Run resource upgrade files from $oldVersion to $newVersion
+     *
+     * @param string $oldVersion
+     * @param string $newVersion
+     * @return $this
+     */
+    protected function _upgradeResourceDb($oldVersion, $newVersion)
+    {
+        $this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion);
+        $this->resource->setDbVersion($this->resourceName, $newVersion);
+
+        return $this;
+    }
+
+    /**
+     * Roll back resource
+     *
+     * @param string $newVersion
+     * @param string $oldVersion
+     * @return $this
+     */
+    protected function _rollbackResourceDb($newVersion, $oldVersion)
+    {
+        $this->_modifyResourceDb(self::TYPE_DB_ROLLBACK, $newVersion, $oldVersion);
+        return $this;
+    }
+
+    /**
+     * Uninstall resource
+     *
+     * @param string $version existing resource version
+     * @return $this
+     */
+    protected function _uninstallResourceDb($version)
+    {
+        $this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
+        return $this;
+    }
+
+    /**
+     * Retrieve available Database install/upgrade files for current module
+     *
+     * @param string $actionType
+     * @param string $fromVersion
+     * @param string $toVersion
+     * @return array
+     */
+    protected function _getAvailableDbFiles($actionType, $fromVersion, $toVersion)
+    {
+        $modName = (string)$this->moduleConfig['name'];
+
+        $dbFiles = array();
+        $typeFiles = array();
+        $regExpDb = sprintf('#%s-(.*)\.(php|sql)$#i', $actionType);
+        $regExpType = sprintf('#%s-%s-(.*)\.(php|sql)$#i', 'mysql4', $actionType);
+        foreach ($this->setupFileResolver->get($modName) as $file) {
+            $matches = array();
+            if (preg_match($regExpDb, $file, $matches)) {
+                $dbFiles[$matches[1]] = $this->setupFileResolver->getAbsolutePath($file);
+            } elseif (preg_match($regExpType, $file, $matches)) {
+                $typeFiles[$matches[1]] = $this->setupFileResolver->getAbsolutePath($file);
+            }
+        }
+
+        if (empty($typeFiles) && empty($dbFiles)) {
+            return array();
+        }
+
+        foreach ($typeFiles as $version => $file) {
+            $dbFiles[$version] = $file;
+        }
+
+        return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $dbFiles);
+    }
+
+    /**
+     * Save resource version
+     *
+     * @param string $actionType
+     * @param string $version
+     * @return $this
+     */
+    protected function _setResourceVersion($actionType, $version)
+    {
+        switch ($actionType) {
+            case self::TYPE_DB_INSTALL:
+            case self::TYPE_DB_UPGRADE:
+                $this->resource->setDbVersion($this->resourceName, $version);
+                break;
+            case self::TYPE_DATA_INSTALL:
+            case self::TYPE_DATA_UPGRADE:
+            default:
+                break;
+        }
+
+        return $this;
+    }
+
+    /**
+     * Run module modification files. Return version of last applied upgrade (false if no upgrades applied)
+     * @param string $actionType
+     * @param string $fromVersion
+     * @param string $toVersion
+     * @return false|string
+     * @throws \Exception
+     */
+    protected function _modifyResourceDb($actionType, $fromVersion, $toVersion)
+    {
+        switch ($actionType) {
+            case self::TYPE_DB_INSTALL:
+            case self::TYPE_DB_UPGRADE:
+                $files = $this->_getAvailableDbFiles($actionType, $fromVersion, $toVersion);
+                break;
+            case self::TYPE_DATA_INSTALL:
+            case self::TYPE_DATA_UPGRADE:
+                break;
+            default:
+                $files = array();
+                break;
+        }
+        if (empty($files) || !$this->getConnection()) {
+            return false;
+        }
+
+        $version = false;
+
+        foreach ($files as $file) {
+            $fileName = $file['fileName'];
+            $fileType = pathinfo($fileName, PATHINFO_EXTENSION);
+            try {
+                switch ($fileType) {
+                    case 'php':
+                        $result = $this->_includeFile($fileName);
+                        break;
+                    default:
+                        $result = false;
+                        break;
+                }
+
+                if ($result) {
+                    $this->_setResourceVersion($actionType, $file['toVersion']);
+                    //@todo log
+                } else {
+                    //@todo log "Failed resource setup: {$fileName}";
+                }
+            } catch (\Exception $e) {
+                $this->logger->logError($e);
+                throw new \Exception(sprintf('Error in file: "%s" - %s', $fileName, $e->getMessage()), 0, $e);
+            }
+            $version = $file['toVersion'];
+        }
+        return $version;
+    }
+
+    /**
+     * Include file by path
+     * This method should perform only file inclusion.
+     * Implemented to prevent possibility of changing important and used variables
+     * inside the setup model while installing
+     *
+     * @param string $fileName
+     * @return mixed
+     */
+    protected function _includeFile($fileName)
+    {
+        return include $fileName;
+    }
+
+    /**
+     * Get data files for modifications
+     *
+     * @param string $actionType
+     * @param string $fromVersion
+     * @param string $toVersion
+     * @param array $arrFiles
+     * @return array
+     */
+    protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles)
+    {
+        $arrRes = [];
+        switch ($actionType) {
+            case self::TYPE_DB_INSTALL:
+            case self::TYPE_DATA_INSTALL:
+                uksort($arrFiles, 'version_compare');
+                foreach ($arrFiles as $version => $file) {
+                    if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) {
+                        $arrRes[0] = [
+                            'toVersion' => $version,
+                            'fileName'  => $file
+                        ];
+                    }
+                }
+                break;
+
+            case self::TYPE_DB_UPGRADE:
+            case self::TYPE_DATA_UPGRADE:
+                uksort($arrFiles, 'version_compare');
+                foreach ($arrFiles as $version => $file) {
+                    $versionInfo = explode('-', $version);
+
+                    // In array must be 2 elements: 0 => version from, 1 => version to
+                    if (count($versionInfo) !== 2) {
+                        break;
+                    }
+                    $infoFrom = $versionInfo[0];
+                    $infoTo   = $versionInfo[1];
+                    if (version_compare($infoFrom, $fromVersion, '>=')
+                        && version_compare($infoTo, $fromVersion, '>')
+                        && version_compare($infoTo, $toVersion, '<=')
+                        && version_compare($infoFrom, $toVersion, '<')
+                    ) {
+                        $arrRes[] = [
+                            'toVersion' => $infoTo,
+                            'fileName'  => $file
+                        ];
+                    }
+                }
+                break;
+
+            case self::TYPE_DB_ROLLBACK:
+            case self::TYPE_DB_UNINSTALL:
+            default:
+                break;
+        }
+        return $arrRes;
+    }
+
+    /******************* UTILITY METHODS *****************/
+
+    /**
+     * Retrieve row or field from table by id or string and parent id
+     *
+     * @param string $table
+     * @param string $idField
+     * @param string|integer $rowId
+     * @param string|null $field
+     * @param string|null $parentField
+     * @param string|integer $parentId
+     * @return mixed
+     */
+    public function getTableRow($table, $idField, $rowId, $field = null, $parentField = null, $parentId = 0)
+    {
+        $table = $this->getTable($table);
+        if (empty($this->setupCache[$table][$parentId][$rowId])) {
+            $adapter = $this->getConnection();
+            $bind = array('id_field' => $rowId);
+            $select = $adapter->select()->from($table)->where($adapter->quoteIdentifier($idField) . '= :id_field');
+            if (null !== $parentField) {
+                $select->where($adapter->quoteIdentifier($parentField) . '= :parent_id');
+                $bind['parent_id'] = $parentId;
+            }
+            $this->setupCache[$table][$parentId][$rowId] = $adapter->query($select, $bind);
+        }
+
+        if (null === $field) {
+            return $this->setupCache[$table][$parentId][$rowId];
+        }
+        return isset(
+            $this->setupCache[$table][$parentId][$rowId][$field]
+        ) ? $this->setupCache[$table][$parentId][$rowId][$field] : false;
+    }
+
+    /**
+     * Delete table row
+     *
+     * @param string $table
+     * @param string $idField
+     * @param string|int $rowId
+     * @param null|string $parentField
+     * @param int|string $parentId
+     * @return $this
+     */
+    public function deleteTableRow($table, $idField, $rowId, $parentField = null, $parentId = 0)
+    {
+        $table = $this->getTable($table);
+        $adapter = $this->getConnection();
+        $where = array($adapter->quoteIdentifier($idField) . '=?' => $rowId);
+        if (!is_null($parentField)) {
+            $where[$adapter->quoteIdentifier($parentField) . '=?'] = $parentId;
+        }
+
+        $adapter->delete($table, $where);
+
+        if (isset($this->setupCache[$table][$parentId][$rowId])) {
+            unset($this->setupCache[$table][$parentId][$rowId]);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Update one or more fields of table row
+     *
+     * @param string $table
+     * @param string $idField
+     * @param string|integer $rowId
+     * @param string|array $field
+     * @param mixed|null $value
+     * @param string $parentField
+     * @param string|integer $parentId
+     * @return $this
+     */
+    public function updateTableRow($table, $idField, $rowId, $field, $value = null, $parentField = null, $parentId = 0)
+    {
+        $table = $this->getTable($table);
+        if (is_array($field)) {
+            $data = $field;
+        } else {
+            $data = array($field => $value);
+        }
+
+        $adapter = $this->getConnection();
+        $where = array($adapter->quoteIdentifier($idField) . '=?' => $rowId);
+        $adapter->update($table, $data, $where);
+
+        if (isset($this->setupCache[$table][$parentId][$rowId])) {
+            if (is_array($field)) {
+                $this->setupCache[$table][$parentId][$rowId] = array_merge(
+                    $this->setupCache[$table][$parentId][$rowId],
+                    $field
+                );
+            } else {
+                $this->setupCache[$table][$parentId][$rowId][$field] = $value;
+            }
+        }
+
+        return $this;
+    }
+
+    /**
+     * Check is table exists
+     *
+     * @param string $table
+     * @return bool
+     */
+    public function tableExists($table)
+    {
+        $table = $this->getTable($table);
+        return $this->getConnection()->isTableExists($table);
+    }
+
+    /**
+     * Prepare database before install/upgrade
+     *
+     * @return $this
+     */
+    public function startSetup()
+    {
+        $this->getConnection()->startSetup();
+        return $this;
+    }
+
+    /**
+     * Prepare database after install/upgrade
+     *
+     * @return $this
+     */
+    public function endSetup()
+    {
+        $this->getConnection()->endSetup();
+        return $this;
+    }
+
+    /**
+     * Retrieve 32bit UNIQUE HASH for a Table index
+     *
+     * @param string $tableName
+     * @param array|string $fields
+     * @param string $indexType
+     * @return string
+     */
+    public function getIdxName($tableName, $fields, $indexType = '')
+    {
+        return $this->connection->getIndexName($tableName, $fields, $indexType);
+    }
+
+    /**
+     * Retrieve 32bit UNIQUE HASH for a Table foreign key
+     *
+     * @param string $priTableName  the target table name
+     * @param string $priColumnName the target table column name
+     * @param string $refTableName  the reference table name
+     * @param string $refColumnName the reference table column name
+     * @return string
+     */
+    public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName)
+    {
+        return $this->connection->getForeignKeyName($priTableName, $priColumnName, $refTableName, $refColumnName);
+    }
+
+    /**
+     * Check call afterApplyAllUpdates method for setup class
+     *
+     * @return bool
+     */
+    public function getCallAfterApplyAllUpdates()
+    {
+        return $this->callAfterApplyAllUpdates;
+    }
+
+    /**
+     * Run each time after applying of all updates,
+     * if setup model setted $_callAfterApplyAllUpdates flag to true
+     *
+     * @return $this
+     */
+    public function afterApplyAllUpdates()
+    {
+        return $this;
+    }
+
+    public function addConfigData($key, $value)
+    {
+        $this->getConnection()->insert(
+            $this->getTable('core_config_data'),
+            array(
+                'path'  => $key,
+                'value' => $value
+            ),
+            true
+        );
+    }
+}
diff --git a/setup/module/Magento/Module/src/Setup/Config.php b/setup/module/Magento/Module/src/Setup/Config.php
new file mode 100644
index 0000000000000000000000000000000000000000..05f83b79739b37ce390a06965576b97577468e3b
--- /dev/null
+++ b/setup/module/Magento/Module/src/Setup/Config.php
@@ -0,0 +1,192 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module\Setup;
+
+use Magento\Filesystem\Directory\Write;
+use Magento\Filesystem\Filesystem;
+
+/**
+ * Config installer
+ */
+class Config
+{
+    const TMP_INSTALL_DATE_VALUE = 'd-d-d-d-d';
+
+    const TMP_ENCRYPT_KEY_VALUE = 'k-k-k-k-k';
+
+    /**
+     * Path to local configuration file
+     *
+     * @var string
+     */
+    protected $localConfigFile = 'local.xml';
+
+    /**
+     * @var array
+     */
+    protected $configData = array();
+
+    /**
+     * @var Filesystem
+     */
+    protected $filesystem;
+
+    /**
+     * @var Write
+     */
+    protected $configDirectory;
+
+    /**
+     * @param Filesystem $filesystem
+     */
+    public function __construct(
+        Filesystem $filesystem
+    ) {
+        $this->filesystem = $filesystem;
+        $this->configDirectory = $filesystem->getDirectoryWrite('etc');
+    }
+
+    /**
+     * @param array $data
+     * @return $this
+     */
+    public function setConfigData($data)
+    {
+        if (is_array($data)) {
+            $this->configData = $this->convert($data);
+        }
+        return $this;
+    }
+
+
+    /**
+     * Retrieve config data
+     *
+     * @return array
+     */
+    public function getConfigData()
+    {
+        return $this->configData;
+    }
+
+    /**
+     * Generate installation data and record them into local.xml using local.xml.template
+     *
+     * @return void
+     */
+    public function install()
+    {
+        $this->configData['date'] = self::TMP_INSTALL_DATE_VALUE;
+        $this->configData['key'] = self::TMP_ENCRYPT_KEY_VALUE;
+
+        $this->checkData();
+
+        $contents = $this->configDirectory->readFile('local.xml.template');
+        foreach ($this->configData as $index => $value) {
+            $contents = str_replace('{{' . $index . '}}', '<![CDATA[' . $value . ']]>', $contents);
+        }
+
+        $this->configDirectory->writeFile($this->localConfigFile, $contents, LOCK_EX);
+        $this->configDirectory->changePermissions($this->localConfigFile, 0777);
+    }
+
+    /**
+     * @param string $date
+     * @return $this
+     */
+    public function replaceTmpInstallDate($date = 'now')
+    {
+        $stamp = strtotime((string)$date);
+        $localXml = $this->configDirectory->readFile($this->localConfigFile);
+        $localXml = str_replace(self::TMP_INSTALL_DATE_VALUE, date('r', $stamp), $localXml);
+        $this->configDirectory->writeFile($this->localConfigFile, $localXml, LOCK_EX);
+
+        return $this;
+    }
+
+    /**
+     * @param string $key
+     * @return $this
+     */
+    public function replaceTmpEncryptKey($key)
+    {
+        $localXml = $this->configDirectory->readFile($this->localConfigFile);
+        $localXml = str_replace(self::TMP_ENCRYPT_KEY_VALUE, $key, $localXml);
+        $this->configDirectory->writeFile($this->localConfigFile, $localXml, LOCK_EX);
+
+        return $this;
+    }
+
+    /**
+     * Convert config
+     * @param array $source
+     * @return array
+     */
+    protected function convert(array $source = array())
+    {
+        $result = array();
+        $result['db_host'] = isset($source['db']['host']) ? $source['db']['host'] : '';
+        $result['db_name'] = isset($source['db']['name']) ? $source['db']['name'] : '';
+        $result['db_user'] = isset($source['db']['user']) ? $source['db']['user'] :'';
+        $result['db_pass'] = isset($source['db']['password']) ? $source['db']['password'] : '';
+        $result['db_prefix'] = isset($source['db']['tablePrefix']) ? $source['db']['tablePrefix'] : '';
+        $result['session_save'] = 'files';
+        $result['backend_frontname'] = isset($source['config']['address']['admin'])
+            ? $source['config']['address']['admin']
+            : '';
+        $result['db_model'] = '';
+        $result['db_init_statements'] = '';
+
+        $result['admin_username'] = isset($source['admin']['username']) ? $source['admin']['username'] : '';
+        $result['admin_password'] = isset($source['admin']['password']) ? $source['admin']['password'] : '';
+        $result['admin_email'] = isset($source['admin']['email']) ? $source['admin']['email'] : '';
+
+        return $result;
+    }
+
+    /**
+     * Check database connection data
+     *
+     * @throws \Exception
+     */
+    protected function checkData()
+    {
+        if (!isset($this->configData['db_name']) || empty($this->configData['db_name'])) {
+            throw new \Exception('The Database Name field cannot be empty.');
+        }
+        //make all table prefix to lower letter
+        if ($this->configData['db_prefix'] != '') {
+            $this->configData['db_prefix'] = strtolower($this->configData['db_prefix']);
+        }
+        //check table prefix
+        if ($this->configData['db_prefix'] != '') {
+            if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $this->configData['db_prefix'])) {
+                throw new \Exception(
+                    'The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_); the first character should be a letter.'
+                );
+            }
+        }
+    }
+}
diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php b/setup/module/Magento/Module/src/Setup/Connection/Adapter.php
similarity index 55%
rename from app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php
rename to setup/module/Magento/Module/src/Setup/Connection/Adapter.php
index a10a68c28e7a883ea398aa8b48a1d20b410d3cf0..9e70b4892911dec732ced95bbdb594d3fbe664b0 100644
--- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php
+++ b/setup/module/Magento/Module/src/Setup/Connection/Adapter.php
@@ -21,31 +21,29 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Module\Setup\Connection;
 
-/**
- * Extension edit form
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Block\Adminhtml\Extension\Custom\Edit;
+use Magento\Framework\DB\Adapter\Pdo\Mysql;
 
-class Form extends \Magento\Backend\Block\Widget\Form\Generic
+class Adapter implements AdapterInterface
 {
     /**
-     * Prepare Extension Package Form
+     * Get connection
      *
-     * @return \Magento\Connect\Block\Adminhtml\Extension\Custom\Edit\Form
+     * @param array $config
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface|null
      */
-    protected function _prepareForm()
+    public function getConnection(array $config = array())
     {
-        /** @var \Magento\Framework\Data\Form $form */
-        $form = $this->_formFactory->create(
-            array('data' => array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'))
+        return new Mysql(
+            [
+                'driver'         => "Pdo",
+                'dsn'            => "mysql:dbname=" . $config['db_name'] . ";host=" . $config['db_host'],
+                'username'       => $config['db_user'],
+                'password'       => isset($config['db_pass']) ? $config['db_pass'] : null,
+                'driver_options' => [
+                    \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"]
+            ]
         );
-
-        $form->setUseContainer(true);
-        $this->setForm($form);
-
-        return parent::_prepareForm();
     }
 }
diff --git a/downloader/lib/Magento/Framework/Backup/Db/BackupDbInterface.php b/setup/module/Magento/Module/src/Setup/Connection/AdapterInterface.php
similarity index 79%
rename from downloader/lib/Magento/Framework/Backup/Db/BackupDbInterface.php
rename to setup/module/Magento/Module/src/Setup/Connection/AdapterInterface.php
index 4fe3293880c47308d17731df0416a7273f29234d..9405adf750d86ef00dd2e27847d7d3e321e56183 100644
--- a/downloader/lib/Magento/Framework/Backup/Db/BackupDbInterface.php
+++ b/setup/module/Magento/Module/src/Setup/Connection/AdapterInterface.php
@@ -21,15 +21,15 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Backup\Db;
+namespace Magento\Module\Setup\Connection;
 
-interface BackupDbInterface
+interface AdapterInterface
 {
     /**
-     * Create DB backup
+     * Get connection
      *
-     * @param BackupInterface $backup
-     * @return void
+     * @param array $config
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface|null
      */
-    public function createBackup(\Magento\Framework\Backup\Db\BackupInterface $backup);
+    public function getConnection(array $config = array());
 }
diff --git a/setup/module/Magento/Module/src/Setup/FileResolver.php b/setup/module/Magento/Module/src/Setup/FileResolver.php
new file mode 100644
index 0000000000000000000000000000000000000000..a9e6a83c5ad7645891dfe2ed3502d59148866c68
--- /dev/null
+++ b/setup/module/Magento/Module/src/Setup/FileResolver.php
@@ -0,0 +1,144 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module\Setup;
+
+use Zend\Stdlib\Glob;
+use Magento\Config\FileResolverInterface;
+use Magento\Config\FileIteratorFactory;
+use Magento\Config\ConfigFactory;
+
+class FileResolver implements FileResolverInterface
+{
+    /**
+     * @var FileIteratorFactory
+     */
+    protected $iteratorFactory;
+
+    /**
+     * @var ConfigFactory
+     */
+    protected $configFactory;
+
+    /**
+     * @var Config
+     */
+    protected $config;
+
+    /**
+     * @param FileIteratorFactory $iteratorFactory
+     * @param ConfigFactory $configFactory
+     */
+    public function __construct(
+        FileIteratorFactory $iteratorFactory,
+        ConfigFactory $configFactory
+    ) {
+        $this->iteratorFactory = $iteratorFactory;
+        $this->configFactory = $configFactory;
+        $this->config = $this->configFactory->create();
+    }
+
+    /**
+     * @param string $moduleName
+     * @return array
+     */
+    public function get($moduleName)
+    {
+        $paths = [];
+        $modulePath = str_replace('_', '/', $moduleName);
+        // Collect files by /app/code/{modulePath}/sql/*/*.php pattern
+        $files = $this->getFiles($this->config->getMagentoModulePath() . $modulePath . '/sql/*/*.php');
+        foreach ($files as $file) {
+            $paths[] = $this->getRelativePath($file);
+        }
+
+        return $paths;
+    }
+
+    /**
+     * Retrieves relative path
+     *
+     * @param string $path
+     * @return string
+     */
+    protected function getRelativePath($path = null)
+    {
+        $basePath = $this->config->getMagentoBasePath();
+        if (strpos($path, $basePath) === 0
+            || $basePath == $path . '/') {
+            $result = substr($path, strlen($basePath));
+        } else {
+            $result = $path;
+        }
+        return $result;
+    }
+
+    /**
+     * @param string $path
+     * @return array|false
+     */
+    protected function getFiles($path)
+    {
+        return Glob::glob($this->config->getMagentoBasePath() . $path);
+    }
+
+    /**
+     * @param string $moduleName
+     * @return string
+     */
+    public function getResourceCode($moduleName)
+    {
+        $codes = [];
+        $modulePath = str_replace('_', '/', $moduleName);
+        // Collect files by /app/code/{modulePath}/sql/*/ pattern
+        $files = $this->getFiles($this->config->getMagentoModulePath() . $modulePath . '/sql/*/');
+        foreach ($files as $file) {
+            $pieces = explode('/', rtrim($this->fixSeparator($file), '/'));
+            $codes[] = array_pop($pieces);
+        }
+
+        return array_shift($codes);
+    }
+
+    /**
+     * @param string $path
+     * @return string
+     */
+    public function getAbsolutePath($path)
+    {
+        return $this->config->getMagentoBasePath() . '/' . ltrim($this->fixSeparator($path), '/');
+    }
+
+    /**
+     * Fixes path separator
+     * Utility method.
+     *
+     * @param string $path
+     * @return string
+     */
+    protected function fixSeparator($path)
+    {
+        return str_replace('\\', '/', $path);
+    }
+}
diff --git a/setup/module/Magento/Module/src/SetupFactory.php b/setup/module/Magento/Module/src/SetupFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..b589e4d82c4c8aac36abb724b31c3a2abc6071d4
--- /dev/null
+++ b/setup/module/Magento/Module/src/SetupFactory.php
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Module;
+
+use Magento\Module\Setup\Connection\AdapterInterface;
+use Magento\Setup\Model\Logger;
+
+class SetupFactory
+{
+    /**
+     * @var AdapterInterface
+     */
+    protected $adapter;
+
+    /**
+     * @var ModuleListInterface
+     */
+    protected $moduleList;
+
+    /**
+     * @var Setup\FileResolver
+     */
+    protected $fileResolver;
+
+    /**
+     * @var array
+     */
+    protected $configuration = [];
+
+    /**
+     * @var Logger
+     */
+    protected $logger;
+
+    /**
+     * @param AdapterInterface $connection
+     * @param ModuleListInterface $moduleList
+     * @param Setup\FileResolver $setupFileResolver
+     * @param Logger $logger
+     */
+    public function __construct(
+        AdapterInterface $connection,
+        ModuleListInterface $moduleList,
+        Setup\FileResolver $setupFileResolver,
+        Logger $logger
+    ) {
+        $this->logger = $logger;
+        $this->adapter = $connection;
+        $this->moduleList = $moduleList;
+        $this->fileResolver = $setupFileResolver;
+    }
+
+    /**
+     * @param array $config
+     */
+    public function setConfig(array $config)
+    {
+        $this->configuration = $config;
+    }
+
+    /**
+     * @param string $moduleName
+     * @return Setup
+     */
+    public function create($moduleName)
+    {
+        $setup =  new Setup(
+            $this->adapter,
+            $this->moduleList,
+            $this->fileResolver,
+            $this->logger,
+            $moduleName,
+            $this->configuration
+        );
+        $setup->setTablePrefix($this->configuration['db_prefix']);
+
+        return $setup;
+    }
+}
diff --git a/setup/module/Magento/Module/src/Updater/SetupInterface.php b/setup/module/Magento/Module/src/Updater/SetupInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..9822d520f5d60b850f2545aedfb456387ec3a708
--- /dev/null
+++ b/setup/module/Magento/Module/src/Updater/SetupInterface.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Module\Updater;
+
+interface SetupInterface
+{
+    const DEFAULT_SETUP_CONNECTION = 'setup_setup';
+
+    const VERSION_COMPARE_EQUAL = 0;
+
+    const VERSION_COMPARE_LOWER = -1;
+
+    const VERSION_COMPARE_GREATER = 1;
+
+    const TYPE_DB_INSTALL = 'install';
+
+    const TYPE_DB_UPGRADE = 'upgrade';
+
+    const TYPE_DB_ROLLBACK = 'rollback';
+
+    const TYPE_DB_UNINSTALL = 'uninstall';
+
+    const TYPE_DATA_INSTALL = 'data-install';
+
+    const TYPE_DATA_UPGRADE = 'data-upgrade';
+
+    /**
+     * Apply module resource install, upgrade and data scripts
+     *
+     * @return \Magento\Framework\Module\Updater\SetupInterface
+     */
+    public function applyUpdates();
+
+    /**
+     * Check call afterApplyAllUpdates method for setup class
+     *
+     * @return boolean
+     * @SuppressWarnings(PHPMD.BooleanGetMethodName)
+     */
+    public function getCallAfterApplyAllUpdates();
+
+    /**
+     * Run each time after applying of all updates,
+     *
+     * @return \Magento\Framework\Module\Updater\SetupInterface
+     */
+    public function afterApplyAllUpdates();
+
+    /**
+     *  Apply data updates to the system after upgrading
+     *
+     * @return void
+     */
+    public function applyDataUpdates();
+}
diff --git a/setup/module/Magento/Setup/.gitignore b/setup/module/Magento/Setup/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..c7f4956653dae59057365b65bc17444f0d842f07
--- /dev/null
+++ b/setup/module/Magento/Setup/.gitignore
@@ -0,0 +1,2 @@
+vendor/
+phpunit.xml
diff --git a/setup/module/Magento/Setup/Module.php b/setup/module/Magento/Setup/Module.php
new file mode 100644
index 0000000000000000000000000000000000000000..98a9ae065b18d71da61c77ab4a95272900a55eef
--- /dev/null
+++ b/setup/module/Magento/Setup/Module.php
@@ -0,0 +1,106 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup;
+
+use Zend\ModuleManager\Feature\BootstrapListenerInterface;
+use Zend\ModuleManager\Feature\ConfigProviderInterface;
+use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
+use Zend\Mvc\ModuleRouteListener;
+use Zend\Mvc\MvcEvent;
+use Zend\EventManager\EventInterface;
+use Magento\Setup\Mvc\View\Http\InjectTemplateListener;
+
+class Module implements
+    BootstrapListenerInterface,
+    ConfigProviderInterface,
+    AutoloaderProviderInterface
+{
+    /**
+     * @param EventInterface $e
+     * @return void
+     */
+    public function onBootstrap(EventInterface $e)
+    {
+        /** @var \Zend\Mvc\MvcEvent $e */
+        /** @var \Zend\Mvc\Application $application */
+        $application = $e->getApplication();
+        /** @var \Zend\EventManager\EventManager $events */
+        $events = $application->getEventManager();
+        /** @var \Zend\EventManager\SharedEventManager $sharedEvents */
+        $sharedEvents = $events->getSharedManager();
+
+        $moduleRouteListener = new ModuleRouteListener();
+        $moduleRouteListener->attach($events);
+
+        // Override Zend\Mvc\View\Http\InjectTemplateListener
+        // to process templates by Vendor/Module
+        $injectTemplateListener = new InjectTemplateListener();
+        $translator = $application->getServiceManager()->get('translator');
+        $sharedEvents->attach(
+            'Zend\Stdlib\DispatchableInterface',
+            MvcEvent::EVENT_DISPATCH,
+            [
+                new \Magento\Setup\Model\Location($translator),
+                'onChangeLocation'
+            ],
+            10
+        );
+        $sharedEvents->attach(
+            'Zend\Stdlib\DispatchableInterface',
+            MvcEvent::EVENT_DISPATCH,
+            [$injectTemplateListener, 'injectTemplate'],
+            -89
+        );
+
+    }
+
+    /**
+     * @return array|mixed|\Traversable
+     */
+    public function getConfig()
+    {
+        return array_merge(
+            include __DIR__ . '/config/module.config.php',
+            include __DIR__ . '/config/router.config.php',
+            include __DIR__ . '/config/di.config.php',
+            include __DIR__ . '/config/states.config.php',
+            include __DIR__ . '/config/languages.config.php'
+        );
+    }
+
+    /**
+     * @return array
+     */
+    public function getAutoloaderConfig()
+    {
+        return array(
+            'Zend\Loader\StandardAutoloader' => array(
+                'namespaces' => array(
+                    __NAMESPACE__ => __DIR__ . '/src/',
+                ),
+            ),
+        );
+    }
+}
diff --git a/setup/module/Magento/Setup/config/di.config.php b/setup/module/Magento/Setup/config/di.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..d79148db72db0fbabcb90dbd2dcd31eae7e659ad
--- /dev/null
+++ b/setup/module/Magento/Setup/config/di.config.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'di' => [
+        'allowed_controllers' => [
+            'Magento\Setup\Controller\ReadinessCheckController',
+            'Magento\Setup\Controller\ReadinessCheck\ProgressController',
+            'Magento\Setup\Controller\AddDatabaseController',
+            'Magento\Setup\Controller\WebConfigurationController',
+            'Magento\Setup\Controller\CustomizeYourStoreController',
+            'Magento\Setup\Controller\CreateAdminAccountController',
+            'Magento\Setup\Controller\SuccessController',
+            'Magento\Setup\Controller\Success\EncryptionController',
+            'Magento\Setup\Controller\InstallController',
+            'Magento\Setup\Controller\Install\ProgressController',
+            'Magento\Setup\Controller\Install\StartController',
+            'Magento\Setup\Controller\IndexController',
+            'Magento\Setup\Controller\LandingController',
+            'Magento\Setup\Controller\EnvironmentController',
+            'Magento\Setup\Controller\UserController',
+
+            'Magento\Setup\Controller\Controls\HeaderController',
+            'Magento\Setup\Controller\Controls\MenuController',
+            'Magento\Setup\Controller\Controls\NavbarController',
+
+            'Magento\Setup\Controller\Data\FilePermissionsController',
+            'Magento\Setup\Controller\Data\PhpExtensionsController',
+            'Magento\Setup\Controller\Data\PhpVersionController',
+            'Magento\Setup\Controller\Data\StatesController',
+            'Magento\Setup\Controller\Data\DatabaseController',
+            'Magento\Setup\Controller\Data\LanguagesController',
+        ],
+        'instance' => [
+            'preference' => [
+                'Zend\EventManager\EventManagerInterface' => 'EventManager',
+                'Zend\ServiceManager\ServiceLocatorInterface' => 'ServiceManager',
+            ]
+        ],
+    ],
+];
diff --git a/app/code/Magento/Contact/sql/contact_setup/install-1.6.0.0.php b/setup/module/Magento/Setup/config/languages.config.php
similarity index 89%
rename from app/code/Magento/Contact/sql/contact_setup/install-1.6.0.0.php
rename to setup/module/Magento/Setup/config/languages.config.php
index 72f724d02c26972f7be2e0228f14eb939cc69d6e..ae122dbccf2d4c5843430dbd86432a83b5717464 100644
--- a/app/code/Magento/Contact/sql/contact_setup/install-1.6.0.0.php
+++ b/setup/module/Magento/Setup/config/languages.config.php
@@ -22,6 +22,9 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-
-/* @var $installer \Magento\Core\Model\Resource\Setup */
-$installer = $this;
+return [
+    'languages' => [
+        'en_US' => 'United State',
+        'ua_UK' => 'Ukrainian',
+    ]
+];
diff --git a/setup/module/Magento/Setup/config/module.config.php b/setup/module/Magento/Setup/config/module.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..522e328cc857b4a1941b59279a46ab31e2aa1005
--- /dev/null
+++ b/setup/module/Magento/Setup/config/module.config.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'view_manager' => [
+        'display_not_found_reason' => true,
+        'display_exceptions'       => true,
+        'doctype'                  => 'HTML5',
+        'not_found_template'       => 'error/404',
+        'exception_template'       => 'error/index',
+        'template_map' => [
+            'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
+            'error/404'               => __DIR__ . '/../view/error/404.phtml',
+            'error/index'             => __DIR__ . '/../view/error/index.phtml',
+        ],
+        'template_path_stack' => [
+            'setup' => __DIR__ . '/../view',
+        ],
+        'strategies' => ['ViewJsonStrategy'],
+    ],
+    'translator' => [
+        'translation_file_patterns' => [
+            [
+                'type' => 'gettext',
+                'base_dir' => __DIR__ . '/../lang',
+                'pattern' => '%s.mo',
+            ],
+        ],
+    ],
+    'service_manager' => [
+        'aliases' => [
+            'translator' => 'MvcTranslator',
+        ],
+    ],
+];
diff --git a/setup/module/Magento/Setup/config/router.config.php b/setup/module/Magento/Setup/config/router.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..ad704f2193fad6ca36f3352731239b602fdfc267
--- /dev/null
+++ b/setup/module/Magento/Setup/config/router.config.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'route_manager' => [
+        'invokables' => [
+            'setup' => 'Magento\Setup\Mvc\Router\Http\Setup',
+        ],
+    ],
+    'router' => [
+        'routes' => [
+            'setup' => [
+                'type' => 'setup',
+                'options' => [
+                    'regex'    => '\b(?<lang>[\w]+).*\/(?<controller>[\w-\/]+)$',
+                    'defaults' => [
+                        '__NAMESPACE__' => 'Magento\Setup\Controller',
+                        'action' => 'index',
+                    ],
+                    'spec' => '%controller%',
+                ],
+            ],
+            'home' => [
+                'type' => 'literal',
+                'options' => [
+                    'route'    => '/',
+                    'constraints' => [
+                        'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
+                    ],
+                    'defaults' => [
+                        'controller' => 'Magento\Setup\Controller\IndexController',
+                        'action'     => 'index',
+                    ]
+                ],
+            ],
+        ],
+    ],
+];
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/config/states.config.php b/setup/module/Magento/Setup/config/states.config.php
new file mode 100644
index 0000000000000000000000000000000000000000..ea5d176294a49f131ee65e2b3b6c0e0b85d433e7
--- /dev/null
+++ b/setup/module/Magento/Setup/config/states.config.php
@@ -0,0 +1,123 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+return [
+    'nav' => [
+        [
+            'id'          => 'root',
+            'step'        => 0,
+            'views'       => ['root' => []]
+        ],
+        [
+            'id'          => 'root.landing',
+            'url'         => 'landing',
+            'templateUrl' => 'landing',
+            'title'       => 'Landing',
+            'controller'  => 'landingController',
+            'main'        => true,
+            'default'     => true,
+            'order'       => 0,
+        ],
+        [
+            'id'          => 'root.readiness-check',
+            'url'         => 'readiness-check',
+            'templateUrl' => 'readiness-check',
+            'title'       => 'Readiness Check',
+            'header'      => 'Step 1: Readiness Check',
+            'nav-bar'     => true,
+            'order'       => 1,
+        ],
+        [
+            'id'          => 'root.readiness-check.progress',
+            'url'         => 'readiness-check/progress',
+            'templateUrl' => 'readiness-check/progress',
+            'title'       => 'Readiness Check',
+            'header'      => 'Step 1: Readiness Check',
+            'controller'  => 'readinessCheckController',
+            'nav-bar'     => false,
+            'order'       => 2,
+        ],
+        [
+            'id'          => 'root.add-database',
+            'url'         => 'add-database',
+            'templateUrl' => 'add-database',
+            'title'       => 'Add a Database',
+            'header'      => 'Step 2: Add a Database',
+            'controller'  => 'addDatabaseController',
+            'nav-bar'     => true,
+            'validate'    => true,
+            'order'       => 3,
+        ],
+        [
+            'id'          => 'root.web-configuration',
+            'url'         => 'web-configuration',
+            'templateUrl' => 'web-configuration',
+            'title'       => 'Web Configuration',
+            'header'      => 'Step 3: Web Configuration',
+            'controller'  => 'webConfigurationController',
+            'nav-bar'     => true,
+            'validate'    => true,
+            'order'       => 4,
+        ],
+        [
+            'id'          => 'root.customize-your-store',
+            'url'         => 'customize-your-store',
+            'templateUrl' => 'customize-your-store',
+            'title'       => 'Customize Your Store',
+            'header'      => 'Step 4: Customize Your Store',
+            'controller'  => 'customizeYourStoreController',
+            'nav-bar'     => true,
+            'order'       => 5,
+        ],
+        [
+            'id'          => 'root.create-admin-account',
+            'url'         => 'create-admin-account',
+            'templateUrl' => 'create-admin-account',
+            'title'       => 'Create Admin Account',
+            'header'      => 'Step 5: Create Admin Account',
+            'controller'  => 'createAdminAccountController',
+            'nav-bar'     => true,
+            'validate'    => true,
+            'order'       => 6,
+        ],
+        [
+            'id'          => 'root.install',
+            'url'         => 'install',
+            'templateUrl' => 'install',
+            'title'       => 'Install',
+            'header'      => 'Step 6: Install',
+            'controller'  => 'installController',
+            'nav-bar'     => true,
+            'order'       => 7,
+        ],
+        [
+            'id'          => 'root.success',
+            'url'         => 'success',
+            'templateUrl' => 'success',
+            'controller'  => 'successController',
+            'main'        => true,
+            'order'       => 8,
+        ],
+    ]
+];
diff --git a/setup/module/Magento/Setup/lang/en_US.mo b/setup/module/Magento/Setup/lang/en_US.mo
new file mode 100644
index 0000000000000000000000000000000000000000..46ea5277212f0e15b38389d04c094cbaa6731f82
Binary files /dev/null and b/setup/module/Magento/Setup/lang/en_US.mo differ
diff --git a/setup/module/Magento/Setup/lang/en_US.po b/setup/module/Magento/Setup/lang/en_US.po
new file mode 100644
index 0000000000000000000000000000000000000000..923e9ac0953601d7b867a0abf3700559c326d92f
--- /dev/null
+++ b/setup/module/Magento/Setup/lang/en_US.po
@@ -0,0 +1,280 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Magento Setup Tool\n"
+"POT-Creation-Date: 2014-07-01 16:53+0300\n"
+"PO-Revision-Date: 2014-07-01 16:53+0300\n"
+"Last-Translator: Andriy Nasinnyk <anasinnyk@ebay.com>\n"
+"Language-Team: Magento South <DL-Magento-South@ebay.com>\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop;translate\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-SearchPath-0: /home/nas/projects/magento2/setup/module/Magento/"
+"Setup\n"
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:1
+msgid "A 404 error occurred"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:10
+msgid "The requested controller was unable to dispatch the request."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:13
+msgid ""
+"The requested controller could not be mapped to an existing controller class."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:16
+msgid "The requested controller was not dispatchable."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:19
+msgid "The requested URL could not be matched by routing."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:22
+msgid "We cannot determine at this time why a 404 was generated."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:34
+msgid "Controller"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:41
+#, php-format
+msgid "resolves to %s"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:53
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:8
+msgid "Additional information"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:56
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:80
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:11
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:35
+msgid "File"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:60
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:84
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:15
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:39
+msgid "Message"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:64
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:88
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:19
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:43
+msgid "Stack trace"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:74
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:29
+msgid "Previous exceptions"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:103
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:58
+msgid "No Exception available"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:1
+msgid "An error occurred"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/layout/layout.phtml:6
+msgid "Magento Setup Tool"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml:8
+msgid ""
+"Let's check your environment for the corrent PHP version, PHP extensions, "
+"file permissions and compatibility."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml:10
+msgid "Start Readiness Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:2
+msgid "Magento"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:4
+msgid "Version x.x.x"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:8
+msgid ""
+"Welcome to Magento Admin, your online store headquarters.\n"
+"    Click 'Agree and Set Up Magento' or read <a href=\"#/getting-start"
+"\">Getting Start</a> to learn more."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:13
+msgid "Choose a language:"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:21
+msgid "Terms & Agreement"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:24
+msgid "Agree and Set Up Magento"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:23
+msgid "Completed! You need to resolve these issues to continue."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:24
+msgid "Completed!"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:28
+msgid ""
+"We're making sure your server environment is ready for Magento to be "
+"installed."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:34
+msgid "Checking PHP Version..."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:39
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:50
+msgid "PHP Version Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:41
+msgid "Your PHP version is correct ({{version.data.current}})."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:46
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:153
+msgid "Need Help?"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:47
+msgid "PHP Documentation"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:53
+msgid ""
+"Your PHP version is {{version.data.current}}. The required PHP version is "
+"{{version.data.required}}."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:55
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:80
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:105
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:137
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:162
+msgid "More detail"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:56
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:81
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:106
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:138
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:163
+msgid "Less detail"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:60
+msgid ""
+"Donwload and install PHP version {{version.data.required}} from <a href="
+"\"http://www.php.net\" target=\"_blank\">www.php.net</a> using this <a href="
+"\"http://www.php.net/docs.php\" target=\"_blank\">PHP Documentation</a>."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:61
+msgid "If you need more help please call your hosting provider."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:70
+msgid "Checking PHP Extensions..."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:75
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:100
+msgid "PHP Extensions Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:78
+msgid ""
+"You meet {{extensions.data.current.length}} out of {{extensions.data."
+"required.length}} PHP extensions requirements."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:88
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:116
+msgid "PHP Extension {{name}}."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:97
+msgid "PHP Extension Help"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:103
+msgid ""
+"{{extensions.data.required.length - extensions.data.current.length}} missing "
+"PHP extensions."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:109
+msgid ""
+"The best way to resolve this is to install the correct missing extensions. "
+"The exact fix depends on our server, your host, and other system variables.</"
+"br>Our <a href=\"#\">PHP Extension Help</a> can get you started."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:110
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:167
+msgid "If you need more help, please call your hosting provider."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:127
+msgid "Checking File Permissions..."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:132
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:157
+msgid "File Permission Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:135
+msgid ""
+"You meet {{permissions.data.current.length}} out of {{permissions.data."
+"required.length}} file permission requirements."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:145
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:173
+msgid "\"{{name}}\" directory permission."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:154
+msgid "File Permission Help"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:160
+msgid ""
+"{{permissions.data.required.length - permissions.data.current.length}} file "
+"permission not met."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:166
+msgid ""
+"The best way to resolve this is to allow write permissions for the following "
+"Magento directories. The exact fix depends on your server, your host, and "
+"other system variables.</br>Our <a href=\"#\">File Permission Help</a> can "
+"get you started."
+msgstr ""
diff --git a/setup/module/Magento/Setup/lang/ua_UK.mo b/setup/module/Magento/Setup/lang/ua_UK.mo
new file mode 100644
index 0000000000000000000000000000000000000000..b251f529126c891936138b6e4fb46e86b8366b8d
Binary files /dev/null and b/setup/module/Magento/Setup/lang/ua_UK.mo differ
diff --git a/setup/module/Magento/Setup/lang/ua_UK.po b/setup/module/Magento/Setup/lang/ua_UK.po
new file mode 100644
index 0000000000000000000000000000000000000000..b601e17bc96b524bd0d7aad4dd9d69612e29b913
--- /dev/null
+++ b/setup/module/Magento/Setup/lang/ua_UK.po
@@ -0,0 +1,280 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Magento Setup Tool\n"
+"POT-Creation-Date: 2014-07-01 16:53+0300\n"
+"PO-Revision-Date: 2014-07-01 16:58+0300\n"
+"Last-Translator: Andriy Nasinnyk <anasinnyk@ebay.com>\n"
+"Language-Team: Magento South <DL-Magento-South@ebay.com>\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop;translate\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-SearchPath-0: /home/nas/projects/magento2/setup/module/Magento/"
+"Setup\n"
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:1
+msgid "A 404 error occurred"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:10
+msgid "The requested controller was unable to dispatch the request."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:13
+msgid ""
+"The requested controller could not be mapped to an existing controller class."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:16
+msgid "The requested controller was not dispatchable."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:19
+msgid "The requested URL could not be matched by routing."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:22
+msgid "We cannot determine at this time why a 404 was generated."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:34
+msgid "Controller"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:41
+#, php-format
+msgid "resolves to %s"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:53
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:8
+msgid "Additional information"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:56
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:80
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:11
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:35
+msgid "File"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:60
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:84
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:15
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:39
+msgid "Message"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:64
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:88
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:19
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:43
+msgid "Stack trace"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:74
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:29
+msgid "Previous exceptions"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/404.phtml:103
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:58
+msgid "No Exception available"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/error/index.phtml:1
+msgid "An error occurred"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/layout/layout.phtml:6
+msgid "Magento Setup Tool"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml:8
+msgid ""
+"Let's check your environment for the corrent PHP version, PHP extensions, "
+"file permissions and compatibility."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml:10
+msgid "Start Readiness Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:2
+msgid "Magento"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:4
+msgid "Version x.x.x"
+msgstr "Версія x.x.x"
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:8
+msgid ""
+"Welcome to Magento Admin, your online store headquarters.\n"
+"    Click 'Agree and Set Up Magento' or read <a href=\"#/getting-start"
+"\">Getting Start</a> to learn more."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:13
+msgid "Choose a language:"
+msgstr "Оберіть мову:"
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:21
+msgid "Terms & Agreement"
+msgstr "Умови використання"
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/landing.phtml:24
+msgid "Agree and Set Up Magento"
+msgstr "Погодитись та встановити Magento"
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:23
+msgid "Completed! You need to resolve these issues to continue."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:24
+msgid "Completed!"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:28
+msgid ""
+"We're making sure your server environment is ready for Magento to be "
+"installed."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:34
+msgid "Checking PHP Version..."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:39
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:50
+msgid "PHP Version Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:41
+msgid "Your PHP version is correct ({{version.data.current}})."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:46
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:153
+msgid "Need Help?"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:47
+msgid "PHP Documentation"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:53
+msgid ""
+"Your PHP version is {{version.data.current}}. The required PHP version is "
+"{{version.data.required}}."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:55
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:80
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:105
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:137
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:162
+msgid "More detail"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:56
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:81
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:106
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:138
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:163
+msgid "Less detail"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:60
+msgid ""
+"Donwload and install PHP version {{version.data.required}} from <a href="
+"\"http://www.php.net\" target=\"_blank\">www.php.net</a> using this <a href="
+"\"http://www.php.net/docs.php\" target=\"_blank\">PHP Documentation</a>."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:61
+msgid "If you need more help please call your hosting provider."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:70
+msgid "Checking PHP Extensions..."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:75
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:100
+msgid "PHP Extensions Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:78
+msgid ""
+"You meet {{extensions.data.current.length}} out of {{extensions.data."
+"required.length}} PHP extensions requirements."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:88
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:116
+msgid "PHP Extension {{name}}."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:97
+msgid "PHP Extension Help"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:103
+msgid ""
+"{{extensions.data.required.length - extensions.data.current.length}} missing "
+"PHP extensions."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:109
+msgid ""
+"The best way to resolve this is to install the correct missing extensions. "
+"The exact fix depends on our server, your host, and other system variables.</"
+"br>Our <a href=\"#\">PHP Extension Help</a> can get you started."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:110
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:167
+msgid "If you need more help, please call your hosting provider."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:127
+msgid "Checking File Permissions..."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:132
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:157
+msgid "File Permission Check"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:135
+msgid ""
+"You meet {{permissions.data.current.length}} out of {{permissions.data."
+"required.length}} file permission requirements."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:145
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:173
+msgid "\"{{name}}\" directory permission."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:154
+msgid "File Permission Help"
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:160
+msgid ""
+"{{permissions.data.required.length - permissions.data.current.length}} file "
+"permission not met."
+msgstr ""
+
+#: /home/nas/projects/magento2/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml:166
+msgid ""
+"The best way to resolve this is to allow write permissions for the following "
+"Magento directories. The exact fix depends on your server, your host, and "
+"other system variables.</br>Our <a href=\"#\">File Permission Help</a> can "
+"get you started."
+msgstr ""
diff --git a/app/code/Magento/Authorizenet/view/adminhtml/layout/sales_order_create_index.xml b/setup/module/Magento/Setup/phpunit.xml.dist
similarity index 54%
rename from app/code/Magento/Authorizenet/view/adminhtml/layout/sales_order_create_index.xml
rename to setup/module/Magento/Setup/phpunit.xml.dist
index 423ca04f8ccaf513be556d01a68f7672bb9157af..8a009cfd998b6143848e409c230b9474986dc42e 100644
--- a/app/code/Magento/Authorizenet/view/adminhtml/layout/sales_order_create_index.xml
+++ b/setup/module/Magento/Setup/phpunit.xml.dist
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
 /**
  * Magento
@@ -23,12 +23,29 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd">
-    <referenceBlock name="head">
-        <block class="Magento\Theme\Block\Html\Head\Script" name="magento-authorizenet-js-direct-post-js">
-            <arguments>
-                <argument name="file" xsi:type="string">Magento_Authorizenet::js/direct-post.js</argument>
-            </arguments>
-        </block>
-    </referenceBlock>
-</layout>
+<phpunit backupGlobals="false"
+         backupStaticAttributes="false"
+         colors="true"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         processIsolation="false"
+         stopOnFailure="false"
+         syntaxCheck="false"
+         bootstrap="../../../vendor/autoload.php"
+>
+    <testsuites>
+        <testsuite name="Magento Setup Module Test Suite">
+            <directory>./tests/</directory>
+        </testsuite>
+    </testsuites>
+
+    <filter>
+        <whitelist>
+            <directory>./</directory>
+            <exclude>
+                <directory>./tests</directory>
+            </exclude>
+        </whitelist>
+    </filter>
+</phpunit>
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Edit.php b/setup/module/Magento/Setup/src/Controller/AddDatabaseController.php
similarity index 64%
rename from app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Edit.php
rename to setup/module/Magento/Setup/src/Controller/AddDatabaseController.php
index 88ad8d1290fcda9601fb5c2872eb14db2eb2cbe6..3123e8a50b57c99670378a867b18a16c175cf2b5 100644
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom/Edit.php
+++ b/setup/module/Magento/Setup/src/Controller/AddDatabaseController.php
@@ -1,6 +1,5 @@
 <?php
 /**
- *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -22,21 +21,33 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Connect\Controller\Adminhtml\Extension\Custom;
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
 
-class Edit extends \Magento\Connect\Controller\Adminhtml\Extension\Custom
+class AddDatabaseController extends AbstractActionController
 {
     /**
-     * Edit Extension Package Form
-     *
-     * @return void
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(ViewModel $view)
+    {
+        $this->view = $view;
+    }
+
+    /**
+     * @return array|ViewModel
      */
-    public function execute()
+    public function indexAction()
     {
-        $this->_title->add(__('Extension'));
+        $this->view->setTerminal(true);
 
-        $this->_view->loadLayout();
-        $this->_setActiveMenu('Magento_Connect::system_extensions_custom');
-        $this->_view->renderLayout();
+        return $this->view;
     }
 }
diff --git a/setup/module/Magento/Setup/src/Controller/Controls/MenuController.php b/setup/module/Magento/Setup/src/Controller/Controls/MenuController.php
new file mode 100644
index 0000000000000000000000000000000000000000..8cc0b12e6256b10defc0da689d4a97e5d9e83b1c
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Controls/MenuController.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Controller\Controls;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+use Magento\Setup\Model\Navigation;
+
+class MenuController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @var Navigation
+     */
+    protected $navigation;
+
+    /**
+     * @param ViewModel $view
+     * @param Navigation $navigation
+     */
+    public function __construct(
+        ViewModel $view,
+        Navigation $navigation
+    ) {
+        $this->view = $view;
+        $this->view->setTemplate('/magento/setup/controls/menu.phtml');
+
+        $this->navigation = $navigation;
+    }
+
+    /**
+     * @return array|ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setVariable('menu', $this->navigation->getMenuItems());
+        $this->view->setVariable('main', $this->navigation->getMainItems());
+        $this->view->setTerminal(true);
+
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/CreateAdminAccountController.php b/setup/module/Magento/Setup/src/Controller/CreateAdminAccountController.php
new file mode 100644
index 0000000000000000000000000000000000000000..606d8918f44665ce306d28d18ba8f21a847584b8
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/CreateAdminAccountController.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+
+class CreateAdminAccountController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(
+        ViewModel $view
+    ) {
+        $this->view = $view;
+    }
+
+    /**
+     * @return ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setTerminal(true);
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/CustomizeYourStoreController.php b/setup/module/Magento/Setup/src/Controller/CustomizeYourStoreController.php
new file mode 100644
index 0000000000000000000000000000000000000000..a0b87abd2d7044163d0745f3cba4a14f1396e43b
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/CustomizeYourStoreController.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+use Magento\Locale\Lists;
+
+class CustomizeYourStoreController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @var \Magento\Locale\Lists
+     */
+    protected $list;
+
+    /**
+     * @param ViewModel $view
+     * @param \Magento\Locale\Lists $list
+     */
+    public function __construct(
+        ViewModel $view,
+        Lists $list
+    ) {
+        $this->view = $view;
+        $this->list = $list;
+    }
+
+    /**
+     * @return ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setVariables([
+            'timezone' => $this->list->getTimezoneList(),
+            'currency' => $this->list->getCurrencyList(),
+            'language' => $this->list->getLocaleList()
+        ]);
+
+        $this->view->setTerminal(true);
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/Data/DatabaseController.php b/setup/module/Magento/Setup/src/Controller/Data/DatabaseController.php
new file mode 100644
index 0000000000000000000000000000000000000000..ec9c4421dc810cced7e2ca04716549b9e52bee6a
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Data/DatabaseController.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller\Data;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
+use Zend\Json\Json;
+use Magento\Setup\Model\DatabaseCheck;
+
+class DatabaseController extends AbstractActionController
+{
+    /**
+     * @var JsonModel
+     */
+    protected $jsonModel;
+
+    /**
+     * @param JsonModel $jsonModel
+     */
+    public function __construct(JsonModel $jsonModel)
+    {
+        $this->jsonModel = $jsonModel;
+
+    }
+
+    /**
+     * @return JsonModel
+     */
+    public function indexAction()
+    {
+        $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
+        try {
+            $db = new DatabaseCheck($this->prepareDbConfig($params));
+            return $this->jsonModel->setVariables(['success' => $db->checkConnection()]);
+        } catch (\Exception $e) {
+            return $this->jsonModel->setVariables(['success' => false]);
+        }
+    }
+
+    protected function prepareDbConfig(array $data = array())
+    {
+        return array(
+            'driver'         => "Pdo",
+            'dsn'            => "mysql:dbname=" . $data['name']. ";host=" .$data['host'],
+            'username'       => $data['user'],
+            'password'       => isset($data['password']) ? $data['password'] : null,
+            'driver_options' => array(
+                \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"
+            ),
+        );
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/Data/FilePermissionsController.php b/setup/module/Magento/Setup/src/Controller/Data/FilePermissionsController.php
new file mode 100644
index 0000000000000000000000000000000000000000..01544eb53605e2fc70886b2cb48ece38d2e7bf9c
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Data/FilePermissionsController.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller\Data;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
+use Magento\Setup\Model\FilePermissions;
+
+class FilePermissionsController extends AbstractActionController
+{
+    /**
+     * @var JsonModel
+     */
+    protected $jsonModel;
+
+    /**
+     * @var FilePermissions
+     */
+    protected $permissions;
+
+    /**
+     * @param JsonModel $jsonModel
+     * @param FilePermissions $permissions
+     */
+    public function __construct(
+        JsonModel $jsonModel,
+        FilePermissions $permissions
+    ) {
+        $this->jsonModel = $jsonModel;
+        $this->permissions = $permissions;
+    }
+
+    /**
+     * @return JsonModel
+     */
+    public function indexAction()
+    {
+        $required = $this->permissions->getRequired();
+        $current = $this->permissions->getCurrent();
+
+        $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
+        if (array_diff($required, $current)) {
+            $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
+        }
+
+        $data = [
+            'responseType' => $responseType,
+            'data' => [
+                'required' => $required,
+                'current' => $current,
+            ],
+        ];
+
+        return $this->jsonModel->setVariables($data);
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/Data/PhpExtensionsController.php b/setup/module/Magento/Setup/src/Controller/Data/PhpExtensionsController.php
new file mode 100644
index 0000000000000000000000000000000000000000..7a5010bae390a1174a57a8a33590b96f1d43c6df
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Data/PhpExtensionsController.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller\Data;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
+use Magento\Setup\Model\PhpExtensions;
+
+class PhpExtensionsController extends AbstractActionController
+{
+    /**
+     * @var JsonModel
+     */
+    protected $jsonModel;
+
+    /**
+     * @var \Magento\Setup\Model\PhpExtensions
+     */
+    protected $extensions;
+
+    /**
+     * @param JsonModel $jsonModel
+     * @param PhpExtensions $extensions
+     */
+    public function __construct(
+        JsonModel $jsonModel,
+        PhpExtensions $extensions
+    ) {
+        $this->jsonModel = $jsonModel;
+        $this->extensions = $extensions;
+    }
+
+    /**
+     * @return JsonModel
+     */
+    public function indexAction()
+    {
+        $required = $this->extensions->getRequired();
+        $current = $this->extensions->getCurrent();
+
+        $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
+        if (array_diff($required, $current)) {
+            $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
+        }
+
+        $data = [
+            'responseType' => $responseType,
+            'data' => [
+                'required' => $required,
+                'current' => $current,
+            ],
+        ];
+
+        return $this->jsonModel->setVariables($data);
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Connect/Channel/Generator.php b/setup/module/Magento/Setup/src/Controller/Data/PhpVersionController.php
similarity index 50%
rename from downloader/lib/Magento/Framework/Connect/Channel/Generator.php
rename to setup/module/Magento/Setup/src/Controller/Data/PhpVersionController.php
index 696624612f7e282664a6204a1599d8675e8f1cbe..cd8a4f174e4ecd5f597db6de49e8e8d7d36dad14 100644
--- a/downloader/lib/Magento/Framework/Connect/Channel/Generator.php
+++ b/setup/module/Magento/Setup/src/Controller/Data/PhpVersionController.php
@@ -17,61 +17,53 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *
+ *   
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Connect\Channel;
+namespace Magento\Setup\Controller\Data;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
 
-class Generator extends \Magento\Framework\Xml\Generator
+class PhpVersionController extends AbstractActionController
 {
     /**
-     * @var string
+     * The minimum required version of PHP
      */
-    protected $_file = 'channel.xml';
+    const PHP_VERSION_MIN = '5.4.0';
 
     /**
-     * @var \Magento\Framework\Xml\Generator|null
+     * @var JsonModel
      */
-    protected $_generator = null;
+    protected $jsonModel;
 
     /**
-     * @param string $file
+     * @param JsonModel $jsonModel
      */
-    public function __construct($file = '')
+    public function __construct(JsonModel $jsonModel)
     {
-        if ($file) {
-            $this->_file = $file;
-        }
-        return $this;
+        $this->jsonModel = $jsonModel;
     }
 
     /**
-     * @return string
+     * @return JsonModel
      */
-    public function getFile()
+    public function indexAction()
     {
-        return $this->_file;
-    }
-
-    /**
-     * @return \Magento\Framework\Xml\Generator|null
-     */
-    public function getGenerator()
-    {
-        if (is_null($this->_generator)) {
-            $this->_generator = new \Magento\Framework\Xml\Generator();
+        $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
+        if (version_compare(PHP_VERSION, self::PHP_VERSION_MIN, '<') === true) {
+            $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
         }
-        return $this->_generator;
-    }
 
-    /**
-     * @param array $content
-     * @return $this
-     */
-    public function save($content)
-    {
-        $xmlContent = $this->getGenerator()->arrayToXml($content)->save($this->getFile());
-        return $this;
+        $data = [
+            'responseType' => $responseType,
+            'data' => [
+                'required' => self::PHP_VERSION_MIN,
+                'current' => PHP_VERSION,
+            ],
+        ];
+
+        return $this->jsonModel->setVariables($data);
     }
 }
diff --git a/setup/module/Magento/Setup/src/Controller/Data/ResponseTypeInterface.php b/setup/module/Magento/Setup/src/Controller/Data/ResponseTypeInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..9783af1a297c640a50ebc2b94175d3a5898325e8
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Data/ResponseTypeInterface.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Controller\Data;
+
+interface ResponseTypeInterface
+{
+    /**#@+
+     * Response Type values
+     */
+    const RESPONSE_TYPE_SUCCESS = 'success';
+    const RESPONSE_TYPE_ERROR = 'error';
+    /**#@-*/
+}
diff --git a/lib/internal/Magento/Framework/Autoload/Simple.php b/setup/module/Magento/Setup/src/Controller/Data/StatesController.php
similarity index 59%
rename from lib/internal/Magento/Framework/Autoload/Simple.php
rename to setup/module/Magento/Setup/src/Controller/Data/StatesController.php
index 845d601277e868af69e8a7e715a52124afd24f81..48feaafc59e825b92764e9205ddf7d42643b1d8d 100644
--- a/lib/internal/Magento/Framework/Autoload/Simple.php
+++ b/setup/module/Magento/Setup/src/Controller/Data/StatesController.php
@@ -17,47 +17,43 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *
+ *   
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Autoload;
+namespace Magento\Setup\Controller\Data;
+
+use Magento\Setup\Model\Navigation;
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
 
-class Simple
+class StatesController extends AbstractActionController
 {
     /**
-     * @var object
+     * @var Navigation
      */
-    private static $_instance;
+    protected $navigation;
 
     /**
-     * @return object
+     * @var JsonModel
      */
-    public static function instance()
-    {
-        if (!self::$_instance) {
-            $class = __CLASS__;
-            self::$_instance = new $class();
-        }
-        return self::$_instance;
-    }
+    protected $jsonModel;
 
     /**
-     * @return void
+     * @param Navigation $navigation
+     * @param JsonModel $jsonModel
      */
-    public static function register()
+    public function __construct(Navigation $navigation, JsonModel $jsonModel)
     {
-        spl_autoload_register(array(self::instance(), 'autoload'));
+        $this->navigation = $navigation;
+        $this->jsonModel = $jsonModel;
     }
 
     /**
-     * @param string $class
-     * @return void
+     * @return JsonModel
      */
-    public function autoload($class)
+    public function indexAction()
     {
-        $classFile = str_replace(' ', '/', ucwords(str_replace('_', ' ', $class)));
-        $classFile .= '.php';
-        @include $classFile;
+        return $this->jsonModel->setVariable('nav', $this->navigation->getData());
     }
-}
+}
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/src/Controller/IndexController.php b/setup/module/Magento/Setup/src/Controller/IndexController.php
new file mode 100644
index 0000000000000000000000000000000000000000..170908af01459cc419b07588f2de5e22ebb8cb17
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/IndexController.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+
+class IndexController extends AbstractActionController
+{
+    /**
+     * @var ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(ViewModel $view)
+    {
+        $this->view = $view;
+    }
+
+    /**
+     * @return ViewModel
+     */
+    public function indexAction()
+    {
+        if (!$this->params()->fromRoute('lang')) {
+            $this->redirect()->toUrl('en_US/index');
+        }
+
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/Install/ProgressController.php b/setup/module/Magento/Setup/src/Controller/Install/ProgressController.php
new file mode 100644
index 0000000000000000000000000000000000000000..60ac35dfd42750ba34cc4a19533484e72f8d1100
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Install/ProgressController.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller\Install;
+
+use Magento\Module\ModuleListInterface;
+use Magento\Setup\Model\Logger;
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
+
+class ProgressController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\JsonModel
+     */
+    protected $json;
+
+    /**
+     * @var Logger
+     */
+    protected $logger;
+
+    protected $moduleList;
+
+    /**
+     * @param JsonModel $view
+     * @param ModuleListInterface $moduleList
+     * @param Logger $logger
+     */
+    public function __construct(
+        JsonModel $view,
+        ModuleListInterface $moduleList,
+        Logger $logger
+    ) {
+        $this->moduleList = $moduleList;
+        $this->logger = $logger;
+        $this->json = $view;
+    }
+
+    /**
+     * @return JsonModel
+     */
+    public function indexAction()
+    {
+        //@todo I fix it
+        $moduleCount = count($this->moduleList->getModules());
+        $log = $this->logger->get();
+        $progress = 0;
+        if (!empty($log)) {
+            $progress = round(count($log)/$moduleCount*90);
+        }
+        $progress += 5;
+
+        return $this->json->setVariables(
+            array(
+                'progress' => $progress,
+                'success' => !$this->logger->hasError(),
+                'console' => $log
+            )
+        );
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/Install/StartController.php b/setup/module/Magento/Setup/src/Controller/Install/StartController.php
new file mode 100644
index 0000000000000000000000000000000000000000..f70ca86268f520c9bb93aa9841a9dd1f5b073a73
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/Install/StartController.php
@@ -0,0 +1,174 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller\Install;
+
+use Magento\Framework\Math\Random;
+use Magento\Module\ModuleListInterface;
+use Magento\Module\Setup\Config;
+use Magento\Module\SetupFactory;
+use Magento\Setup\Model\AdminAccountFactory;
+use Magento\Setup\Model\Logger;
+use Zend\Json\Json;
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\JsonModel;
+
+class StartController extends AbstractActionController
+{
+    /**
+     * @var JsonModel
+     */
+    protected $json;
+
+    /**
+     * @var []
+     */
+    protected $moduleList;
+
+    /**
+     * @var Logger
+     */
+    protected $logger;
+
+    /**
+     * @var Config
+     */
+    protected $config;
+
+    /**
+     * @var AdminAccountFactory
+     */
+    protected $adminAccountFactory;
+
+    /**
+     * @var Random
+     */
+    protected $random;
+
+    /**
+     * @param JsonModel $view
+     * @param ModuleListInterface $moduleList
+     * @param SetupFactory $setupFactory
+     * @param AdminAccountFactory $adminAccountFactory
+     * @param Logger $logger
+     * @param Random $random
+     * @param Config $config
+     */
+    public function __construct(
+        JsonModel $view,
+        ModuleListInterface $moduleList,
+        SetupFactory $setupFactory,
+        AdminAccountFactory $adminAccountFactory,
+        Logger $logger,
+        Random $random,
+        Config $config
+    ) {
+        $this->logger = $logger;
+        $this->json = $view;
+        $this->moduleList = $moduleList->getModules();
+        $this->setupFactory = $setupFactory;
+        $this->config = $config;
+        $this->adminAccountFactory = $adminAccountFactory;
+        $this->random = $random;
+    }
+
+    /**
+     * @return JsonModel
+     */
+    public function indexAction()
+    {
+        $this->logger->clear();
+
+        $data = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
+
+        $this->config->setConfigData($data);
+        $this->config->install();
+
+        $this->setupFactory->setConfig($this->config->getConfigData());
+
+        $moduleNames = array_keys($this->moduleList);
+        foreach ($moduleNames as $moduleName) {
+            $setup = $this->setupFactory->create($moduleName);
+            $setup->applyUpdates();
+            $this->logger->logSuccess($moduleName);
+        }
+
+        $this->logger->logSuccess('Artifact');
+
+        // Set data to config
+        $setup->addConfigData(
+            'web/seo/use_rewrites',
+            isset($data['config']['rewrites']['allowed']) ? $data['config']['rewrites']['allowed'] : 0
+        );
+        $setup->addConfigData(
+            'web/unsecure/base_url',
+            isset($data['config']['address']['web']) ? $data['config']['address']['web'] : '{{unsecure_base_url}}'
+        );
+        $setup->addConfigData(
+            'web/secure/use_in_frontend',
+            isset($data['config']['https']['front']) ? $data['config']['https']['front'] : 0
+        );
+        $setup->addConfigData(
+            'web/secure/base_url',
+            isset($data['config']['address']['web']) ? $data['config']['address']['web'] : '{{secure_base_url}}'
+        );
+        $setup->addConfigData(
+            'web/secure/use_in_adminhtml',
+            isset($data['config']['https']['admin']) ? $data['config']['https']['admin'] : 0
+        );
+        $setup->addConfigData(
+            'general/locale/code',
+            isset($data['store']['language']) ? $data['store']['language'] : 'en_US'
+        );
+        $setup->addConfigData(
+            'general/locale/timezone',
+            isset($data['store']['timezone']) ? $data['store']['timezone'] : 'America/Los_Angeles'
+        );
+
+        $currencyCode = isset($data['store']['currency']) ? $data['store']['currency'] : 'USD';
+
+        $setup->addConfigData('currency/options/base', $currencyCode);
+        $setup->addConfigData('currency/options/default', $currencyCode);
+        $setup->addConfigData('currency/options/allow', $currencyCode);
+
+        // Create administrator account
+        $this->adminAccountFactory->setConfig($this->config->getConfigData());
+        $adminAccount = $this->adminAccountFactory->create($setup);
+        $adminAccount->save();
+
+        $this->logger->logSuccess('Admin User');
+
+        if ($data['config']['encrypt']['type'] == 'magento') {
+            $key = md5($this->random->getRandomString(10));
+        } else {
+            $key = $data['config']['encrypt']['key'];
+        }
+        $this->config->replaceTmpEncryptKey($key);
+
+        $this->config->replaceTmpInstallDate(date('r'));
+
+        $this->json->setVariable('success', true);
+        $this->json->setVariable('key', $key);
+        return $this->json;
+    }
+}
diff --git a/downloader/lib/Magento/Framework/Archive/ArchiveInterface.php b/setup/module/Magento/Setup/src/Controller/InstallController.php
similarity index 64%
rename from downloader/lib/Magento/Framework/Archive/ArchiveInterface.php
rename to setup/module/Magento/Setup/src/Controller/InstallController.php
index 108faae2e9fb396e44f25d2897e394f1e9f3a5af..b7e3e6969924955ed5c82bae054f32c4ef5b2d48 100644
--- a/downloader/lib/Magento/Framework/Archive/ArchiveInterface.php
+++ b/setup/module/Magento/Setup/src/Controller/InstallController.php
@@ -21,31 +21,33 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Setup\Controller;
 
-/**
- * Interface for work with archives
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Framework\Archive;
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
 
-interface ArchiveInterface
+class InstallController extends AbstractActionController
 {
     /**
-     * Pack file or directory.
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
      */
-    public function pack($source, $destination);
+    public function __construct(
+        ViewModel $view
+    ) {
+        $this->view = $view;
+    }
 
     /**
-     * Unpack file or directory.
-     *
-     * @param string $source
-     * @param string $destination
-     * @return string
+     * @return ViewModel
      */
-    public function unpack($source, $destination);
+    public function indexAction()
+    {
+        $this->view->setTerminal(true);
+        return $this->view;
+    }
 }
diff --git a/setup/module/Magento/Setup/src/Controller/LandingController.php b/setup/module/Magento/Setup/src/Controller/LandingController.php
new file mode 100644
index 0000000000000000000000000000000000000000..249741150416d9ba20d5cce0a7f7832019e8e1d4
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/LandingController.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+use Zend\ServiceManager\ServiceLocatorInterface;
+use \Magento\Setup\Model\Location;
+
+class LandingController extends AbstractActionController
+{
+    /**
+     * @var ServiceLocatorInterface
+     */
+    protected $serviceLocator;
+
+    /**
+     * @var ViewModel
+     */
+    protected $view;
+
+    /**
+     * @var Location
+     */
+    protected $location;
+
+    /**
+     * @param Location $location
+     * @param ServiceLocatorInterface $serviceLocator
+     * @param ViewModel $view
+     */
+    public function __construct(Location $location, ServiceLocatorInterface $serviceLocator, ViewModel $view)
+    {
+        $this->location =$location;
+        $this->view = $view;
+    }
+
+    /**
+     * @return array|ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setTerminal(true);
+        $this->view->setVariable('languages', $this->serviceLocator->get('config')['languages']);
+        $this->view->setVariable('location', $this->location->getLocationCode());
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/ReadinessCheck/ProgressController.php b/setup/module/Magento/Setup/src/Controller/ReadinessCheck/ProgressController.php
new file mode 100644
index 0000000000000000000000000000000000000000..8db2aaad63d8ecc3e159fcdb64c7320db19fb8cd
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/ReadinessCheck/ProgressController.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller\ReadinessCheck;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+
+class ProgressController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(ViewModel $view)
+    {
+        $this->view = $view;
+    }
+
+    /**
+     * @return array|ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setTerminal(true);
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Controller/ReadinessCheckController.php b/setup/module/Magento/Setup/src/Controller/ReadinessCheckController.php
new file mode 100644
index 0000000000000000000000000000000000000000..8e3553124cc73b3c4930f85bc9c902b5d778112e
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/ReadinessCheckController.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+
+class ReadinessCheckController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(ViewModel $view)
+    {
+        $this->view = $view;
+    }
+
+    /**
+     * @return array|ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setTerminal(true);
+        return $this->view;
+    }
+}
diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php b/setup/module/Magento/Setup/src/Controller/SuccessController.php
similarity index 64%
rename from app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php
rename to setup/module/Magento/Setup/src/Controller/SuccessController.php
index 247467f99edc794c2bdf1360f28986da5dff6751..e56787025a7b7572392877f655ee9d0cc3aadbc8 100644
--- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php
+++ b/setup/module/Magento/Setup/src/Controller/SuccessController.php
@@ -21,24 +21,33 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Setup\Controller;
 
-/**
- * Extension controller
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
-namespace Magento\Connect\Controller\Adminhtml\Extension;
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
 
-class Custom extends \Magento\Backend\App\Action
+class SuccessController extends AbstractActionController
 {
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(
+        ViewModel $view
+    ) {
+        $this->view = $view;
+    }
 
     /**
-     * Check is allowed access to actions
-     *
-     * @return bool
+     * @return ViewModel
      */
-    protected function _isAllowed()
+    public function indexAction()
     {
-        return $this->_authorization->isAllowed('Magento_Adminhtml::custom');
+        $this->view->setTerminal(true);
+        return $this->view;
     }
 }
diff --git a/setup/module/Magento/Setup/src/Controller/WebConfigurationController.php b/setup/module/Magento/Setup/src/Controller/WebConfigurationController.php
new file mode 100644
index 0000000000000000000000000000000000000000..3627d422a2621b84acbe290656e75a6b5a0a7d81
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Controller/WebConfigurationController.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Setup\Controller;
+
+use Zend\Mvc\Controller\AbstractActionController;
+use Zend\View\Model\ViewModel;
+
+class WebConfigurationController extends AbstractActionController
+{
+    /**
+     * @var \Zend\View\Model\ViewModel
+     */
+    protected $view;
+
+    /**
+     * @param ViewModel $view
+     */
+    public function __construct(ViewModel $view)
+    {
+        $this->view = $view;
+    }
+
+    /**
+     * @return array|ViewModel
+     */
+    public function indexAction()
+    {
+        $this->view->setTerminal(true);
+
+        return $this->view;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Model/AdminAccount.php b/setup/module/Magento/Setup/src/Model/AdminAccount.php
new file mode 100644
index 0000000000000000000000000000000000000000..bc882ddb135218aad7678c07906f1bd922b05f7b
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/AdminAccount.php
@@ -0,0 +1,121 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Magento\Framework\Math\Random;
+use Magento\Module\Setup;
+
+class AdminAccount
+{
+    /**
+     * @var Seyup
+     */
+    protected $setup;
+
+    /**
+     * @var []
+     */
+    protected $config;
+
+    /**
+     * @var \Magento\Framework\Math\Random
+     */
+    protected $random;
+
+    /**
+     * @param Setup $setup
+     * @param Random $random
+     * @param array $config
+     */
+    public function __construct(
+        Setup $setup,
+        Random $random,
+        array $config = array()
+    ) {
+        $this->setup  = $setup;
+        $this->config = $config;
+        $this->random = $random;
+    }
+
+    /**
+     * Generate password string
+     *
+     * @return string
+     */
+    protected function generatePassword()
+    {
+        $salt = $this->random->getRandomString(32);
+        return md5($salt . $this->config['admin_password']) . ':' . $salt;
+    }
+
+    /**
+     * Save administrator account to DB
+     *
+     * @return void
+     */
+    public function save()
+    {
+        $adminData = [
+            'firstname' => $this->config['admin_username'],
+            'lastname' => $this->config['admin_username'],
+            'username' => $this->config['admin_username'],
+            'password' => $this->generatePassword(),
+            'email' => $this->config['admin_email'],
+            'created' => date('Y-m-d H:i:s'),
+            'modified' => date('Y-m-d H:i:s'),
+            'extra' => serialize(null),
+            'is_active' => 1,
+        ];
+        $this->setup->getConnection()->insert(
+            $this->setup->getTable('admin_user'),
+            $adminData,
+            true
+        );
+        $adminId = $this->setup->getConnection()->getDriver()->getLastGeneratedValue();
+
+        $roles = [
+            0 => [
+                'parent_id' => 0,
+                'tree_level' => 1,
+                'sort_order' => 1,
+                'role_type' => 'G',
+                'user_id' => 0,
+                'role_name' => 'Administrators',
+            ],
+            1 => [
+                'parent_id' => 1,
+                'tree_level' => 2,
+                'sort_order' => 0,
+                'role_type' => 'U',
+                'user_id' => $adminId,
+                'role_name' => $this->config['admin_username'],
+            ]
+        ];
+
+        foreach ($roles as $role) {
+            $this->setup->getConnection()->insert($this->setup->getTable('admin_role'), $role, true);
+        }
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Model/AdminAccountFactory.php b/setup/module/Magento/Setup/src/Model/AdminAccountFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..48b6103c43e0d3a74ffcf965603b6a42a551c798
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/AdminAccountFactory.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Magento\Framework\Math\Random;
+use Magento\Module\Setup\Connection\AdapterInterface;
+use Magento\Module\Setup;
+
+class AdminAccountFactory
+{
+    /**
+     * @var AdapterInterface
+     */
+    protected $adapter;
+
+    /**
+     * @var array
+     */
+    protected $configuration = [];
+
+    /**
+     * @var Random
+     */
+    protected $random;
+
+    /**
+     * @param Random $random
+     */
+    public function __construct(
+        Random $random
+    ) {
+        $this->random = $random;
+    }
+
+    /**
+     * @param array $config
+     */
+    public function setConfig(array $config)
+    {
+        $this->configuration = $config;
+    }
+
+    /**
+     * @param Setup $setup
+     * @return AdminAccount
+     */
+    public function create(Setup $setup)
+    {
+        return new AdminAccount(
+            $setup,
+            $this->random,
+            $this->configuration
+        );
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Model/DatabaseCheck.php b/setup/module/Magento/Setup/src/Model/DatabaseCheck.php
new file mode 100644
index 0000000000000000000000000000000000000000..3a55c233c3713c236434f015ff30d7ea7bb182e8
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/DatabaseCheck.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Magento\Framework\DB\Adapter\Pdo\Mysql;
+
+class DatabaseCheck
+{
+    /**
+     * @var Mysql
+     */
+    protected $adapter;
+
+    /**
+     * @var array
+     */
+    protected $config;
+    /**
+     * @param array $config
+     */
+    public function __construct(
+        array $config = array()
+    ) {
+        $this->config = $config;
+    }
+
+    public function checkConnection()
+    {
+        $this->adapter = new Mysql($this->config);
+        $this->adapter->connect();
+        return $this->adapter->getDriver()->getConnection()->isConnected();
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Model/FilePermissions.php b/setup/module/Magento/Setup/src/Model/FilePermissions.php
new file mode 100644
index 0000000000000000000000000000000000000000..c0b95d3c9ff57c7acdbe6bb6a2aae9883821ea5c
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/FilePermissions.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Magento\Config\Config;
+use Magento\Config\ConfigFactory;
+use Magento\Filesystem\Filesystem;
+
+class FilePermissions
+{
+    /**
+     * @var ConfigFactory
+     */
+    protected $configFactory;
+
+    /**
+     * @var Config
+     */
+    protected $config;
+
+    /**
+     * @var Filesystem
+     */
+    protected $filesystem;
+
+    /**
+     * List of required directories
+     *
+     * @var array
+     */
+    protected $required = [];
+
+    /**
+     * List of currently existed directories
+     *
+     * @var array
+     */
+    protected $current = [];
+
+    /**
+     * @param Filesystem $filesystem
+     * @param ConfigFactory $configFactory
+     */
+    public function __construct(
+        Filesystem $filesystem,
+        ConfigFactory $configFactory
+    ) {
+        $this->filesystem = $filesystem;
+
+        $this->configFactory = $configFactory;
+        $this->config = $this->configFactory->create();
+    }
+
+    /**
+     * Retrieve list of required directories
+     *
+     * @return array
+     */
+    public function getRequired()
+    {
+        if (!$this->required) {
+            foreach ($this->config->getMagentoFilePermissions() as $code => $config) {
+                if (isset($config['path'])) {
+                    $this->required[$code] = $config['path'];
+                }
+            }
+        }
+        return array_values($this->required);
+    }
+
+    /**
+     * Retrieve list of currently existed directories
+     *
+     * @return array
+     */
+    public function getCurrent()
+    {
+        if (!$this->current) {
+            foreach ($this->required as $code => $path) {
+                if (!$this->validate($code)) {
+                    continue;
+                }
+                $this->current[$code] = $path;
+            }
+        }
+        return array_values($this->current);
+    }
+
+    /**
+     * Validate directory permissions by given directory code
+     *
+     * @param string $code
+     * @return bool
+     */
+    protected function validate($code)
+    {
+        $directory = $this->filesystem->getDirectoryWrite($code);
+        if (!$directory->isExist()) {
+            return false;
+        }
+        if (!$directory->isDirectory()) {
+            return false;
+        }
+        if (!$directory->isReadable()) {
+            return false;
+        }
+        if (!$directory->isWritable()) {
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Model/Location.php b/setup/module/Magento/Setup/src/Model/Location.php
new file mode 100644
index 0000000000000000000000000000000000000000..1b5ab3eeceb8f3ca2b287ce56a0ad5825368e8b0
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/Location.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Zend\Mvc\I18n\Translator;
+use Zend\Mvc\MvcEvent;
+
+class Location
+{
+    /**
+     * @var Translator
+     */
+    protected $translator;
+
+    public function __construct(Translator $translator)
+    {
+        $this->translator = $translator;
+    }
+
+    public function onChangeLocation(MvcEvent $e)
+    {
+        $locale = $this->translator->getLocale();
+        $this->translator->setLocale($e->getRouteMatch()->getParam('lang'));
+        $this->translator->setFallbackLocale($locale);
+    }
+
+    public function getLocationCode()
+    {
+        return substr($this->translator->getLocale(), 0, 5);
+    }
+}
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/src/Model/Logger.php b/setup/module/Magento/Setup/src/Model/Logger.php
new file mode 100644
index 0000000000000000000000000000000000000000..e47954fba31d05d3c3f0094b0640d815c5b2a6f5
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/Logger.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+class Logger
+{
+    /**
+     * @var string
+     */
+    protected $logFile = 'install.log';
+
+    /**
+     * @var resource
+     */
+    protected $resource;
+
+    /**
+     * @var bool
+     */
+    protected $hasError = false;
+
+    public function __construct()
+    {
+        $this->logFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $this->logFile;
+    }
+
+    public function open()
+    {
+        $this->resource = @fopen($this->logFile, 'a+');
+    }
+
+    public function close()
+    {
+        fclose($this->resource);
+    }
+
+    /**
+     * @param string $moduleName
+     */
+    public function logSuccess($moduleName)
+    {
+        $this->open();
+        fwrite($this->resource, '<span class="text-success">[SUCCESS] ' . $moduleName . ' ... installed</span>' . PHP_EOL);
+        $this->close();
+    }
+
+    /**
+     * @param \Exception $e
+     */
+    public function logError(\Exception $e)
+    {
+        $this->open();
+        fwrite($this->resource, '<span class="text-danger">[ERROR] ' . $e . '<span>' . PHP_EOL);
+        $this->close();
+    }
+
+    /**
+     * @return bool
+     */
+    public function hasError()
+    {
+        return $this->hasError;
+    }
+
+    /**
+     * @return array
+     */
+    public function get()
+    {
+        $this->open();
+        fseek($this->resource, 0);
+        $messages = [];
+        while (($string = fgets($this->resource)) !== false) {
+            if (strpos($string, '[ERROR]') !== false) {
+                $this->hasError = true;
+            }
+            $messages[] = $string;
+        }
+        $this->close();
+        return $messages;
+    }
+
+    public function clear()
+    {
+        @unlink($this->logFile);
+    }
+}
+ 
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/src/Model/Navigation.php b/setup/module/Magento/Setup/src/Model/Navigation.php
new file mode 100644
index 0000000000000000000000000000000000000000..503d772f926f5bd805a3c2ea31d19ab9f1d61449
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/Navigation.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+class Navigation
+{
+    /**
+     * @var \Zend\ServiceManager\ServiceLocatorInterface
+     */
+    protected $serviceLocator;
+
+    /**
+     * @param ServiceLocatorInterface $serviceLocator
+     */
+    public function __construct(ServiceLocatorInterface $serviceLocator)
+    {
+        $this->serviceLocator = $serviceLocator;
+    }
+
+    /**
+     * @return array
+     */
+    public function getData()
+    {
+        return $this->serviceLocator->get('config')['nav'];
+    }
+
+    /**
+     * Retrieve array of menu items
+     *
+     * Returns only items with 'nav-bar' equal to TRUE
+     *
+     * @return array
+     */
+    public function getMenuItems()
+    {
+        return array_filter(
+            $this->serviceLocator->get('config')['nav'],
+            function ($value) {
+                return isset($value['nav-bar']) && (bool)$value['nav-bar'];
+            }
+        );
+    }
+
+
+    /**
+     * Retrieve array of menu items
+     *
+     * Returns only items with 'main' equal to TRUE
+     *
+     * @return array
+     */
+    public function getMainItems()
+    {
+        $result = array_filter(
+            $this->serviceLocator->get('config')['nav'],
+            function ($value) {
+                return isset($value['main']) && (bool)$value['main'];
+            }
+        );
+        return $result;
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Model/PhpExtensions.php b/setup/module/Magento/Setup/src/Model/PhpExtensions.php
new file mode 100644
index 0000000000000000000000000000000000000000..df3948133c406fe0e55cffd9d4c8dfff4a8a7ed8
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Model/PhpExtensions.php
@@ -0,0 +1,133 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Model;
+
+use Magento\Composer\Reader\Json;
+
+class PhpExtensions
+{
+    /**
+     * File reader for composer.json files
+     *
+     * @var \Magento\Composer\Reader\Json
+     */
+    protected $fileReader;
+
+    /**
+     * List of required extensions
+     *
+     * @var array
+     */
+    protected $required = [];
+
+    /**
+     * List of currently installed extensions
+     *
+     * @var array
+     */
+    protected $current = [];
+
+    /**
+     * @param \Magento\Composer\Reader\Json $fileReader
+     */
+    public function __construct(
+        Json $fileReader
+    ) {
+        $this->fileReader = $fileReader;
+    }
+
+    /**
+     * Retrieve list of required extensions
+     *
+     * Collect required extensions from Magento modules composer.json files
+     *
+     * @return array
+     */
+    public function getRequired()
+    {
+        if (!$this->required) {
+            $extensions = [];
+            foreach ($this->fileReader->read() as $object) {
+                if (!property_exists($object, 'require')) {
+                    continue;
+                }
+                $items = get_object_vars($object->require);
+                $items = array_filter(array_keys($items), [$this, 'filter']);
+                if ($items) {
+                    $extensions = array_merge($extensions, $items);
+                }
+            }
+
+            $extensions = array_unique($extensions);
+            array_walk($extensions, [$this, 'process']);
+
+            $this->required = array_values($extensions);
+            unset($extensions);
+        }
+        return $this->required;
+    }
+
+    /**
+     * Retrieve list of currently installed extensions
+     *
+     * @return array
+     */
+    public function getCurrent()
+    {
+        if (!$this->current) {
+            foreach ($this->required as $extension) {
+                if (extension_loaded($extension)) {
+                    $this->current[] = $extension;
+                }
+            }
+        }
+        return $this->current;
+    }
+
+    /**
+     * Aplly filter to array of required items
+     *
+     * If item has prefix 'ext-' then return TRUE, otherwise return FALSE.
+     *
+     * @param string $value
+     * @return bool
+     */
+    protected function filter($value)
+    {
+        return strpos($value, 'ext-') === 0;
+    }
+
+    /**
+     * Process extension name
+     *
+     * Remove 'ext-' prefix from extension name.
+     *
+     * @param string $value
+     */
+    protected function process(&$value)
+    {
+        $value = preg_replace('/^ext-/', '', $value);
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Mvc/Router/Http/Setup.php b/setup/module/Magento/Setup/src/Mvc/Router/Http/Setup.php
new file mode 100644
index 0000000000000000000000000000000000000000..0ed675680d945301bca2a3abb966a76ee9b22370
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Mvc/Router/Http/Setup.php
@@ -0,0 +1,124 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Mvc\Router\Http;
+
+use Traversable;
+use Zend\Mvc\Router\Exception;
+use Zend\Stdlib\ArrayUtils;
+use Zend\Stdlib\RequestInterface as Request;
+use Zend\Mvc\Router\Http\Regex as ZendRegex;
+use Zend\Mvc\Router\Http\RouteMatch;
+
+/**
+ * Setup route.
+ */
+class Setup extends ZendRegex
+{
+    /**
+     * factory(): defined by RouteInterface interface.
+     *
+     * @see    \Zend\Mvc\Router\RouteInterface::factory()
+     * @param  array|Traversable $options
+     * @return Regex
+     * @throws \Zend\Mvc\Router\Exception\InvalidArgumentException
+     */
+    public static function factory($options = array())
+    {
+        if ($options instanceof Traversable) {
+            $options = ArrayUtils::iteratorToArray($options);
+        } elseif (!is_array($options)) {
+            throw new Exception\InvalidArgumentException(
+                __METHOD__ . ' expects an array or Traversable set of options'
+            );
+        }
+
+        if (!isset($options['regex'])) {
+            throw new Exception\InvalidArgumentException('Missing "regex" in options array');
+        }
+
+        if (strpos($options['regex'], '?<controller>') === false) {
+            throw new Exception\InvalidArgumentException('Missing "?<controller>" part in "regex"');
+        }
+
+        if (!isset($options['spec'])) {
+            throw new Exception\InvalidArgumentException('Missing "spec" in options array');
+        }
+
+        if (!isset($options['defaults'])) {
+            $options['defaults'] = array();
+        }
+
+        return new static($options['regex'], $options['spec'], $options['defaults']);
+    }
+
+    /**
+     * match(): defined by RouteInterface interface.
+     *
+     * @param  Request $request
+     * @param  int $pathOffset
+     * @return RouteMatch|null
+     */
+    public function match(Request $request, $pathOffset = null)
+    {
+        if (!method_exists($request, 'getUri')) {
+            return null;
+        }
+
+        $uri  = $request->getUri();
+        $path = $uri->getPath();
+
+        $result = preg_match('(' . $this->regex . ')', $path, $matches, null, (int)$pathOffset);
+        if (!$result || !isset($matches['controller'])) {
+            return null;
+        }
+
+        foreach ($matches as $key => $value) {
+            if (is_numeric($key) || is_int($key) || $value === '') {
+                unset($matches[$key]);
+            }
+        }
+
+        $chunks = explode('/', ltrim($path, '/'));
+        if ($pathOffset !== null) {
+            array_shift($chunks); // Extract 'module name' part
+        }
+        array_shift($chunks); // Extract 'lang' part
+        array_pop($chunks); // Extract 'controller' part
+
+        array_unshift($chunks, $this->defaults['__NAMESPACE__']);
+        $namespace = str_replace(' ', '\\', ucwords(implode(' ', $chunks)));
+
+        $controller = ucwords($matches['controller']);
+        if (false === strpos($controller, 'Controller')) {
+            $controller .= 'Controller';
+        }
+
+        $matches['controller'] = $controller;
+        $matches['__NAMESPACE__'] = str_replace(' ', '', ucwords(str_replace('-', ' ', $namespace)));
+
+        $matchedLength = strlen($uri->getPath()) - $pathOffset;
+        return new RouteMatch(array_merge($this->defaults, $matches), $matchedLength);
+    }
+}
diff --git a/setup/module/Magento/Setup/src/Mvc/View/Http/InjectTemplateListener.php b/setup/module/Magento/Setup/src/Mvc/View/Http/InjectTemplateListener.php
new file mode 100644
index 0000000000000000000000000000000000000000..88b4210f8e89994df62d5588841adc5101f87676
--- /dev/null
+++ b/setup/module/Magento/Setup/src/Mvc/View/Http/InjectTemplateListener.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Setup\Mvc\View\Http;
+
+use Zend\EventManager\EventManagerInterface as Events;
+use Zend\Mvc\View\Http\InjectTemplateListener as ZendInjectTemplateListener;
+use Zend\Mvc\MvcEvent;
+
+class InjectTemplateListener extends ZendInjectTemplateListener
+{
+    /**
+     * Determine the top-level namespace of the controller
+     *
+     * @param  string $controller
+     * @return string
+     */
+    protected function deriveModuleNamespace($controller)
+    {
+        if (!strstr($controller, '\\')) {
+            return '';
+        }
+
+        // Retrieve the first two elemenents representing the vendor and module name.
+        $nsArray = explode('\\', $controller);
+        $subNsArray = array_slice($nsArray, 0, 2);
+        return implode('/', $subNsArray);
+    }
+
+    /**
+     * @param $namespace
+     * @return string
+     */
+    protected function deriveControllerSubNamespace($namespace)
+    {
+        if (!strstr($namespace, '\\')) {
+            return '';
+        }
+        $nsArray = explode('\\', $namespace);
+
+        // Remove the first three elements representing the vendor, module name and controller directory.
+        $subNsArray = array_slice($nsArray, 3);
+        if (empty($subNsArray)) {
+            return '';
+        }
+        return implode('/', $subNsArray);
+    }
+
+    /**
+     * Inject a template into the view model, if none present
+     *
+     * Template is derived from the controller found in the route match, and,
+     * optionally, the action, if present.
+     *
+     * @param  MvcEvent $e
+     * @return void
+     */
+    public function injectTemplate(MvcEvent $e)
+    {
+        $e->getRouteMatch()->setParam('action', null);
+        parent::injectTemplate($e);
+    }
+}
diff --git a/setup/module/Magento/Setup/view/error/404.phtml b/setup/module/Magento/Setup/view/error/404.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..be0be4e69f32c03810ffe1a7257e44d2159cc9cc
--- /dev/null
+++ b/setup/module/Magento/Setup/view/error/404.phtml
@@ -0,0 +1,131 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<h1><?php echo $this->translate('A 404 error occurred') ?></h1>
+<h2><?php echo $this->message ?></h2>
+
+<?php if (isset($this->reason) && $this->reason): ?>
+
+<?php
+$reasonMessage= '';
+switch ($this->reason) {
+    case 'error-controller-cannot-dispatch':
+        $reasonMessage = $this->translate('The requested controller was unable to dispatch the request.');
+        break;
+    case 'error-controller-not-found':
+        $reasonMessage = $this->translate('The requested controller could not be mapped to an existing controller class.');
+        break;
+    case 'error-controller-invalid':
+        $reasonMessage = $this->translate('The requested controller was not dispatchable.');
+        break;
+    case 'error-router-no-match':
+        $reasonMessage = $this->translate('The requested URL could not be matched by routing.');
+        break;
+    default:
+        $reasonMessage = $this->translate('We cannot determine at this time why a 404 was generated.');
+        break;
+}
+?>
+
+<p><?php echo $reasonMessage ?></p>
+
+<?php endif ?>
+
+<?php if (isset($this->controller) && $this->controller): ?>
+
+<dl>
+    <dt><?php echo $this->translate('Controller') ?>:</dt>
+    <dd><?php echo $this->escapeHtml($this->controller) ?>
+<?php
+if (isset($this->controller_class)
+    && $this->controller_class
+    && $this->controller_class != $this->controller
+) {
+    echo '(' . sprintf($this->translate('resolves to %s'), $this->escapeHtml($this->controller_class)) . ')';
+}
+?>
+</dd>
+</dl>
+
+<?php endif ?>
+
+<?php if (isset($this->display_exceptions) && $this->display_exceptions): ?>
+
+<?php if(isset($this->exception) && $this->exception instanceof Exception): ?>
+<hr/>
+<h2><?php echo $this->translate('Additional information') ?>:</h2>
+<h3><?php echo get_class($this->exception); ?></h3>
+<dl>
+    <dt><?php echo $this->translate('File') ?>:</dt>
+    <dd>
+        <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
+    </dd>
+    <dt><?php echo $this->translate('Message') ?>:</dt>
+    <dd>
+        <pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
+    </dd>
+    <dt><?php echo $this->translate('Stack trace') ?>:</dt>
+    <dd>
+        <pre class="prettyprint linenums"><?php echo $this->exception->getTraceAsString() ?></pre>
+    </dd>
+</dl>
+<?php
+    $e = $this->exception->getPrevious();
+    if ($e) :
+?>
+<hr/>
+<h2><?php echo $this->translate('Previous exceptions') ?>:</h2>
+<ul class="unstyled">
+    <?php while($e) : ?>
+    <li>
+        <h3><?php echo get_class($e); ?></h3>
+        <dl>
+            <dt><?php echo $this->translate('File') ?>:</dt>
+            <dd>
+                <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
+            </dd>
+            <dt><?php echo $this->translate('Message') ?>:</dt>
+            <dd>
+                <pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
+            </dd>
+            <dt><?php echo $this->translate('Stack trace') ?>:</dt>
+            <dd>
+                <pre class="prettyprint linenums"><?php echo $e->getTraceAsString() ?></pre>
+            </dd>
+        </dl>
+    </li>
+    <?php
+        $e = $e->getPrevious();
+        endwhile;
+    ?>
+</ul>
+<?php endif; ?>
+
+<?php else: ?>
+
+<h3><?php echo $this->translate('No Exception available') ?></h3>
+
+<?php endif ?>
+
+<?php endif ?>
diff --git a/setup/module/Magento/Setup/view/error/index.phtml b/setup/module/Magento/Setup/view/error/index.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..24c7e99d2f2dcd8da802c3d094791d6c5ccd7c2d
--- /dev/null
+++ b/setup/module/Magento/Setup/view/error/index.phtml
@@ -0,0 +1,86 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<h1><?php echo $this->translate('An error occurred') ?></h1>
+<h2><?php echo $this->message ?></h2>
+
+<?php if (isset($this->display_exceptions) && $this->display_exceptions): ?>
+
+<?php if(isset($this->exception) && $this->exception instanceof Exception): ?>
+<hr/>
+<h2><?php echo $this->translate('Additional information') ?>:</h2>
+<h3><?php echo get_class($this->exception); ?></h3>
+<dl>
+    <dt><?php echo $this->translate('File') ?>:</dt>
+    <dd>
+        <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
+    </dd>
+    <dt><?php echo $this->translate('Message') ?>:</dt>
+    <dd>
+        <pre class="prettyprint linenums"><?php echo $this->escapeHtml($this->exception->getMessage()) ?></pre>
+    </dd>
+    <dt><?php echo $this->translate('Stack trace') ?>:</dt>
+    <dd>
+        <pre class="prettyprint linenums"><?php echo $this->escapeHtml($this->exception->getTraceAsString()) ?></pre>
+    </dd>
+</dl>
+<?php
+    $e = $this->exception->getPrevious();
+    if ($e) :
+?>
+<hr/>
+<h2><?php echo $this->translate('Previous exceptions') ?>:</h2>
+<ul class="unstyled">
+    <?php while($e) : ?>
+    <li>
+        <h3><?php echo get_class($e); ?></h3>
+        <dl>
+            <dt><?php echo $this->translate('File') ?>:</dt>
+            <dd>
+                <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
+            </dd>
+            <dt><?php echo $this->translate('Message') ?>:</dt>
+            <dd>
+                <pre class="prettyprint linenums"><?php echo $this->escapeHtml($e->getMessage()) ?></pre>
+            </dd>
+            <dt><?php echo $this->translate('Stack trace') ?>:</dt>
+            <dd>
+                <pre class="prettyprint linenums"><?php echo $this->escapeHtml($e->getTraceAsString()) ?></pre>
+            </dd>
+        </dl>
+    </li>
+    <?php
+        $e = $e->getPrevious();
+        endwhile;
+    ?>
+</ul>
+<?php endif; ?>
+
+<?php else: ?>
+
+<h3><?php echo $this->translate('No Exception available') ?></h3>
+
+<?php endif ?>
+
+<?php endif ?>
diff --git a/setup/module/Magento/Setup/view/layout/layout.phtml b/setup/module/Magento/Setup/view/layout/layout.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..b60cf617716260cf0a8f65a5b86e90b85763a35a
--- /dev/null
+++ b/setup/module/Magento/Setup/view/layout/layout.phtml
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<?php echo $this->doctype(); ?>
+<html lang="en" ng-app="magentoSetup">
+    <head>
+        <meta charset="utf-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+        <?php echo $this->headTitle($this->translate('Magento Setup Tool'))->setSeparator(' - ')->setAutoEscape(false) ?>
+        <?php echo $this->headLink()
+            ->appendStylesheet($this->basePath() . '/pub/bootstrap/css/bootstrap.min.css')
+            ->appendStylesheet($this->basePath() . '/pub/bootstrap/css/bootstrap-theme.min.css')
+            ->appendStylesheet($this->basePath() . '/pub/magento/setup/css/app.css');
+        ?>
+        <?php echo $this->headScript()
+            ->appendFile($this->basePath() . '/pub/angular/angular.min.js')
+            ->appendFile($this->basePath() . '/pub/angular-ng-storage/angular-ng-storage.min.js')
+            ->appendFile($this->basePath() . '/pub/angular-ui-router/angular-ui-router.min.js')
+            ->appendFile($this->basePath() . '/pub/angular-ui-bootstrap/angular-ui-bootstrap.min.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/app.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/main.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/landing.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/readiness-check.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/add-database.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/web-configuration.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/customize-your-store.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/create-admin-account.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/install.js')
+            ->appendFile($this->basePath() . '/pub/magento/setup/success.js');
+        ?>
+        <?php echo $this->inlineScript() ?>
+    </head>
+    <body>
+        <div class="container">
+            <?php echo $this->content; ?>
+        </div>
+    </body>
+</html>
diff --git a/setup/module/Magento/Setup/view/magento/setup/add-database.phtml b/setup/module/Magento/Setup/view/magento/setup/add-database.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..b06692c69bb0f68ea1a0a63897cfd95392b88237
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/add-database.phtml
@@ -0,0 +1,270 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
+
+<div class="page-header">
+    <h1>{{$state.current.header}}</h1>
+</div>
+
+<form novalidate name="database" class="form-horizontal" role="form" ng-submit="testConnection()">
+    <div class="bs-callout bs-callout-warning col-sm-12 hide">
+        <h4><?php echo $this->translate('Did you want to use an existing or create a new database?'); ?></h4>
+        <div class="radio col-sm-6">
+            <label>
+                <input type="radio" name="useExistingDb" ng-model="db.useExistingDb" value="1">
+                <?php echo $this->translate('Use my existing database'); ?>
+            </label>
+        </div>
+        <div class="radio col-sm-6">
+            <label>
+                <input type="radio" name="useExistingDb" ng-model="db.useExistingDb" value="0">
+                <?php echo $this->translate('Create a database for me'); ?>
+            </label>
+        </div>
+    </div>
+
+    <div class="form-group" ng-class="{'has-error': database.dbHost.$invalid && database.submitted}">
+        <label class="col-sm-4 control-label"><?php echo $this->translate('Database Server Host'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Name and location of the server that hosts your store\'s database.'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="dbHost"
+                   ng-model="db.host"
+                   required />
+        </div>
+        <div class="col-sm-offset-4 col-sm-4" ng-show="database.dbHost.$invalid && database.submitted">
+            <div class="error-container">
+                <span ng-show="database.dbHost.$error.required"><?php echo $this->translate('You must enter a valid host name. Please check the syntax and try again.'); ?></span>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group" ng-class="{'has-error': database.dbUser.$invalid && database.submitted}">
+        <label class="col-sm-4 control-label"><?php echo $this->translate('Database Server Username'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4" ng-switch="db.useExistingDb">
+            <input ng-switch-when="1"
+                   tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Sign-in credentials for your store\'s database on the database server (does not need to be admin-level credentials).'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="dbUser"
+                   ng-model="db.user"
+                   required />
+            <input ng-switch-when="0"
+                   tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Administrator credentials to sign in to the server that will host your store\'s database.'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="dbUser"
+                   ng-model="db.user"
+                   required />
+        </div>
+        <div class="col-sm-offset-4 col-sm-4" ng-show="database.dbUser.$invalid && database.submitted">
+            <div class="error-container">
+                <span ng-show="database.dbUser.$error.required"><?php echo $this->translate('Please enter a username to continue.'); ?></span>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-sm-4 control-label"><?php echo $this->translate('Database Server Password'); ?></label>
+        <div class="col-sm-4" ng-switch="db.useExistingDb">
+            <input ng-switch-when="1"
+                   tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Sign-in credentials for your store\'s database on the database server (does not need to be admin-level credentials).'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="password"
+                   name="dbPassword"
+                   ng-model="db.password"
+                   placeholder="<?php echo $this->translate('(not always necessary)'); ?>" />
+            <input ng-switch-when="0"
+                   tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Administrator credentials to sign in to the server that will host your store\'s database.'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="password"
+                   name="dbPassword"
+                   ng-model="db.password"
+                   placeholder="<?php echo $this->translate('(not always necessary)'); ?>" />
+        </div>
+    </div>
+
+    <div class="form-group" ng-if="db.useExistingDb">
+        <label class="col-sm-4 control-label"><?php echo $this->translate('Database Name'); ?><span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Enter the name of your store\'s database.'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="dbName"
+                   ng-model="db.name"
+                   required />
+        </div>
+        <div class="col-sm-offset-4 col-sm-4" ng-show="database.dbName.$invalid && database.submitted">
+            <div class="error-container">
+                <span ng-show="database.dbName.$error.required"><?php echo $this->translate('You must enter a valid database name. Please check the syntax and try again.'); ?></span>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <div class="col-sm-offset-4 col-sm-4">
+            <button type="submit" class="btn btn-default" style="width: 100%;">
+                <?php echo $this->translate('Test Connection and Authentication'); ?>
+            </button>
+        </div>
+        <div class="col-sm-4" style="padding-top: 8px;">
+            <div ng-show="testConnection.result.success && testConnection.pressed" class="animate-show text-success">
+                <span class="glyphicon glyphicon-ok-sign text-success"></span>&nbsp;<?php echo $this->translate('Test connection successful.'); ?>
+            </div>
+            <div ng-show="!testConnection.result.success && testConnection.pressed" class="animate-show text-danger">
+                <span class="glyphicon glyphicon-remove-sign"></span>&nbsp;<?php echo $this->translate('Cannot connect to server.'); ?>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group" ng-if="db.useExistingDb==0">
+        <label class="col-sm-4 control-label"><?php echo $this->translate('New Database Name'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Create sign-in credentials for your store\'s database.'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="dbNewName"
+                   ng-model="db.newName"
+                   required />
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-sm-4 control-label"><?php echo $this->translate('Table prefix'); ?></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Enter a tracking prefix to be used for database tables created for this Magento installation. (ex: \'mg1_\' )'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="dbTablePrefix"
+                   ng-model="db.tablePrefix"
+                   placeholder="<?php echo $this->translate('(optional)'); ?>" />
+        </div>
+    </div>
+
+    <div class="form-group" ng-if="db.useExistingDb==0">
+        <label class="col-sm-3 control-label"><?php echo $this->translate('Data Access'); ?><span class="required">*</span></label>
+        <div class="col-sm-9">
+            <div class="radio">
+                <label>
+                    <input type="radio" name="db.useAccess" ng-model="db.useAccess" value="0">
+                    <?php echo $this->translate('Enter existing credentials to create the Magento database'); ?>
+                </label>
+                <div class="form-group" style="margin-top: 20px;" ng-if="db.useAccess==0">
+                    <label class="col-sm-3 control-label"><?php echo $this->translate('Username'); ?><span class="required">*</span></label>
+                    <div class="col-sm-6">
+                        <input class="form-control"
+                               style="width: 80%;"
+                               type="text"
+                               name="dbGrandUsername"
+                               ng-model="dbGrandUsername"
+                               required>
+                    </div>
+                </div>
+                <div class="form-group" ng-if="db.useAccess==0">
+                    <label class="col-sm-3 control-label"><?php echo $this->translate('Password'); ?></label>
+                    <div class="col-sm-6">
+                        <input class="form-control"
+                               style="width: 80%;"
+                               type="password"
+                               name="dbGrandPassword"
+                               ng-model="db.grandPassword"
+                               placeholder="<?php echo $this->translate('(optional)'); ?>">
+                    </div>
+                </div>
+            </div>
+            <div class="radio">
+                <label>
+                    <input type="radio" name="useAccess" ng-model="db.useAccess" value="1">
+                    <?php echo $this->translate('Enter new credentials to create the Magento database'); ?>
+                </label>
+                <div class="form-group" style="margin-top: 20px;" ng-if="db.useAccess">
+                    <label class="col-sm-3 control-label"><?php echo $this->translate('New Username'); ?><span class="required">*</span></label>
+                    <div class="col-sm-6">
+                        <input class="form-control"
+                               style="width: 80%;"
+                               type="text"
+                               name="dbNewUsername"
+                               ng-model="db.newUsername"
+                               required>
+                    </div>
+                </div>
+                <div class="form-group" ng-if="db.useAccess">
+                    <label class="col-sm-3 control-label"><?php echo $this->translate('New Password'); ?></label>
+                    <div class="col-sm-6">
+                        <input class="form-control"
+                               style="width: 80%;"
+                               type="password"
+                               name="dbNewPassword"
+                               ng-model="db.newPassword"
+                               placeholder="<?php echo $this->translate('(optional)'); ?>">
+                    </div>
+                </div>
+                <div class="form-group" ng-if="db.useAccess">
+                    <label class="col-sm-3 control-label"><?php echo $this->translate('Confirm Password'); ?></label>
+                    <div class="col-sm-6">
+                        <input class="form-control"
+                               style="width: 80%;"
+                               type="password"
+                               name="dbConfirmPassword"
+                               ng-model="db.confirmPassword">
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
\ No newline at end of file
diff --git a/downloader/template/messages.phtml b/setup/module/Magento/Setup/view/magento/setup/controls/menu.phtml
similarity index 52%
rename from downloader/template/messages.phtml
rename to setup/module/Magento/Setup/view/magento/setup/controls/menu.phtml
index 1a5fe0b17583ad57b6412a145e62dab612a25351..99f30326a10f79990a7f8c18b1544d59c1a78b79 100644
--- a/downloader/template/messages.phtml
+++ b/setup/module/Magento/Setup/view/magento/setup/controls/menu.phtml
@@ -22,16 +22,19 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
-<?php if ($messages = $this->get('messages')): ?>
-<ul class="msgs">
-<?php foreach ($messages as $type=>$msgs): ?>
-    <li>
-        <ul class="<?php echo $type ?>-msg">
-        <?php foreach ($msgs as $msg): ?>
-            <li><?php echo $msg ?></li>
-        <?php endforeach; ?>
-        </ul>
-    </li>
+<?php $expressions = []; foreach ($this->main as $item): ?>
+    <?php $expressions[] = '!$state.is(\'' . $item['id'] . '\')'; ?>
 <?php endforeach; ?>
-</ul>
-<?php endif; ?>
+<div ng-class="{show: <?php echo implode('&&', $expressions); ?>}" class="col-lg-3 hide" id="menu" style="margin-top: 40px;">
+    <nav ng-controller="navigationController">
+        <div>
+            <ul class="nav nav-pills nav-stacked">
+                <?php foreach ($this->menu as $item): ?>
+                    <li id="<?php echo $item['id']; ?>" ng-class="{ active: $state.includes('<?php echo $item['id'] ?>') }">
+                        <a ng-class="{disabled: itemStatus(<?php echo $item['order']; ?>)}" ui-sref="<?php echo $item['id']; ?>" href="#/<?php echo $item['url']; ?>"><?php echo $item['title']; ?></a>
+                    </li>
+                <?php endforeach; ?>
+            </ul>
+        </div>
+    </nav>
+</div>
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/view/magento/setup/create-admin-account.phtml b/setup/module/Magento/Setup/view/magento/setup/create-admin-account.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..93ae083d8d1aac69da1f79391da54f42258c872a
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/create-admin-account.phtml
@@ -0,0 +1,138 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<?php
+$passwordWizard = sprintf(
+    '<p><b>%s</b> {{admin.passwordStatus.label}}</p>
+        <div class=\'col-sm-12 password-strength password-strength-{{admin.passwordStatus.class}}\'>
+            <div class=\'col-sm-2\'></div>
+            <div class=\'col-sm-2\'></div>
+            <div class=\'col-sm-2\'></div>
+            <div class=\'col-sm-2\'></div>
+        </div>
+    <p>%s</p>',
+    $this->translate('Password Strength:'),
+    $this->translate('Must be a mix of at least 7 alpha and numeric characters.(Ex.: BuyIt54).')
+);
+?>
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
+
+<div class="page-header">
+    <h1>{{$state.current.header}}</h1>
+</div>
+
+<p><?php echo $this->translate('Create a new Admin account to manage you store.'); ?></p>
+
+<form novalidate name="account" class="form-horizontal" role="form" style="padding-top: 20px;">
+    <div class="form-group" ng-class="{'has-error': account.adminUsername.$invalid && account.submitted}">
+        <label class="col-sm-3 control-label"><?php echo $this->translate('New Username'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Must be 1 to 40 characters'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="text"
+                   name="adminUsername"
+                   ng-model="admin.username"
+                   ng-maxlength="40"
+                   required />
+        </div>
+        <div class="col-sm-offset-3 col-sm-4" ng-show="account.adminUsername.$invalid && account.submitted">
+            <div class="error-container">
+                <span ng-show="account.adminUsername.$error.required"><?php echo $this->translate('Please enter your new username.'); ?></span>
+                <span ng-show="account.adminUsername.$error.maxlength"><?php echo $this->translate('Please enter a username between 1 and 40 characters.'); ?></span>
+            </div>
+        </div>
+    </div>
+    <div class="form-group" ng-class="{'has-error': account.adminEmail.$invalid && account.submitted}">
+        <label class="col-sm-3 control-label"><?php echo $this->translate('New E-Mail'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Must be a correct e-mail'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="email"
+                   name="adminEmail"
+                   ng-model="admin.email"
+                   required />
+        </div>
+        <div class="col-sm-offset-3 col-sm-4" ng-show="account.adminEmail.$invalid && account.submitted">
+            <div class="error-container">
+                <span ng-show="account.adminEmail.$error.required"><?php echo $this->translate('Please enter your new e-mail.'); ?></span>
+                <span ng-show="account.adminEmail.$error.email"><?php echo $this->translate('Please enter a correct e-mail.'); ?></span>
+            </div>
+        </div>
+    </div>
+    <div class="form-group" ng-class="{'has-error': account.adminPassword.$invalid && account.submitted}">
+        <label class="col-sm-3 control-label"><?php echo $this->translate('New Password'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input ng-change="passwordStatusChange()"
+                   tooltip-placement="right"
+                   tooltip-html-unsafe="<?php echo $passwordWizard; ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="password"
+                   name="adminPassword"
+                   ng-model="admin.password"
+                   required />
+        </div>
+        <div class="col-sm-offset-3 col-sm-4" ng-show="account.adminPassword.$invalid && account.submitted">
+            <div class="error-container">
+                <span ng-show="account.adminPassword.$error.required"><?php echo $this->translate('Please enter your new password.'); ?></span>
+            </div>
+        </div>
+    </div>
+    <div class="form-group" ng-class="{'has-error': account.adminConfirm.$invalid && account.submitted}">
+        <label class="col-sm-3 control-label"><?php echo $this->translate('Confirm Password'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-sm-4">
+            <input tooltip-placement="right"
+                   tooltip="<?php echo $this->translate('Please re-enter your password'); ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   class="form-control"
+                   type="password"
+                   name="adminConfirm"
+                   ng-model="admin.confirm"
+                   confirm-password="admin.password"
+                   required />
+        </div>
+        <div class="col-sm-offset-3 col-sm-4" ng-show="account.adminConfirm.$invalid && account.submitted">
+            <div class="error-container">
+                <span ng-show="account.adminConfirm.$error.required"><?php echo $this->translate('Please re-enter your password.'); ?></span>
+                <span ng-show="account.adminConfirm.$error.confirmPassword"><?php echo $this->translate('Please make sure your passwords match.'); ?></span>
+            </div>
+        </div>
+    </div>
+</form>
+
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
diff --git a/setup/module/Magento/Setup/view/magento/setup/customize-your-store.phtml b/setup/module/Magento/Setup/view/magento/setup/customize-your-store.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..198b432a8284fe5359501bec8408ab67ea6c7607
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/customize-your-store.phtml
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
+
+<div class="page-header">
+    <h1>{{$state.current.header}}</h1>
+</div>
+
+<form class="form-horizontal" role="form">
+    <div class="form-group">
+        <label class="col-md-3 control-label"><?php echo $this->translate('Sample Data'); ?></label>
+        <div class="col-md-6">
+            <p class="form-control-static text-muted"><?php echo $this->translate('Using sample of "fake" data can be helpful, letting you automatically build your store with fictious products, tax, and payment settings. But it also creates a lot of extra data you need to remove later. Learn the pros and cons in out <a href="#">Guide to Using Sample Data</a>.'); ?></p>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <div class="checkbox col-md-4 col-md-offset-3">
+            <label>
+                <input type="checkbox" ng-model="store.useSampleData" disabled>&nbsp;<span class="text-muted"><?php echo $this->translate('Use Sample Data'); ?></span>
+            </label>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-md-3 control-label"><?php echo $this->translate('Store Default Time Zone'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-md-6">
+            <select class="form-control"
+                    ng-model="store.timezone"
+                    tooltip-placement="right"
+                    tooltip-html-unsafe="<?php echo $this->translate('The time zone in which your online store operates. You can change this later in Magento Admin.'); ?>"
+                    tooltip-trigger="focus"
+                    tooltip-append-to-body="true">
+            <?php foreach ($this->timezone as $value => $label): ?>
+                <?php echo "<option value=\"" . $value . "\">" . $label . "</option>"; ?>
+            <?php endforeach; ?>
+            </select>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-md-3 control-label"><?php echo $this->translate('Store Default Currency'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-md-5">
+            <select class="form-control"
+                    ng-model="store.currency"
+                    tooltip-placement="right"
+                    tooltip-html-unsafe="<?php echo $this->translate('The currency your store uses for price labeling, checkout, returns, credit and gift cards. You can change this later in Magento Admin.'); ?>"
+                    tooltip-trigger="focus"
+                    tooltip-append-to-body="true">
+            <?php foreach ($this->currency as $value => $label): ?>
+                <?php echo "<option value=\"" . $value . "\">" . $label . "</option>"; ?>
+            <?php endforeach; ?>
+            </select>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-md-3 control-label"><?php echo $this->translate('Store Default Language'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-md-4">
+            <select class="form-control"
+                    ng-model="store.language"
+                    tooltip-placement="right"
+                    tooltip-html-unsafe="<?php echo $this->translate('The language customers will see in your store. You can change this later in Magento Set Up Tool.'); ?>"
+                    tooltip-trigger="focus"
+                    tooltip-append-to-body="true">
+            <?php foreach ($this->language as $value => $label): ?>
+                <?php echo "<option value=\"" . $value . "\">" . $label . "</option>"; ?>
+            <?php endforeach; ?>
+            </select>
+        </div>
+    </div>
+</form>
+
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
diff --git a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/load.phtml b/setup/module/Magento/Setup/view/magento/setup/index.phtml
similarity index 80%
rename from app/code/Magento/Connect/view/adminhtml/templates/extension/custom/load.phtml
rename to setup/module/Magento/Setup/view/magento/setup/index.phtml
index 92112ac02722243c4913eb1c3c9a70df1036c20a..b5582544717ac3907e64892587d80b1f192b633b 100644
--- a/app/code/Magento/Connect/view/adminhtml/templates/extension/custom/load.phtml
+++ b/setup/module/Magento/Setup/view/magento/setup/index.phtml
@@ -22,8 +22,12 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 ?>
+<div class="row">
+    <div ng-include="'controls/menu'"></div>
 
-<div class="message info">
-    <div><?php echo __("Caution: All unsaved form data will be lost as soon as you you click on the row and the package data loads.") ?></div>
+    <div class="container {{class}}" ng-controller="mainController" id="main">
+        <div ui-view="root">
+            <div ui-view></div>
+        </div>
+    </div>
 </div>
-<?php echo $this->getPackageGridHtml() ?>
diff --git a/setup/module/Magento/Setup/view/magento/setup/install.phtml b/setup/module/Magento/Setup/view/magento/setup/install.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..6baf08f45d8a5fb6ee5ac6ecc04c4db66181d326
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/install.phtml
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-disabled="disabled" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-disabled="disabled" ng-click="start()" ng-show="isStart"><?php echo $this->translate('Try Again'); ?></a>
+</div>
+
+<div class="page-header">
+    <h1>{{$state.current.header}}</h1>
+</div>
+
+<div ng-show="!isStart" class="text-center" style="padding-top: 50px; padding-bottom: 50px;">
+    <p><?php echo $this->translate('You\'re ready!'); ?></p>
+    <button ng-click="start()" class="btn btn-primary">Install Now</button>
+</div>
+
+<div ng-show="isStart" ng-init="errorStatus='<?php echo $this->translate('Sorry we can not install Magento right now.'); ?>'">
+    <div class="progress"><div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="{{progress}}" aria-valuemin="0" aria-valuemax="100" style="width: {{progress}}%;">{{progressText}}</div></div>
+    <div ng-show="error" class="error-container">
+        <span class="glyphicon glyphicon-remove-sign "></span>
+        <span><?php echo $this->translate('We don\'t know the exact reason. Check the console log for errors before trying again.'); ?></span>
+    </div>
+    <div class="collapsed-options">
+        <a href="#" class="collapsed-options" ng-click="toggleConsole()"><?php echo $this->translate('Console Log'); ?></a>
+        <span class="caret"></span>
+    </div>
+    <div ng-show="console" id="console">
+        <div class="highlight" style="background-color: #000000;"><pre ng-bind-html="log"></pre></div>
+    </div>
+</div>
+
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-disabled="disabled" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-disabled="disabled" ng-click="start()" ng-show="isStart"><?php echo $this->translate('Try Again'); ?></a>
+</div>
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/view/magento/setup/landing.phtml b/setup/module/Magento/Setup/view/magento/setup/landing.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..13317c2a7078d016d354d5f9378dc62f263f80be
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/landing.phtml
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<div class="text-center">
+    <h1><?php echo $this->translate('Magento'); ?></h1>
+    <br/>
+    <p><?php echo $this->translate('Version x.x.x'); ?></p>
+    <br/>
+    <br/>
+    <br/>
+    <p><?php echo $this->translate('Welcome to Magento Admin, your online store headquarters.
+    Click \'Agree and Set Up Magento\' or read <a href="#/getting-start">Getting Start</a> to learn more.'); ?></p>
+    <br/>
+    <br/>
+    <br/>
+    <label><?php echo $this->translate('Choose a language:'); ?></label>
+    <select ng-change="selectLanguage()" style="width: 250px; margin: 0 auto;" class="form-control" ng-model="modelLanguage" ng-init="modelLanguage='<?php echo $this->location ?>'">
+        <?php foreach ($this->languages as $code => $title): ?>
+            <option value="<?php echo $code; ?>"><?php echo $title; ?></option>
+        <?php endforeach; ?>
+    </select>
+    <br/>
+    <br/>
+    <br/>
+    <div>
+        <a href="#/terms-and-agreement"><?php echo $this->translate('Terms & Agreement'); ?></a>
+    </div>
+    <br/>
+    <button type="button" class="btn-lg btn-primary" ng-click="nextState()"><?php echo $this->translate('Agree and Set Up Magento'); ?></button>
+</div>
diff --git a/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml b/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..957123e8f988d468b87427f7f598314566e95c87
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/readiness-check.phtml
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<div class="step-controls" ng-show="$state.is('root.readiness-check.progress')">
+    <a href="#" class="btn btn-primary" ng-click="$state.forceReload()" ng-disabled="checkingInProgress()"><?php echo $this->translate('Try Again'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()" ng-disabled="checkingInProgress() || hasErrors"><?php echo $this->translate('Next'); ?></a>
+</div>
+
+<div class="page-header">
+    <h1>{{$state.current.header}}</h1>
+</div>
+
+<div ng-show="$state.is('root.readiness-check')" class="readiness-check-landing">
+    <p><?php echo $this->translate('Let\'s check your environment for the corrent PHP version, PHP extensions, file permissions and compatibility.'); ?></p>
+    <div>
+        <a href="#" ng-click="$state.go('.progress')" class="btn btn-primary"><?php echo $this->translate('Start Readiness Check'); ?></a>
+    </div>
+</div>
+
+<div ui-view></div>
+
+<div class="step-controls" ng-show="$state.is('root.readiness-check.progress')">
+    <a href="#" class="btn btn-primary" ng-click="$state.forceReload()" ng-disabled="checkingInProgress()"><?php echo $this->translate('Try Again'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()" ng-disabled="checkingInProgress() || hasErrors"><?php echo $this->translate('Next'); ?></a>
+</div>
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml b/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..724936cd69ca2aa50b99020c83b7a2cd1a754560
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/readiness-check/progress.phtml
@@ -0,0 +1,186 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<div class="rediness-check-items">
+    <div class="bg-info" ng-switch="isCompleted()">
+        <div ng-switch-when="true" ng-switch="hasErrors">
+            <span ng-switch-when="true"><?php echo $this->translate('Completed! You need to resolve these issues to continue.'); ?></span>
+            <span ng-switch-default><?php echo $this->translate('Completed!'); ?></span>
+        </div>
+        <div ng-switch-default>
+            <img src="../pub/images/ajax-loader.gif" />&nbsp;
+            <span><?php echo $this->translate('We\'re making sure your server environment is ready for Magento to be installed.'); ?></span>
+        </div>
+    </div>
+
+    <div id="php-version" ng-show="version.visible">
+        <div ng-hide="version.processed">
+            <span><?php echo $this->translate('Checking PHP Version...'); ?></span>
+        </div>
+        <div ng-show="version.processed" ng-switch="version.responseType">
+            <div ng-switch-when="success" ng-init="updateOnSuccess(version)">
+                <span class="glyphicon glyphicon-ok-sign text-success"></span>
+                <span><?php echo $this->translate('PHP Version Check'); ?></span>
+                <div class="rediness-check-info">
+                    <?php echo $this->translate('Your PHP version is correct ({{version.data.current}}).'); ?>
+                </div>
+            </div>
+            <div ng-switch-default ng-init="updateOnError(version)">
+                <div class="rediness-check-panel-right">
+                    <p><?php echo $this->translate('Need Help?'); ?></p>
+                    <p><a href="http://www.php.net/docs.php" target="_blank"><?php echo $this->translate('PHP Documentation'); ?></a></p>
+                </div>
+                <span class="glyphicon glyphicon-remove text-danger"></span>
+                <span><?php echo $this->translate('PHP Version Check'); ?></span>
+                <div class="rediness-check-info">
+                    <p>
+                        <?php echo $this->translate('Your PHP version is {{version.data.current}}. The required PHP version is {{version.data.required}}.'); ?>
+                        <a href="#" ng-click="updateOnExpand(version)">
+                            <span ng-hide="version.expanded"><?php echo $this->translate('More detail'); ?></span>
+                            <span ng-show="version.expanded"><?php echo $this->translate('Less detail'); ?></span>
+                        </a>
+                    </p>
+                    <div class="rediness-check-block" ng-show="version.expanded">
+                        <p><?php echo $this->translate('Donwload and install PHP version {{version.data.required}} from <a href="http://www.php.net" target="_blank">www.php.net</a> using this <a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>.'); ?></p>
+                        <p><?php echo $this->translate('If you need more help please call your hosting provider.'); ?></p>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="php-extensions" ng-show="extensions.visible">
+        <div ng-hide="extensions.processed">
+            <span><?php echo $this->translate('Checking PHP Extensions...'); ?></span>
+        </div>
+        <div ng-show="extensions.processed" ng-switch="extensions.responseType">
+            <div ng-switch-when="success" ng-init="updateOnSuccess(extensions)">
+                <span class="glyphicon glyphicon-ok-sign text-success"></span>
+                <span><?php echo $this->translate('PHP Extensions Check'); ?></span>
+                <div class="rediness-check-info">
+                    <p>
+                        <?php echo $this->translate('You meet {{extensions.data.current.length}} out of {{extensions.data.required.length}} PHP extensions requirements.'); ?>
+                        <a href="#" ng-click="updateOnExpand(extensions)">
+                            <span ng-hide="extensions.expanded"><?php echo $this->translate('More detail'); ?></span>
+                            <span ng-show="extensions.expanded"><?php echo $this->translate('Less detail'); ?></span>
+                        </a>
+                    </p>
+                    <div class="rediness-check-block" ng-show="extensions.expanded">
+                        <ul class="list-unstyled">
+                            <li ng-repeat="name in extensions.data.required">
+                                <span class="glyphicon glyphicon-ok text-success"></span>
+                                <span><?php echo $this->translate('PHP Extension {{name}}.'); ?></span>
+                            </li>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+            <div ng-switch-default ng-init="updateOnError(extensions)">
+                <div class="rediness-check-panel-right">
+                    <p>Need Help?</p>
+                    <p><a href="#" target="_blank"><?php echo $this->translate('PHP Extension Help'); ?></a></p>
+                </div>
+                <span class="glyphicon glyphicon-remove text-danger"></span>
+                <span><?php echo $this->translate('PHP Extensions Check'); ?></span>
+                <div class="rediness-check-info">
+                    <p>
+                        <?php echo $this->translate('{{extensions.data.required.length - extensions.data.current.length}} missing PHP extensions.'); ?>
+                        <a href="#" ng-click="updateOnExpand(extensions)">
+                            <span ng-hide="extensions.expanded"><?php echo $this->translate('More detail'); ?></span>
+                            <span ng-show="extensions.expanded"><?php echo $this->translate('Less detail'); ?></span>
+                        </a>
+                    </p>
+                    <p><?php echo $this->translate('The best way to resolve this is to install the correct missing extensions. The exact fix depends on our server, your host, and other system variables.</br>Our <a href="#">PHP Extension Help</a> can get you started.'); ?></p>
+                    <p><?php echo $this->translate('If you need more help, please call your hosting provider.'); ?></p>
+                    <div class="rediness-check-block" ng-show="extensions.expanded">
+                        <ul class="list-unstyled">
+                            <li ng-repeat="name in extensions.data.required" ng-switch="hasItem(extensions.data.current, name)">
+                                <span ng-switch-when="true" class="glyphicon glyphicon-ok text-success"></span>
+                                <span ng-switch-default class="glyphicon glyphicon-remove text-danger"></span>
+                                <span><?php echo $this->translate('PHP Extension {{name}}.'); ?></span>
+                            </li>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="php-permissions" ng-show="permissions.visible">
+        <div ng-hide="permissions.processed">
+            <span><?php echo $this->translate('Checking File Permissions...'); ?></span>
+        </div>
+        <div ng-show="permissions.processed" ng-switch="permissions.responseType">
+            <div ng-switch-when="success" ng-init="updateOnSuccess(permissions)">
+                <span class="glyphicon glyphicon-ok-sign text-success"></span>
+                <span><?php echo $this->translate('File Permission Check'); ?></span>
+                <div class="rediness-check-info">
+                    <p>
+                        <?php echo $this->translate('You meet {{permissions.data.current.length}} out of {{permissions.data.required.length}} file permission requirements.'); ?>
+                        <a href="#" ng-click="updateOnExpand(permissions)">
+                            <span ng-hide="permissions.expanded"><?php echo $this->translate('More detail'); ?></span>
+                            <span ng-show="permissions.expanded"><?php echo $this->translate('Less detail'); ?></span>
+                        </a>
+                    </p>
+                    <div class="rediness-check-block" ng-show="permissions.expanded">
+                        <ul class="list-unstyled">
+                            <li ng-repeat="name in permissions.data.required">
+                                <span class="glyphicon glyphicon-ok text-success"></span>
+                                <span><?php echo $this->translate('"{{name}}" directory permission.'); ?></span>
+                            </li>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+            <div ng-switch-default ng-init="updateOnError(permissions)">
+                <div class="rediness-check-panel-right">
+                    <p><?php echo $this->translate('Need Help?'); ?></p>
+                    <p><a href="#" target="_blank"><?php echo $this->translate('File Permission Help'); ?></a></p>
+                </div>
+                <span class="glyphicon glyphicon-remove text-danger"></span>
+                <span><?php echo $this->translate('File Permission Check'); ?></span>
+                <div class="rediness-check-info">
+                    <p>
+                        <?php echo $this->translate('{{permissions.data.required.length - permissions.data.current.length}} file permission not met.'); ?>
+                        <a href="#" ng-click="updateOnExpand(permissions)">
+                            <span ng-hide="permissions.expanded"><?php echo $this->translate('More detail'); ?></span>
+                            <span ng-show="permissions.expanded"><?php echo $this->translate('Less detail'); ?></span>
+                        </a>
+                    </p>
+                    <p><?php echo $this->translate('The best way to resolve this is to allow write permissions for the following Magento directories. The exact fix depends on your server, your host, and other system variables.</br>Our <a href="#">File Permission Help</a> can get you started.'); ?></p>
+                    <p><?php echo $this->translate('If you need more help, please call your hosting provider.'); ?></p>
+                    <div class="rediness-check-block" ng-show="permissions.expanded">
+                        <ul class="list-unstyled">
+                            <li ng-repeat="name in permissions.data.required" ng-switch="hasItem(permissions.data.current, name)">
+                                <span ng-switch-when="true" class="glyphicon glyphicon-ok text-success"></span>
+                                <span ng-switch-default class="glyphicon glyphicon-remove text-danger"></span>
+                                <span><?php echo $this->translate('"{{name}}" directory permission.'); ?></span>
+                            </li>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
diff --git a/setup/module/Magento/Setup/view/magento/setup/success.phtml b/setup/module/Magento/Setup/view/magento/setup/success.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..c4d0b078be3d35f99d5d3d06ba5f39898d54ab2c
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/success.phtml
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<h1 class="text-center"><span class="glyphicon glyphicon-ok-sign text-success"></span>&nbsp;<?php echo $this->translate('Success'); ?></h1>
+<p><?php echo $this->translate('Please keep this information for your records'); ?>:</p>
+<div id="admin-info" class="col-lg-12 p-top-10">
+    <div class="col-sm-12 bold p-top-10"><?php echo $this->translate('Magento Admin Info'); ?>:</div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Username'); ?>:</div>
+        <div class="col-sm-6">{{admin.username}}</div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('E-Mail'); ?>:</div>
+        <div class="col-sm-6">{{admin.email}}</div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Password'); ?>:</div>
+        <div class="col-sm-6">******</div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Your Store Address'); ?>:</div>
+        <div class="col-sm-6"><a href="{{config.address.web}}">{{config.address.web}}</a></div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Magento Admin Address'); ?>:</div>
+        <div class="col-sm-6"><a href="{{config.address.web}}{{config.address.admin}}">{{config.address.web}}{{config.address.admin}}/</a></div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Encryption Key'); ?>:</div>
+        <div class="col-sm-6">{{config.encrypt.key}}</div>
+    </div>
+</div>
+<div id="db-info" class="col-lg-12 p-top-10">
+    <div class="col-sm-12 bold p-top-10"><?php echo $this->translate('Database Info'); ?>:</div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Database Name'); ?>:</div>
+        <div class="col-sm-6">{{db.name}}</div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Username'); ?>:</div>
+        <div class="col-sm-6">{{db.user}}</div>
+    </div>
+    <div class="row p-top-10">
+        <div class="col-sm-6"><?php echo $this->translate('Password'); ?>:</div>
+        <div class="col-sm-6">******</div>
+    </div>
+</div>
+<div class="text-center">
+    <a type="button" class="btn btn-primary" href="{{config.address.web}}{{config.address.admin}}"><?php echo $this->translate('Launch Magento Admin'); ?></a>
+</div>
\ No newline at end of file
diff --git a/setup/module/Magento/Setup/view/magento/setup/web-configuration.phtml b/setup/module/Magento/Setup/view/magento/setup/web-configuration.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..c053e44c4efde77cb3b7dc09d816fa5b21946ef7
--- /dev/null
+++ b/setup/module/Magento/Setup/view/magento/setup/web-configuration.phtml
@@ -0,0 +1,165 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+?>
+<?php
+$hints = [
+    'address_web' => sprintf(
+        '<div><p>%s</p><p>%s</p><p><a href=\'#\'>%s</a></p></div>',
+        $this->translate('Enter the base URL that brings shoppers to your store (Ex. http://example.com/).'),
+        $this->translate('We recommend not using your actual IP address when your store goes live, otherwise all your shoppers will see it.'),
+        $this->translate('Detect IP Address')
+    ),
+    'encrypt_key' => sprintf(
+        '<p>%s</p>',
+        $this->translate('Key to encrypt sensitive data such as passwords and personally identifiable customer informaton in the Magento database. The encryption key is stored in [your Magento install dir]/app/etc/local.xml/')
+    ),
+];
+?>
+
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
+
+<div class="page-header">
+    <h1>{{$state.current.header}}</h1>
+</div>
+
+<form novalidate name="webconfig" class="form-horizontal" role="form">
+    <div class="form-group" ng-class="{'has-error': webconfig.web.$invalid && webconfig.submitted}">
+        <label class="col-md-3 control-label"><?php echo $this->translate('Your Store Address'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-md-4">
+            <input type="text"
+                   name="web"
+                   ng-model="config.address.web"
+                   class="form-control"
+                   ng-focus=""
+                   tooltip-placement="right"
+                   tooltip-html-unsafe="<?php echo $hints['address_web']; ?>"
+                   tooltip-trigger="focus"
+                   tooltip-append-to-body="true"
+                   required />
+        </div>
+        <div class="col-md-offset-3 col-md-4" ng-show="webconfig.web.$invalid && webconfig.submitted">
+            <div class="error-container">
+                <span ng-show="webconfig.web.$error.required"><?php echo $this->translate('Please enter a valid base URL Admin URL path. (ex: http://www.example.com/)'); ?></span>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group" ng-class="{'has-error': webconfig.admin.$invalid && webconfig.submitted}">
+        <label class="col-md-3 control-label"><?php echo $this->translate('Magento Admin Address'); ?>&nbsp;<span class="required">*</span></label>
+        <div class="col-md-4 input-group" style="padding-left: 15px; padding-right: 15px;">
+            <span class="input-group-addon">{{config.address.web}}</span>
+            <input type="text"
+                   name="admin"
+                   class="form-control"
+                   ng-model="config.address.admin"
+                   required />
+        </div>
+        <div class="col-md-offset-3 col-md-4" ng-show="webconfig.admin.$invalid && webconfig.submitted">
+            <div class="error-container">
+                <span ng-show="webconfig.admin.$error.required"><?php echo $this->translate('Please enter a valid admin URL path.'); ?></span>
+            </div>
+        </div>
+    </div>
+
+    <div class="collapsed-options">
+        <a href="#" class="collapsed-options" ng-click="updateOnExpand(config.advanced)"><?php echo $this->translate('Advanced Options'); ?></a>
+        <span class="caret"></span>
+    </div>
+
+    <div ng-show="config.advanced.expanded">
+        <div class="form-group">
+            <label class="col-md-3 control-label"><?php echo $this->translate('HTTPS Options'); ?></label>
+            <div class="col-md-5">
+                <div class="checkbox">
+                    <label>
+                        <input type="checkbox" ng-model="config.https.front">&nbsp;<?php echo $this->translate('Use HTTPS for Magento Storefront'); ?>
+                    </label>
+                </div>
+                <div class="checkbox">
+                    <label>
+                        <input type="checkbox" ng-model="config.https.admin">&nbsp;<?php echo $this->translate('Use HTTPS for Magento Admin'); ?>
+                    </label>
+                </div>
+            </div>
+        </div>
+
+        <div class="form-group">
+            <label class="col-md-3 control-label"><?php echo $this->translate('Apache Rewrites'); ?></label>
+            <div class="col-md-5">
+                <div class="checkbox">
+                    <label>
+                        <input type="checkbox" ng-model="config.rewrites.allowed">&nbsp;<?php echo $this->translate('Use Web Server Apache Rewrites'); ?>
+                    </label>
+                </div>
+            </div>
+        </div>
+
+        <div class="form-group">
+            <label class="col-md-3 control-label"><?php echo $this->translate('Encryption Key'); ?>&nbsp;<span class="required">*</span></label>
+            <div class="col-md-5">
+                <div class="radio">
+                    <label>
+                        <input type="radio" ng-model="config.encrypt.type" value="magento">&nbsp;<?php echo $this->translate('I want to use a Magento generated key'); ?>
+                    </label>
+                </div>
+                <div class="radio">
+                    <label>
+                        <input type="radio" ng-model="config.encrypt.type" value="user">&nbsp;<?php echo $this->translate('I want to use my own encryption key'); ?>
+                    </label>
+                </div>
+            </div>
+        </div>
+
+        <div class="form-group"
+             ng-class="{'has-error': webconfig.key.$invalid && webconfig.submitted}"
+             ng-if="showEncryptKey()">
+            <div class="col-md-4 col-md-offset-3">
+                <input type="text"
+                       name="key"
+                       class="form-control"
+                       ng-model="config.encrypt.key"
+                       tooltip-placement="right"
+                       tooltip-html-unsafe="<?php echo $hints['encrypt_key']; ?>"
+                       tooltip-trigger="focus"
+                       tooltip-append-to-body="true"
+                       ng-minlength="4"
+                       required />
+            </div>
+            <div class="col-md-offset-3 col-md-4" ng-show="webconfig.key.$invalid && webconfig.submitted">
+                <div class="error-container">
+                    <span ng-show="webconfig.key.$error.required"><?php echo $this->translate('You must enter an encryption key.'); ?></span>
+                    <span ng-show="webconfig.key.$error.minlength"><?php echo $this->translate('Your encryption key must be longer and stronger.'); ?></span>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+
+<div class="step-controls">
+    <a href="#" class="btn btn-primary" ng-click="previousState()"><?php echo $this->translate('Previous'); ?></a>
+    <a href="#" class="btn btn-primary" ng-click="nextState()"><?php echo $this->translate('Next'); ?></a>
+</div>
diff --git a/setup/pub/angular-ng-storage/angular-ng-storage.min.js b/setup/pub/angular-ng-storage/angular-ng-storage.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..f5526bbace8ef7bfeecc8a74852601607e5fef1d
--- /dev/null
+++ b/setup/pub/angular-ng-storage/angular-ng-storage.min.js
@@ -0,0 +1 @@
+/*! ngStorage 0.3.0 | Copyright (c) 2013 Gias Kay Lee | MIT License */"use strict";!function(){function a(a){return["$rootScope","$window",function(b,c){for(var d,e,f,g=c[a]||(console.warn("This browser does not support Web Storage!"),{}),h={$default:function(a){for(var b in a)angular.isDefined(h[b])||(h[b]=a[b]);return h},$reset:function(a){for(var b in h)"$"===b[0]||delete h[b];return h.$default(a)}},i=0;i<g.length;i++)(f=g.key(i))&&"ngStorage-"===f.slice(0,10)&&(h[f.slice(10)]=angular.fromJson(g.getItem(f)));return d=angular.copy(h),b.$watch(function(){e||(e=setTimeout(function(){if(e=null,!angular.equals(h,d)){angular.forEach(h,function(a,b){angular.isDefined(a)&&"$"!==b[0]&&g.setItem("ngStorage-"+b,angular.toJson(a)),delete d[b]});for(var a in d)g.removeItem("ngStorage-"+a);d=angular.copy(h)}},100))}),"localStorage"===a&&c.addEventListener&&c.addEventListener("storage",function(a){"ngStorage-"===a.key.slice(0,10)&&(a.newValue?h[a.key.slice(10)]=angular.fromJson(a.newValue):delete h[a.key.slice(10)],d=angular.copy(h),b.$apply())}),h}]}angular.module("ngStorage",[]).factory("$localStorage",a("localStorage")).factory("$sessionStorage",a("sessionStorage"))}();
\ No newline at end of file
diff --git a/setup/pub/angular-ui-bootstrap/angular-ui-bootstrap.min.js b/setup/pub/angular-ui-bootstrap/angular-ui-bootstrap.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..fa6a8613174cfc4bad968a1a7136aedffeacedbf
--- /dev/null
+++ b/setup/pub/angular-ui-bootstrap/angular-ui-bootstrap.min.js
@@ -0,0 +1,10 @@
+/*
+ * angular-ui-bootstrap
+ * http://angular-ui.github.io/bootstrap/
+
+ * Version: 0.11.0 - 2014-05-01
+ * License: MIT
+ */
+angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.bindHtml","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.dropdown","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/modal/backdrop.html","template/modal/window.html","template/pagination/pager.html","template/pagination/pagination.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html","template/progressbar/bar.html","template/progressbar/progress.html","template/progressbar/progressbar.html","template/rating/rating.html","template/tabs/tab.html","template/tabs/tabset.html","template/timepicker/timepicker.html","template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)}),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(a){return{link:function(b,c,d){function e(b){function d(){j===e&&(j=void 0)}var e=a(c,b);return j&&j.cancel(),j=e,e.then(d,d),e}function f(){k?(k=!1,g()):(c.removeClass("collapse").addClass("collapsing"),e({height:c[0].scrollHeight+"px"}).then(g))}function g(){c.removeClass("collapsing"),c.addClass("collapse in"),c.css({height:"auto"})}function h(){if(k)k=!1,i(),c.css({height:0});else{c.css({height:c[0].scrollHeight+"px"});{c[0].offsetWidth}c.removeClass("collapse in").addClass("collapsing"),e({height:0}).then(i)}}function i(){c.removeClass("collapsing"),c.addClass("collapse")}var j,k=!0;b.$watch(d.collapse,function(a){a?h():f()})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("accordionConfig",{closeOthers:!0}).controller("AccordionController",["$scope","$attrs","accordionConfig",function(a,b,c){this.groups=[],this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)})},this.addGroup=function(a){var b=this;this.groups.push(a),a.$on("$destroy",function(){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(b,1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,templateUrl:"template/accordion/accordion.html"}}).directive("accordionGroup",function(){return{require:"^accordion",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/accordion/accordion-group.html",scope:{heading:"@",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(a){this.heading=a}},link:function(a,b,c,d){d.addGroup(a),a.$watch("isOpen",function(b){b&&d.closeOthers(a)}),a.toggleOpen=function(){a.isDisabled||(a.isOpen=!a.isOpen)}}}}).directive("accordionHeading",function(){return{restrict:"EA",transclude:!0,template:"",replace:!0,require:"^accordionGroup",link:function(a,b,c,d,e){d.setHeading(e(a,function(){}))}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(a,b,c,d){a.$watch(function(){return d[c.accordionTransclude]},function(a){a&&(b.html(""),b.append(a))})}}}),angular.module("ui.bootstrap.alert",[]).controller("AlertController",["$scope","$attrs",function(a,b){a.closeable="close"in b}]).directive("alert",function(){return{restrict:"EA",controller:"AlertController",templateUrl:"template/alert/alert.html",transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(a,b,c){b.addClass("ng-binding").data("$binding",c.bindHtmlUnsafe),a.$watch(c.bindHtmlUnsafe,function(a){b.html(a||"")})}}),angular.module("ui.bootstrap.buttons",[]).constant("buttonConfig",{activeClass:"active",toggleEvent:"click"}).controller("ButtonsController",["buttonConfig",function(a){this.activeClass=a.activeClass||"active",this.toggleEvent=a.toggleEvent||"click"}]).directive("btnRadio",function(){return{require:["btnRadio","ngModel"],controller:"ButtonsController",link:function(a,b,c,d){var e=d[0],f=d[1];f.$render=function(){b.toggleClass(e.activeClass,angular.equals(f.$modelValue,a.$eval(c.btnRadio)))},b.bind(e.toggleEvent,function(){var d=b.hasClass(e.activeClass);(!d||angular.isDefined(c.uncheckable))&&a.$apply(function(){f.$setViewValue(d?null:a.$eval(c.btnRadio)),f.$render()})})}}}).directive("btnCheckbox",function(){return{require:["btnCheckbox","ngModel"],controller:"ButtonsController",link:function(a,b,c,d){function e(){return g(c.btnCheckboxTrue,!0)}function f(){return g(c.btnCheckboxFalse,!1)}function g(b,c){var d=a.$eval(b);return angular.isDefined(d)?d:c}var h=d[0],i=d[1];i.$render=function(){b.toggleClass(h.activeClass,angular.equals(i.$modelValue,e()))},b.bind(h.toggleEvent,function(){a.$apply(function(){i.$setViewValue(b.hasClass(h.activeClass)?f():e()),i.$render()})})}}}),angular.module("ui.bootstrap.carousel",["ui.bootstrap.transition"]).controller("CarouselController",["$scope","$timeout","$transition",function(a,b,c){function d(){e();var c=+a.interval;!isNaN(c)&&c>=0&&(g=b(f,c))}function e(){g&&(b.cancel(g),g=null)}function f(){h?(a.next(),d()):a.pause()}var g,h,i=this,j=i.slides=a.slides=[],k=-1;i.currentSlide=null;var l=!1;i.select=a.select=function(e,f){function g(){if(!l){if(i.currentSlide&&angular.isString(f)&&!a.noTransition&&e.$element){e.$element.addClass(f);{e.$element[0].offsetWidth}angular.forEach(j,function(a){angular.extend(a,{direction:"",entering:!1,leaving:!1,active:!1})}),angular.extend(e,{direction:f,active:!0,entering:!0}),angular.extend(i.currentSlide||{},{direction:f,leaving:!0}),a.$currentTransition=c(e.$element,{}),function(b,c){a.$currentTransition.then(function(){h(b,c)},function(){h(b,c)})}(e,i.currentSlide)}else h(e,i.currentSlide);i.currentSlide=e,k=m,d()}}function h(b,c){angular.extend(b,{direction:"",active:!0,leaving:!1,entering:!1}),angular.extend(c||{},{direction:"",active:!1,leaving:!1,entering:!1}),a.$currentTransition=null}var m=j.indexOf(e);void 0===f&&(f=m>k?"next":"prev"),e&&e!==i.currentSlide&&(a.$currentTransition?(a.$currentTransition.cancel(),b(g)):g())},a.$on("$destroy",function(){l=!0}),i.indexOfSlide=function(a){return j.indexOf(a)},a.next=function(){var b=(k+1)%j.length;return a.$currentTransition?void 0:i.select(j[b],"next")},a.prev=function(){var b=0>k-1?j.length-1:k-1;return a.$currentTransition?void 0:i.select(j[b],"prev")},a.isActive=function(a){return i.currentSlide===a},a.$watch("interval",d),a.$on("$destroy",e),a.play=function(){h||(h=!0,d())},a.pause=function(){a.noPause||(h=!1,e())},i.addSlide=function(b,c){b.$element=c,j.push(b),1===j.length||b.active?(i.select(j[j.length-1]),1==j.length&&a.play()):b.active=!1},i.removeSlide=function(a){var b=j.indexOf(a);j.splice(b,1),j.length>0&&a.active?i.select(b>=j.length?j[b-1]:j[b]):k>b&&k--}}]).directive("carousel",[function(){return{restrict:"EA",transclude:!0,replace:!0,controller:"CarouselController",require:"carousel",templateUrl:"template/carousel/carousel.html",scope:{interval:"=",noTransition:"=",noPause:"="}}}]).directive("slide",function(){return{require:"^carousel",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/carousel/slide.html",scope:{active:"=?"},link:function(a,b,c,d){d.addSlide(a,b),a.$on("$destroy",function(){d.removeSlide(a)}),a.$watch("active",function(b){b&&d.select(a)})}}}),angular.module("ui.bootstrap.dateparser",[]).service("dateParser",["$locale","orderByFilter",function(a,b){function c(a,b,c){return 1===b&&c>28?29===c&&(a%4===0&&a%100!==0||a%400===0):3===b||5===b||8===b||10===b?31>c:!0}this.parsers={};var d={yyyy:{regex:"\\d{4}",apply:function(a){this.year=+a}},yy:{regex:"\\d{2}",apply:function(a){this.year=+a+2e3}},y:{regex:"\\d{1,4}",apply:function(a){this.year=+a}},MMMM:{regex:a.DATETIME_FORMATS.MONTH.join("|"),apply:function(b){this.month=a.DATETIME_FORMATS.MONTH.indexOf(b)}},MMM:{regex:a.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(b){this.month=a.DATETIME_FORMATS.SHORTMONTH.indexOf(b)}},MM:{regex:"0[1-9]|1[0-2]",apply:function(a){this.month=a-1}},M:{regex:"[1-9]|1[0-2]",apply:function(a){this.month=a-1}},dd:{regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a}},d:{regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a}},EEEE:{regex:a.DATETIME_FORMATS.DAY.join("|")},EEE:{regex:a.DATETIME_FORMATS.SHORTDAY.join("|")}};this.createParser=function(a){var c=[],e=a.split("");return angular.forEach(d,function(b,d){var f=a.indexOf(d);if(f>-1){a=a.split(""),e[f]="("+b.regex+")",a[f]="$";for(var g=f+1,h=f+d.length;h>g;g++)e[g]="",a[g]="$";a=a.join(""),c.push({index:f,apply:b.apply})}}),{regex:new RegExp("^"+e.join("")+"$"),map:b(c,"index")}},this.parse=function(b,d){if(!angular.isString(b))return b;d=a.DATETIME_FORMATS[d]||d,this.parsers[d]||(this.parsers[d]=this.createParser(d));var e=this.parsers[d],f=e.regex,g=e.map,h=b.match(f);if(h&&h.length){for(var i,j={year:1900,month:0,date:1,hours:0},k=1,l=h.length;l>k;k++){var m=g[k-1];m.apply&&m.apply.call(j,h[k])}return c(j.year,j.month,j.date)&&(i=new Date(j.year,j.month,j.date,j.hours)),i}}}]),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);f!=a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft);var g=b[0].getBoundingClientRect();return{width:g.width||b.prop("offsetWidth"),height:g.height||b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}},positionElements:function(a,b,c,d){var e,f,g,h,i=c.split("-"),j=i[0],k=i[1]||"center";e=d?this.offset(a):this.position(a),f=b.prop("offsetWidth"),g=b.prop("offsetHeight");var l={center:function(){return e.left+e.width/2-f/2},left:function(){return e.left},right:function(){return e.left+e.width}},m={center:function(){return e.top+e.height/2-g/2},top:function(){return e.top},bottom:function(){return e.top+e.height}};switch(j){case"right":h={top:m[k](),left:l[j]()};break;case"left":h={top:m[k](),left:e.left-f};break;case"bottom":h={top:m[j](),left:l[k]()};break;default:h={top:e.top-g,left:l[k]()}}return h}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("datepickerConfig",{formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",datepickerMode:"day",minMode:"day",maxMode:"year",showWeeks:!0,startingDay:0,yearRange:20,minDate:null,maxDate:null}).controller("DatepickerController",["$scope","$attrs","$parse","$interpolate","$timeout","$log","dateFilter","datepickerConfig",function(a,b,c,d,e,f,g,h){var i=this,j={$setViewValue:angular.noop};this.modes=["day","month","year"],angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","minMode","maxMode","showWeeks","startingDay","yearRange"],function(c,e){i[c]=angular.isDefined(b[c])?8>e?d(b[c])(a.$parent):a.$parent.$eval(b[c]):h[c]}),angular.forEach(["minDate","maxDate"],function(d){b[d]?a.$parent.$watch(c(b[d]),function(a){i[d]=a?new Date(a):null,i.refreshView()}):i[d]=h[d]?new Date(h[d]):null}),a.datepickerMode=a.datepickerMode||h.datepickerMode,a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),this.activeDate=angular.isDefined(b.initDate)?a.$parent.$eval(b.initDate):new Date,a.isActive=function(b){return 0===i.compare(b.date,i.activeDate)?(a.activeDateId=b.uid,!0):!1},this.init=function(a){j=a,j.$render=function(){i.render()}},this.render=function(){if(j.$modelValue){var a=new Date(j.$modelValue),b=!isNaN(a);b?this.activeDate=a:f.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'),j.$setValidity("date",b)}this.refreshView()},this.refreshView=function(){if(this.element){this._refreshView();var a=j.$modelValue?new Date(j.$modelValue):null;j.$setValidity("date-disabled",!a||this.element&&!this.isDisabled(a))}},this.createDateObject=function(a,b){var c=j.$modelValue?new Date(j.$modelValue):null;return{date:a,label:g(a,b),selected:c&&0===this.compare(a,c),disabled:this.isDisabled(a),current:0===this.compare(a,new Date)}},this.isDisabled=function(c){return this.minDate&&this.compare(c,this.minDate)<0||this.maxDate&&this.compare(c,this.maxDate)>0||b.dateDisabled&&a.dateDisabled({date:c,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===i.minMode){var c=j.$modelValue?new Date(j.$modelValue):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),j.$setViewValue(c),j.$render()}else i.activeDate=b,a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)-1]},a.move=function(a){var b=i.activeDate.getFullYear()+a*(i.step.years||0),c=i.activeDate.getMonth()+a*(i.step.months||0);i.activeDate.setFullYear(b,c,1),i.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===i.maxMode&&1===b||a.datepickerMode===i.minMode&&-1===b||(a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)+b])},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var k=function(){e(function(){i.element[0].focus()},0,!1)};a.$on("datepicker.focus",k),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey)if(b.preventDefault(),b.stopPropagation(),"enter"===c||"space"===c){if(i.isDisabled(i.activeDate))return;a.select(i.activeDate),k()}else!b.ctrlKey||"up"!==c&&"down"!==c?(i.handleKeyDown(c,b),i.refreshView()):(a.toggleMode("up"===c?1:-1),k())}}]).directive("datepicker",function(){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/datepicker.html",scope:{datepickerMode:"=?",dateDisabled:"&"},require:["datepicker","?^ngModel"],controller:"DatepickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f)}}}).directive("daypicker",["dateFilter",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/day.html",require:"^datepicker",link:function(b,c,d,e){function f(a,b){return 1!==b||a%4!==0||a%100===0&&a%400!==0?i[b]:29}function g(a,b){var c=new Array(b),d=new Date(a),e=0;for(d.setHours(12);b>e;)c[e++]=new Date(d),d.setDate(d.getDate()+1);return c}function h(a){var b=new Date(a);b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1}b.showWeeks=e.showWeeks,e.step={months:1},e.element=c;var i=[31,28,31,30,31,30,31,31,30,31,30,31];e._refreshView=function(){var c=e.activeDate.getFullYear(),d=e.activeDate.getMonth(),f=new Date(c,d,1),i=e.startingDay-f.getDay(),j=i>0?7-i:-i,k=new Date(f);j>0&&k.setDate(-j+1);for(var l=g(k,42),m=0;42>m;m++)l[m]=angular.extend(e.createDateObject(l[m],e.formatDay),{secondary:l[m].getMonth()!==d,uid:b.uniqueId+"-"+m});b.labels=new Array(7);for(var n=0;7>n;n++)b.labels[n]={abbr:a(l[n].date,e.formatDayHeader),full:a(l[n].date,"EEEE")};if(b.title=a(e.activeDate,e.formatDayTitle),b.rows=e.split(l,7),b.showWeeks){b.weekNumbers=[];for(var o=h(b.rows[0][0].date),p=b.rows.length;b.weekNumbers.push(o++)<p;);}},e.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},e.handleKeyDown=function(a){var b=e.activeDate.getDate();if("left"===a)b-=1;else if("up"===a)b-=7;else if("right"===a)b+=1;else if("down"===a)b+=7;else if("pageup"===a||"pagedown"===a){var c=e.activeDate.getMonth()+("pageup"===a?-1:1);e.activeDate.setMonth(c,1),b=Math.min(f(e.activeDate.getFullYear(),e.activeDate.getMonth()),b)}else"home"===a?b=1:"end"===a&&(b=f(e.activeDate.getFullYear(),e.activeDate.getMonth()));e.activeDate.setDate(b)},e.refreshView()}}}]).directive("monthpicker",["dateFilter",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/month.html",require:"^datepicker",link:function(b,c,d,e){e.step={years:1},e.element=c,e._refreshView=function(){for(var c=new Array(12),d=e.activeDate.getFullYear(),f=0;12>f;f++)c[f]=angular.extend(e.createDateObject(new Date(d,f,1),e.formatMonth),{uid:b.uniqueId+"-"+f});b.title=a(e.activeDate,e.formatMonthTitle),b.rows=e.split(c,3)},e.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth())-new Date(b.getFullYear(),b.getMonth())},e.handleKeyDown=function(a){var b=e.activeDate.getMonth();if("left"===a)b-=1;else if("up"===a)b-=3;else if("right"===a)b+=1;else if("down"===a)b+=3;else if("pageup"===a||"pagedown"===a){var c=e.activeDate.getFullYear()+("pageup"===a?-1:1);e.activeDate.setFullYear(c)}else"home"===a?b=0:"end"===a&&(b=11);e.activeDate.setMonth(b)},e.refreshView()}}}]).directive("yearpicker",["dateFilter",function(){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/year.html",require:"^datepicker",link:function(a,b,c,d){function e(a){return parseInt((a-1)/f,10)*f+1}var f=d.yearRange;d.step={years:f},d.element=b,d._refreshView=function(){for(var b=new Array(f),c=0,g=e(d.activeDate.getFullYear());f>c;c++)b[c]=angular.extend(d.createDateObject(new Date(g+c,0,1),d.formatYear),{uid:a.uniqueId+"-"+c});a.title=[b[0].label,b[f-1].label].join(" - "),a.rows=d.split(b,5)},d.compare=function(a,b){return a.getFullYear()-b.getFullYear()},d.handleKeyDown=function(a){var b=d.activeDate.getFullYear();"left"===a?b-=1:"up"===a?b-=5:"right"===a?b+=1:"down"===a?b+=5:"pageup"===a||"pagedown"===a?b+=("pageup"===a?-1:1)*d.step.years:"home"===a?b=e(d.activeDate.getFullYear()):"end"===a&&(b=e(d.activeDate.getFullYear())+f-1),d.activeDate.setFullYear(b)},d.refreshView()}}}]).constant("datepickerPopupConfig",{datepickerPopup:"yyyy-MM-dd",currentText:"Today",clearText:"Clear",closeText:"Done",closeOnDateSelection:!0,appendToBody:!1,showButtonBar:!0}).directive("datepickerPopup",["$compile","$parse","$document","$position","dateFilter","dateParser","datepickerPopupConfig",function(a,b,c,d,e,f,g){return{restrict:"EA",require:"ngModel",scope:{isOpen:"=?",currentText:"@",clearText:"@",closeText:"@",dateDisabled:"&"},link:function(h,i,j,k){function l(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function m(a){if(a){if(angular.isDate(a)&&!isNaN(a))return k.$setValidity("date",!0),a;if(angular.isString(a)){var b=f.parse(a,n)||new Date(a);return isNaN(b)?void k.$setValidity("date",!1):(k.$setValidity("date",!0),b)}return void k.$setValidity("date",!1)}return k.$setValidity("date",!0),null}var n,o=angular.isDefined(j.closeOnDateSelection)?h.$parent.$eval(j.closeOnDateSelection):g.closeOnDateSelection,p=angular.isDefined(j.datepickerAppendToBody)?h.$parent.$eval(j.datepickerAppendToBody):g.appendToBody;h.showButtonBar=angular.isDefined(j.showButtonBar)?h.$parent.$eval(j.showButtonBar):g.showButtonBar,h.getText=function(a){return h[a+"Text"]||g[a+"Text"]},j.$observe("datepickerPopup",function(a){n=a||g.datepickerPopup,k.$render()});var q=angular.element("<div datepicker-popup-wrap><div datepicker></div></div>");q.attr({"ng-model":"date","ng-change":"dateSelection()"});var r=angular.element(q.children()[0]);j.datepickerOptions&&angular.forEach(h.$parent.$eval(j.datepickerOptions),function(a,b){r.attr(l(b),a)}),angular.forEach(["minDate","maxDate"],function(a){j[a]&&(h.$parent.$watch(b(j[a]),function(b){h[a]=b}),r.attr(l(a),a))}),j.dateDisabled&&r.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),k.$parsers.unshift(m),h.dateSelection=function(a){angular.isDefined(a)&&(h.date=a),k.$setViewValue(h.date),k.$render(),o&&(h.isOpen=!1,i[0].focus())},i.bind("input change keyup",function(){h.$apply(function(){h.date=k.$modelValue})}),k.$render=function(){var a=k.$viewValue?e(k.$viewValue,n):"";i.val(a),h.date=m(k.$modelValue)};var s=function(a){h.isOpen&&a.target!==i[0]&&h.$apply(function(){h.isOpen=!1})},t=function(a){h.keydown(a)};i.bind("keydown",t),h.keydown=function(a){27===a.which?(a.preventDefault(),a.stopPropagation(),h.close()):40!==a.which||h.isOpen||(h.isOpen=!0)},h.$watch("isOpen",function(a){a?(h.$broadcast("datepicker.focus"),h.position=p?d.offset(i):d.position(i),h.position.top=h.position.top+i.prop("offsetHeight"),c.bind("click",s)):c.unbind("click",s)}),h.select=function(a){if("today"===a){var b=new Date;angular.isDate(k.$modelValue)?(a=new Date(k.$modelValue),a.setFullYear(b.getFullYear(),b.getMonth(),b.getDate())):a=new Date(b.setHours(0,0,0,0))}h.dateSelection(a)},h.close=function(){h.isOpen=!1,i[0].focus()};var u=a(q)(h);p?c.find("body").append(u):i.after(u),h.$on("$destroy",function(){u.remove(),i.unbind("keydown",t),c.unbind("click",s)})}}}]).directive("datepickerPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/datepicker/popup.html",link:function(a,b){b.bind("click",function(a){a.preventDefault(),a.stopPropagation()})}}}),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(a){var b=null;this.open=function(e){b||(a.bind("click",c),a.bind("keydown",d)),b&&b!==e&&(b.isOpen=!1),b=e},this.close=function(e){b===e&&(b=null,a.unbind("click",c),a.unbind("keydown",d))};var c=function(a){a&&a.isDefaultPrevented()||b.$apply(function(){b.isOpen=!1})},d=function(a){27===a.which&&(b.focusToggleElement(),c())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(a,b,c,d,e,f){var g,h=this,i=a.$new(),j=d.openClass,k=angular.noop,l=b.onToggle?c(b.onToggle):angular.noop;this.init=function(d){h.$element=d,b.isOpen&&(g=c(b.isOpen),k=g.assign,a.$watch(g,function(a){i.isOpen=!!a}))},this.toggle=function(a){return i.isOpen=arguments.length?!!a:!i.isOpen},this.isOpen=function(){return i.isOpen},i.focusToggleElement=function(){h.toggleElement&&h.toggleElement[0].focus()},i.$watch("isOpen",function(b,c){f[b?"addClass":"removeClass"](h.$element,j),b?(i.focusToggleElement(),e.open(i)):e.close(i),k(a,b),angular.isDefined(b)&&b!==c&&l(a,{open:!!b})}),a.$on("$locationChangeSuccess",function(){i.isOpen=!1}),a.$on("$destroy",function(){i.$destroy()})}]).directive("dropdown",function(){return{restrict:"CA",controller:"DropdownController",link:function(a,b,c,d){d.init(b)}}}).directive("dropdownToggle",function(){return{restrict:"CA",require:"?^dropdown",link:function(a,b,c,d){if(d){d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b==a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b==a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.splice(a.length-1,1)[0]},length:function(){return a.length}}}}}).directive("modalBackdrop",["$timeout",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(b){b.animate=!1,a(function(){b.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(a,b){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(a,b){return b.templateUrl||"template/modal/window.html"},link:function(c,d,e){d.addClass(e.windowClass||""),c.size=e.size,b(function(){c.animate=!0,d[0].focus()}),c.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!=c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))}}}}]).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(a,b,c,d,e,f){function g(){for(var a=-1,b=n.keys(),c=0;c<b.length;c++)n.get(b[c]).value.backdrop&&(a=c);return a}function h(a){var b=c.find("body").eq(0),d=n.get(a).value;n.remove(a),j(d.modalDomEl,d.modalScope,300,function(){d.modalScope.$destroy(),b.toggleClass(m,n.length()>0),i()})}function i(){if(k&&-1==g()){var a=l;j(k,l,150,function(){a.$destroy(),a=null}),k=void 0,l=void 0}}function j(c,d,e,f){function g(){g.done||(g.done=!0,c.remove(),f&&f())}d.animate=!1;var h=a.transitionEndEventName;if(h){var i=b(g,e);c.bind(h,function(){b.cancel(i),g(),d.$apply()})}else b(g,0)}var k,l,m="modal-open",n=f.createNew(),o={};return e.$watch(g,function(a){l&&(l.index=a)}),c.bind("keydown",function(a){var b;27===a.which&&(b=n.top(),b&&b.value.keyboard&&(a.preventDefault(),e.$apply(function(){o.dismiss(b.key,"escape key press")})))}),o.open=function(a,b){n.add(a,{deferred:b.deferred,modalScope:b.scope,backdrop:b.backdrop,keyboard:b.keyboard});var f=c.find("body").eq(0),h=g();h>=0&&!k&&(l=e.$new(!0),l.index=h,k=d("<div modal-backdrop></div>")(l),f.append(k));var i=angular.element("<div modal-window></div>");i.attr({"template-url":b.windowTemplateUrl,"window-class":b.windowClass,size:b.size,index:n.length()-1,animate:"animate"}).html(b.content);var j=d(i)(b.scope);n.top().value.modalDomEl=j,f.append(j),f.addClass(m)},o.close=function(a,b){var c=n.get(a).value;c&&(c.deferred.resolve(b),h(a))},o.dismiss=function(a,b){var c=n.get(a).value;c&&(c.deferred.reject(b),h(a))},o.dismissAll=function(a){for(var b=this.getTop();b;)this.dismiss(b.key,a),b=this.getTop()},o.getTop=function(){return n.top()},o}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,windowClass:b.windowClass,windowTemplateUrl:b.windowTemplateUrl,size:b.size})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}),angular.module("ui.bootstrap.pagination",[]).controller("PaginationController",["$scope","$attrs","$parse",function(a,b,c){var d=this,e={$setViewValue:angular.noop},f=b.numPages?c(b.numPages).assign:angular.noop;this.init=function(f,g){e=f,this.config=g,e.$render=function(){d.render()},b.itemsPerPage?a.$parent.$watch(c(b.itemsPerPage),function(b){d.itemsPerPage=parseInt(b,10),a.totalPages=d.calculateTotalPages()}):this.itemsPerPage=g.itemsPerPage},this.calculateTotalPages=function(){var b=this.itemsPerPage<1?1:Math.ceil(a.totalItems/this.itemsPerPage);return Math.max(b||0,1)},this.render=function(){a.page=parseInt(e.$viewValue,10)||1},a.selectPage=function(b){a.page!==b&&b>0&&b<=a.totalPages&&(e.$setViewValue(b),e.$render())},a.getText=function(b){return a[b+"Text"]||d.config[b+"Text"]},a.noPrevious=function(){return 1===a.page},a.noNext=function(){return a.page===a.totalPages},a.$watch("totalItems",function(){a.totalPages=d.calculateTotalPages()}),a.$watch("totalPages",function(b){f(a.$parent,b),a.page>b?a.selectPage(b):e.$render()})}]).constant("paginationConfig",{itemsPerPage:10,boundaryLinks:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0}).directive("pagination",["$parse","paginationConfig",function(a,b){return{restrict:"EA",scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@"},require:["pagination","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pagination.html",replace:!0,link:function(c,d,e,f){function g(a,b,c){return{number:a,text:b,active:c}}function h(a,b){var c=[],d=1,e=b,f=angular.isDefined(k)&&b>k;f&&(l?(d=Math.max(a-Math.floor(k/2),1),e=d+k-1,e>b&&(e=b,d=e-k+1)):(d=(Math.ceil(a/k)-1)*k+1,e=Math.min(d+k-1,b)));for(var h=d;e>=h;h++){var i=g(h,h,h===a);c.push(i)}if(f&&!l){if(d>1){var j=g(d-1,"...",!1);c.unshift(j)}if(b>e){var m=g(e+1,"...",!1);c.push(m)}}return c}var i=f[0],j=f[1];if(j){var k=angular.isDefined(e.maxSize)?c.$parent.$eval(e.maxSize):b.maxSize,l=angular.isDefined(e.rotate)?c.$parent.$eval(e.rotate):b.rotate;c.boundaryLinks=angular.isDefined(e.boundaryLinks)?c.$parent.$eval(e.boundaryLinks):b.boundaryLinks,c.directionLinks=angular.isDefined(e.directionLinks)?c.$parent.$eval(e.directionLinks):b.directionLinks,i.init(j,b),e.maxSize&&c.$parent.$watch(a(e.maxSize),function(a){k=parseInt(a,10),i.render()});var m=i.render;i.render=function(){m(),c.page>0&&c.page<=c.totalPages&&(c.pages=h(c.page,c.totalPages))}}}}}]).constant("pagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("pager",["pagerConfig",function(a){return{restrict:"EA",scope:{totalItems:"=",previousText:"@",nextText:"@"},require:["pager","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pager.html",replace:!0,link:function(b,c,d,e){var f=e[0],g=e[1];g&&(b.align=angular.isDefined(d.align)?b.$parent.$eval(d.align):a.align,f.init(g,a))}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).provider("$tooltip",function(){function a(a){var b=/[A-Z]/g,c="-";
+return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var b={placement:"top",animation:!0,popupDelay:0},c={mouseenter:"mouseleave",click:"click",focus:"blur"},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$parse","$document","$position","$interpolate",function(e,f,g,h,i,j,k){return function(e,l,m){function n(a){var b=a||o.trigger||m,d=c[b]||b;return{show:b,hide:d}}var o=angular.extend({},b,d),p=a(e),q=k.startSymbol(),r=k.endSymbol(),s="<div "+p+'-popup title="'+q+"tt_title"+r+'" content="'+q+"tt_content"+r+'" placement="'+q+"tt_placement"+r+'" animation="tt_animation" is-open="tt_isOpen"></div>';return{restrict:"EA",scope:!0,compile:function(){var a=f(s);return function(b,c,d){function f(){b.tt_isOpen?m():k()}function k(){(!y||b.$eval(d[l+"Enable"]))&&(b.tt_popupDelay?v||(v=g(p,b.tt_popupDelay,!1),v.then(function(a){a()})):p()())}function m(){b.$apply(function(){q()})}function p(){return v=null,u&&(g.cancel(u),u=null),b.tt_content?(r(),t.css({top:0,left:0,display:"block"}),w?i.find("body").append(t):c.after(t),z(),b.tt_isOpen=!0,b.$digest(),z):angular.noop}function q(){b.tt_isOpen=!1,g.cancel(v),v=null,b.tt_animation?u||(u=g(s,500)):s()}function r(){t&&s(),t=a(b,function(){}),b.$digest()}function s(){u=null,t&&(t.remove(),t=null)}var t,u,v,w=angular.isDefined(o.appendToBody)?o.appendToBody:!1,x=n(void 0),y=angular.isDefined(d[l+"Enable"]),z=function(){var a=j.positionElements(c,t,b.tt_placement,w);a.top+="px",a.left+="px",t.css(a)};b.tt_isOpen=!1,d.$observe(e,function(a){b.tt_content=a,!a&&b.tt_isOpen&&q()}),d.$observe(l+"Title",function(a){b.tt_title=a}),d.$observe(l+"Placement",function(a){b.tt_placement=angular.isDefined(a)?a:o.placement}),d.$observe(l+"PopupDelay",function(a){var c=parseInt(a,10);b.tt_popupDelay=isNaN(c)?o.popupDelay:c});var A=function(){c.unbind(x.show,k),c.unbind(x.hide,m)};d.$observe(l+"Trigger",function(a){A(),x=n(a),x.show===x.hide?c.bind(x.show,f):(c.bind(x.show,k),c.bind(x.hide,m))});var B=b.$eval(d[l+"Animation"]);b.tt_animation=angular.isDefined(B)?!!B:o.animation,d.$observe(l+"AppendToBody",function(a){w=angular.isDefined(a)?h(a)(b):w}),w&&b.$on("$locationChangeSuccess",function(){b.tt_isOpen&&q()}),b.$on("$destroy",function(){g.cancel(u),g.cancel(v),A(),s()})}}}}}]}).directive("tooltipPopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function(a){return a("tooltip","tooltip","mouseenter")}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).directive("tooltipHtmlUnsafe",["$tooltip",function(a){return a("tooltipHtmlUnsafe","tooltip","mouseenter")}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverPopup",function(){return{restrict:"EA",replace:!0,scope:{title:"@",content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html"}}).directive("popover",["$tooltip",function(a){return a("popover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:!0,max:100}).controller("ProgressController",["$scope","$attrs","progressConfig",function(a,b,c){var d=this,e=angular.isDefined(b.animate)?a.$parent.$eval(b.animate):c.animate;this.bars=[],a.max=angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max,this.addBar=function(b,c){e||c.css({transition:"none"}),this.bars.push(b),b.$watch("value",function(c){b.percent=+(100*c/a.max).toFixed(2)}),b.$on("$destroy",function(){c=null,d.removeBar(b)})},this.removeBar=function(a){this.bars.splice(this.bars.indexOf(a),1)}}]).directive("progress",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",require:"progress",scope:{},templateUrl:"template/progressbar/progress.html"}}).directive("bar",function(){return{restrict:"EA",replace:!0,transclude:!0,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(a,b,c,d){d.addBar(a,b)}}}).directive("progressbar",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(a,b,c,d){d.addBar(a,angular.element(b.children()[0]))}}}),angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null}).controller("RatingController",["$scope","$attrs","ratingConfig",function(a,b,c){var d={$setViewValue:angular.noop};this.init=function(e){d=e,d.$render=this.render,this.stateOn=angular.isDefined(b.stateOn)?a.$parent.$eval(b.stateOn):c.stateOn,this.stateOff=angular.isDefined(b.stateOff)?a.$parent.$eval(b.stateOff):c.stateOff;var f=angular.isDefined(b.ratingStates)?a.$parent.$eval(b.ratingStates):new Array(angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max);a.range=this.buildTemplateObjects(f)},this.buildTemplateObjects=function(a){for(var b=0,c=a.length;c>b;b++)a[b]=angular.extend({index:b},{stateOn:this.stateOn,stateOff:this.stateOff},a[b]);return a},a.rate=function(b){!a.readonly&&b>=0&&b<=a.range.length&&(d.$setViewValue(b),d.$render())},a.enter=function(b){a.readonly||(a.value=b),a.onHover({value:b})},a.reset=function(){a.value=d.$viewValue,a.onLeave()},a.onKeydown=function(b){/(37|38|39|40)/.test(b.which)&&(b.preventDefault(),b.stopPropagation(),a.rate(a.value+(38===b.which||39===b.which?1:-1)))},this.render=function(){a.value=d.$viewValue}}]).directive("rating",function(){return{restrict:"EA",require:["rating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"RatingController",templateUrl:"template/rating/rating.html",replace:!0,link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f)}}}),angular.module("ui.bootstrap.tabs",[]).controller("TabsetController",["$scope",function(a){var b=this,c=b.tabs=a.tabs=[];b.select=function(a){angular.forEach(c,function(b){b.active&&b!==a&&(b.active=!1,b.onDeselect())}),a.active=!0,a.onSelect()},b.addTab=function(a){c.push(a),1===c.length?a.active=!0:a.active&&b.select(a)},b.removeTab=function(a){var d=c.indexOf(a);if(a.active&&c.length>1){var e=d==c.length-1?d-1:d+1;b.select(c[e])}c.splice(d,1)}}]).directive("tabset",function(){return{restrict:"EA",transclude:!0,replace:!0,scope:{type:"@"},controller:"TabsetController",templateUrl:"template/tabs/tabset.html",link:function(a,b,c){a.vertical=angular.isDefined(c.vertical)?a.$parent.$eval(c.vertical):!1,a.justified=angular.isDefined(c.justified)?a.$parent.$eval(c.justified):!1}}}).directive("tab",["$parse",function(a){return{require:"^tabset",restrict:"EA",replace:!0,templateUrl:"template/tabs/tab.html",transclude:!0,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},compile:function(b,c,d){return function(b,c,e,f){b.$watch("active",function(a){a&&f.select(b)}),b.disabled=!1,e.disabled&&b.$parent.$watch(a(e.disabled),function(a){b.disabled=!!a}),b.select=function(){b.disabled||(b.active=!0)},f.addTab(b),b.$on("$destroy",function(){f.removeTab(b)}),b.$transcludeFn=d}}}}]).directive("tabHeadingTransclude",[function(){return{restrict:"A",require:"^tab",link:function(a,b){a.$watch("headingElement",function(a){a&&(b.html(""),b.append(a))})}}}]).directive("tabContentTransclude",function(){function a(a){return a.tagName&&(a.hasAttribute("tab-heading")||a.hasAttribute("data-tab-heading")||"tab-heading"===a.tagName.toLowerCase()||"data-tab-heading"===a.tagName.toLowerCase())}return{restrict:"A",require:"^tabset",link:function(b,c,d){var e=b.$eval(d.tabContentTransclude);e.$transcludeFn(e.$parent,function(b){angular.forEach(b,function(b){a(b)?e.headingElement=b:c.append(b)})})}}}),angular.module("ui.bootstrap.timepicker",[]).constant("timepickerConfig",{hourStep:1,minuteStep:1,showMeridian:!0,meridians:null,readonlyInput:!1,mousewheel:!0}).controller("TimepickerController",["$scope","$attrs","$parse","$log","$locale","timepickerConfig",function(a,b,c,d,e,f){function g(){var b=parseInt(a.hours,10),c=a.showMeridian?b>0&&13>b:b>=0&&24>b;return c?(a.showMeridian&&(12===b&&(b=0),a.meridian===p[1]&&(b+=12)),b):void 0}function h(){var b=parseInt(a.minutes,10);return b>=0&&60>b?b:void 0}function i(a){return angular.isDefined(a)&&a.toString().length<2?"0"+a:a}function j(a){k(),o.$setViewValue(new Date(n)),l(a)}function k(){o.$setValidity("time",!0),a.invalidHours=!1,a.invalidMinutes=!1}function l(b){var c=n.getHours(),d=n.getMinutes();a.showMeridian&&(c=0===c||12===c?12:c%12),a.hours="h"===b?c:i(c),a.minutes="m"===b?d:i(d),a.meridian=n.getHours()<12?p[0]:p[1]}function m(a){var b=new Date(n.getTime()+6e4*a);n.setHours(b.getHours(),b.getMinutes()),j()}var n=new Date,o={$setViewValue:angular.noop},p=angular.isDefined(b.meridians)?a.$parent.$eval(b.meridians):f.meridians||e.DATETIME_FORMATS.AMPMS;this.init=function(c,d){o=c,o.$render=this.render;var e=d.eq(0),g=d.eq(1),h=angular.isDefined(b.mousewheel)?a.$parent.$eval(b.mousewheel):f.mousewheel;h&&this.setupMousewheelEvents(e,g),a.readonlyInput=angular.isDefined(b.readonlyInput)?a.$parent.$eval(b.readonlyInput):f.readonlyInput,this.setupInputEvents(e,g)};var q=f.hourStep;b.hourStep&&a.$parent.$watch(c(b.hourStep),function(a){q=parseInt(a,10)});var r=f.minuteStep;b.minuteStep&&a.$parent.$watch(c(b.minuteStep),function(a){r=parseInt(a,10)}),a.showMeridian=f.showMeridian,b.showMeridian&&a.$parent.$watch(c(b.showMeridian),function(b){if(a.showMeridian=!!b,o.$error.time){var c=g(),d=h();angular.isDefined(c)&&angular.isDefined(d)&&(n.setHours(c),j())}else l()}),this.setupMousewheelEvents=function(b,c){var d=function(a){a.originalEvent&&(a=a.originalEvent);var b=a.wheelDelta?a.wheelDelta:-a.deltaY;return a.detail||b>0};b.bind("mousewheel wheel",function(b){a.$apply(d(b)?a.incrementHours():a.decrementHours()),b.preventDefault()}),c.bind("mousewheel wheel",function(b){a.$apply(d(b)?a.incrementMinutes():a.decrementMinutes()),b.preventDefault()})},this.setupInputEvents=function(b,c){if(a.readonlyInput)return a.updateHours=angular.noop,void(a.updateMinutes=angular.noop);var d=function(b,c){o.$setViewValue(null),o.$setValidity("time",!1),angular.isDefined(b)&&(a.invalidHours=b),angular.isDefined(c)&&(a.invalidMinutes=c)};a.updateHours=function(){var a=g();angular.isDefined(a)?(n.setHours(a),j("h")):d(!0)},b.bind("blur",function(){!a.invalidHours&&a.hours<10&&a.$apply(function(){a.hours=i(a.hours)})}),a.updateMinutes=function(){var a=h();angular.isDefined(a)?(n.setMinutes(a),j("m")):d(void 0,!0)},c.bind("blur",function(){!a.invalidMinutes&&a.minutes<10&&a.$apply(function(){a.minutes=i(a.minutes)})})},this.render=function(){var a=o.$modelValue?new Date(o.$modelValue):null;isNaN(a)?(o.$setValidity("time",!1),d.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')):(a&&(n=a),k(),l())},a.incrementHours=function(){m(60*q)},a.decrementHours=function(){m(60*-q)},a.incrementMinutes=function(){m(r)},a.decrementMinutes=function(){m(-r)},a.toggleMeridian=function(){m(720*(n.getHours()<12?1:-1))}}]).directive("timepicker",function(){return{restrict:"EA",require:["timepicker","?^ngModel"],controller:"TimepickerController",replace:!0,scope:{},templateUrl:"template/timepicker/timepicker.html",link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f,b.find("input"))}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(a){var b=/^\s*(.*?)(?:\s+as\s+(.*?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+(.*)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(a,b,c,d,e,f,g){var h=[9,13,27,38,40];return{require:"ngModel",link:function(i,j,k,l){var m,n=i.$eval(k.typeaheadMinLength)||1,o=i.$eval(k.typeaheadWaitMs)||0,p=i.$eval(k.typeaheadEditable)!==!1,q=b(k.typeaheadLoading).assign||angular.noop,r=b(k.typeaheadOnSelect),s=k.typeaheadInputFormatter?b(k.typeaheadInputFormatter):void 0,t=k.typeaheadAppendToBody?i.$eval(k.typeaheadAppendToBody):!1,u=b(k.ngModel).assign,v=g.parse(k.typeahead),w=i.$new();i.$on("$destroy",function(){w.$destroy()});var x="typeahead-"+w.$id+"-"+Math.floor(1e4*Math.random());j.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":x});var y=angular.element("<div typeahead-popup></div>");y.attr({id:x,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(k.typeaheadTemplateUrl)&&y.attr("template-url",k.typeaheadTemplateUrl);var z=function(){w.matches=[],w.activeIdx=-1,j.attr("aria-expanded",!1)},A=function(a){return x+"-option-"+a};w.$watch("activeIdx",function(a){0>a?j.removeAttr("aria-activedescendant"):j.attr("aria-activedescendant",A(a))});var B=function(a){var b={$viewValue:a};q(i,!0),c.when(v.source(i,b)).then(function(c){var d=a===l.$viewValue;if(d&&m)if(c.length>0){w.activeIdx=0,w.matches.length=0;for(var e=0;e<c.length;e++)b[v.itemName]=c[e],w.matches.push({id:A(e),label:v.viewMapper(w,b),model:c[e]});w.query=a,w.position=t?f.offset(j):f.position(j),w.position.top=w.position.top+j.prop("offsetHeight"),j.attr("aria-expanded",!0)}else z();d&&q(i,!1)},function(){z(),q(i,!1)})};z(),w.query=void 0;var C;l.$parsers.unshift(function(a){return m=!0,a&&a.length>=n?o>0?(C&&d.cancel(C),C=d(function(){B(a)},o)):B(a):(q(i,!1),z()),p?a:a?void l.$setValidity("editable",!1):(l.$setValidity("editable",!0),a)}),l.$formatters.push(function(a){var b,c,d={};return s?(d.$model=a,s(i,d)):(d[v.itemName]=a,b=v.viewMapper(i,d),d[v.itemName]=void 0,c=v.viewMapper(i,d),b!==c?b:a)}),w.select=function(a){var b,c,e={};e[v.itemName]=c=w.matches[a].model,b=v.modelMapper(i,e),u(i,b),l.$setValidity("editable",!0),r(i,{$item:c,$model:b,$label:v.viewMapper(i,e)}),z(),d(function(){j[0].focus()},0,!1)},j.bind("keydown",function(a){0!==w.matches.length&&-1!==h.indexOf(a.which)&&(a.preventDefault(),40===a.which?(w.activeIdx=(w.activeIdx+1)%w.matches.length,w.$digest()):38===a.which?(w.activeIdx=(w.activeIdx?w.activeIdx:w.matches.length)-1,w.$digest()):13===a.which||9===a.which?w.$apply(function(){w.select(w.activeIdx)}):27===a.which&&(a.stopPropagation(),z(),w.$digest()))}),j.bind("blur",function(){m=!1});var D=function(a){j[0]!==a.target&&(z(),w.$digest())};e.bind("click",D),i.$on("$destroy",function(){e.unbind("click",D)});var E=a(y)(w);t?e.find("body").append(E):j.after(E)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(a,b,c){a.templateUrl=c.templateUrl,a.isOpen=function(){return a.matches.length>0},a.isActive=function(b){return a.active==b},a.selectActive=function(b){a.active=b},a.selectMatch=function(b){a.select({activeIdx:b})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(a,b,c,d){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(e,f,g){var h=d(g.templateUrl)(e.$parent)||"template/typeahead/typeahead-match.html";a.get(h,{cache:b}).success(function(a){f.replaceWith(c(a.trim())(e))})}}}]).filter("typeaheadHighlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c?(""+b).replace(new RegExp(a(c),"gi"),"<strong>$&</strong>"):b}}),angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function(a){a.put("template/accordion/accordion-group.html",'<div class="panel panel-default">\n  <div class="panel-heading">\n    <h4 class="panel-title">\n      <a class="accordion-toggle" ng-click="toggleOpen()" accordion-transclude="heading"><span ng-class="{\'text-muted\': isDisabled}">{{heading}}</span></a>\n    </h4>\n  </div>\n  <div class="panel-collapse" collapse="!isOpen">\n	  <div class="panel-body" ng-transclude></div>\n  </div>\n</div>')}]),angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function(a){a.put("template/accordion/accordion.html",'<div class="panel-group" ng-transclude></div>')}]),angular.module("template/alert/alert.html",[]).run(["$templateCache",function(a){a.put("template/alert/alert.html",'<div class="alert" ng-class="{\'alert-{{type || \'warning\'}}\': true, \'alert-dismissable\': closeable}" role="alert">\n    <button ng-show="closeable" type="button" class="close" ng-click="close()">\n        <span aria-hidden="true">&times;</span>\n        <span class="sr-only">Close</span>\n    </button>\n    <div ng-transclude></div>\n</div>\n')}]),angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function(a){a.put("template/carousel/carousel.html",'<div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel" ng-swipe-right="prev()" ng-swipe-left="next()">\n    <ol class="carousel-indicators" ng-show="slides.length > 1">\n        <li ng-repeat="slide in slides track by $index" ng-class="{active: isActive(slide)}" ng-click="select(slide)"></li>\n    </ol>\n    <div class="carousel-inner" ng-transclude></div>\n    <a class="left carousel-control" ng-click="prev()" ng-show="slides.length > 1"><span class="glyphicon glyphicon-chevron-left"></span></a>\n    <a class="right carousel-control" ng-click="next()" ng-show="slides.length > 1"><span class="glyphicon glyphicon-chevron-right"></span></a>\n</div>\n')}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(a){a.put("template/carousel/slide.html","<div ng-class=\"{\n    'active': leaving || (active && !entering),\n    'prev': (next || active) && direction=='prev',\n    'next': (next || active) && direction=='next',\n    'right': direction=='prev',\n    'left': direction=='next'\n  }\" class=\"item text-center\" ng-transclude></div>\n")}]),angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/datepicker.html",'<div ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">\n  <daypicker ng-switch-when="day" tabindex="0"></daypicker>\n  <monthpicker ng-switch-when="month" tabindex="0"></monthpicker>\n  <yearpicker ng-switch-when="year" tabindex="0"></yearpicker>\n</div>')}]),angular.module("template/datepicker/day.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/day.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th colspan="{{5 + showWeeks}}"><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n    <tr>\n      <th ng-show="showWeeks" class="text-center"></th>\n      <th ng-repeat="label in labels track by $index" class="text-center"><small aria-label="{{label.full}}">{{label.abbr}}</small></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-show="showWeeks" class="text-center h6"><em>{{ weekNumbers[$index] }}</em></td>\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default btn-sm" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-muted\': dt.secondary, \'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/datepicker/month.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/month.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/popup.html",'<ul class="dropdown-menu" ng-style="{display: (isOpen && \'block\') || \'none\', top: position.top+\'px\', left: position.left+\'px\'}" ng-keydown="keydown($event)">\n	<li ng-transclude></li>\n	<li ng-if="showButtonBar" style="padding:10px 9px 2px">\n		<span class="btn-group">\n			<button type="button" class="btn btn-sm btn-info" ng-click="select(\'today\')">{{ getText(\'current\') }}</button>\n			<button type="button" class="btn btn-sm btn-danger" ng-click="select(null)">{{ getText(\'clear\') }}</button>\n		</span>\n		<button type="button" class="btn btn-sm btn-success pull-right" ng-click="close()">{{ getText(\'close\') }}</button>\n	</li>\n</ul>\n')}]),angular.module("template/datepicker/year.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/year.html",'<table role="grid" aria-labelledby="{{uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left" ng-click="move(-1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-left"></i></button></th>\n      <th colspan="3"><button id="{{uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm" ng-click="toggleMode()" tabindex="-1" style="width:100%;"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr ng-repeat="row in rows track by $index">\n      <td ng-repeat="dt in row track by dt.date" class="text-center" role="gridcell" id="{{dt.uid}}" aria-disabled="{{!!dt.disabled}}">\n        <button type="button" style="width:100%;" class="btn btn-default" ng-class="{\'btn-info\': dt.selected, active: isActive(dt)}" ng-click="select(dt.date)" ng-disabled="dt.disabled" tabindex="-1"><span ng-class="{\'text-info\': dt.current}">{{dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("template/modal/backdrop.html",'<div class="modal-backdrop fade"\n     ng-class="{in: animate}"\n     ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n></div>\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(a){a.put("template/modal/window.html",'<div tabindex="-1" role="dialog" class="modal fade" ng-class="{in: animate}" ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}" ng-click="close($event)">\n    <div class="modal-dialog" ng-class="{\'modal-sm\': size == \'sm\', \'modal-lg\': size == \'lg\'}"><div class="modal-content" ng-transclude></div></div>\n</div>')}]),angular.module("template/pagination/pager.html",[]).run(["$templateCache",function(a){a.put("template/pagination/pager.html",'<ul class="pager">\n  <li ng-class="{disabled: noPrevious(), previous: align}"><a href ng-click="selectPage(page - 1)">{{getText(\'previous\')}}</a></li>\n  <li ng-class="{disabled: noNext(), next: align}"><a href ng-click="selectPage(page + 1)">{{getText(\'next\')}}</a></li>\n</ul>')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("template/pagination/pagination.html",'<ul class="pagination">\n  <li ng-if="boundaryLinks" ng-class="{disabled: noPrevious()}"><a href ng-click="selectPage(1)">{{getText(\'first\')}}</a></li>\n  <li ng-if="directionLinks" ng-class="{disabled: noPrevious()}"><a href ng-click="selectPage(page - 1)">{{getText(\'previous\')}}</a></li>\n  <li ng-repeat="page in pages track by $index" ng-class="{active: page.active}"><a href ng-click="selectPage(page.number)">{{page.text}}</a></li>\n  <li ng-if="directionLinks" ng-class="{disabled: noNext()}"><a href ng-click="selectPage(page + 1)">{{getText(\'next\')}}</a></li>\n  <li ng-if="boundaryLinks" ng-class="{disabled: noNext()}"><a href ng-click="selectPage(totalPages)">{{getText(\'last\')}}</a></li>\n</ul>')}]),angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-html-unsafe-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n  <div class="tooltip-arrow"></div>\n  <div class="tooltip-inner" bind-html-unsafe="content"></div>\n</div>\n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n  <div class="tooltip-arrow"></div>\n  <div class="tooltip-inner" ng-bind="content"></div>\n</div>\n')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(a){a.put("template/popover/popover.html",'<div class="popover {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n  <div class="arrow"></div>\n\n  <div class="popover-inner">\n      <h3 class="popover-title" ng-bind="title" ng-show="title"></h3>\n      <div class="popover-content" ng-bind="content"></div>\n  </div>\n</div>\n')}]),angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/bar.html",'<div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: percent + \'%\'}" aria-valuetext="{{percent | number:0}}%" ng-transclude></div>')}]),angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/progress.html",'<div class="progress" ng-transclude></div>')}]),angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/progressbar.html",'<div class="progress">\n  <div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: percent + \'%\'}" aria-valuetext="{{percent | number:0}}%" ng-transclude></div>\n</div>')}]),angular.module("template/rating/rating.html",[]).run(["$templateCache",function(a){a.put("template/rating/rating.html",'<span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}">\n    <i ng-repeat="r in range track by $index" ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" class="glyphicon" ng-class="$index < value && (r.stateOn || \'glyphicon-star\') || (r.stateOff || \'glyphicon-star-empty\')">\n        <span class="sr-only">({{ $index < value ? \'*\' : \' \' }})</span>\n    </i>\n</span>')}]),angular.module("template/tabs/tab.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tab.html",'<li ng-class="{active: active, disabled: disabled}">\n  <a ng-click="select()" tab-heading-transclude>{{heading}}</a>\n</li>\n')}]),angular.module("template/tabs/tabset-titles.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tabset-titles.html","<ul class=\"nav {{type && 'nav-' + type}}\" ng-class=\"{'nav-stacked': vertical}\">\n</ul>\n")}]),angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tabset.html",'\n<div>\n  <ul class="nav nav-{{type || \'tabs\'}}" ng-class="{\'nav-stacked\': vertical, \'nav-justified\': justified}" ng-transclude></ul>\n  <div class="tab-content">\n    <div class="tab-pane" \n         ng-repeat="tab in tabs" \n         ng-class="{active: tab.active}"\n         tab-content-transclude="tab">\n    </div>\n  </div>\n</div>\n')}]),angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function(a){a.put("template/timepicker/timepicker.html",'<table>\n	<tbody>\n		<tr class="text-center">\n			<td><a ng-click="incrementHours()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n			<td>&nbsp;</td>\n			<td><a ng-click="incrementMinutes()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n			<td ng-show="showMeridian"></td>\n		</tr>\n		<tr>\n			<td style="width:50px;" class="form-group" ng-class="{\'has-error\': invalidHours}">\n				<input type="text" ng-model="hours" ng-change="updateHours()" class="form-control text-center" ng-mousewheel="incrementHours()" ng-readonly="readonlyInput" maxlength="2">\n			</td>\n			<td>:</td>\n			<td style="width:50px;" class="form-group" ng-class="{\'has-error\': invalidMinutes}">\n				<input type="text" ng-model="minutes" ng-change="updateMinutes()" class="form-control text-center" ng-readonly="readonlyInput" maxlength="2">\n			</td>\n			<td ng-show="showMeridian"><button type="button" class="btn btn-default text-center" ng-click="toggleMeridian()">{{meridian}}</button></td>\n		</tr>\n		<tr class="text-center">\n			<td><a ng-click="decrementHours()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n			<td>&nbsp;</td>\n			<td><a ng-click="decrementMinutes()" class="btn btn-link"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n			<td ng-show="showMeridian"></td>\n		</tr>\n	</tbody>\n</table>\n')}]),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-match.html",'<a tabindex="-1" bind-html-unsafe="match.label | typeaheadHighlight:query"></a>')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-if="isOpen()" ng-style="{top: position.top+\'px\', left: position.left+\'px\'}" style="display: block;" role="listbox" aria-hidden="{{!isOpen()}}">\n    <li ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index)" role="option" id="{{match.id}}">\n        <div typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n    </li>\n</ul>')
+}]);
\ No newline at end of file
diff --git a/setup/pub/angular-ui-router/angular-ui-router.min.js b/setup/pub/angular-ui-router/angular-ui-router.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..f065ecc960684a0089ad5d53313a801747f553af
--- /dev/null
+++ b/setup/pub/angular-ui-router/angular-ui-router.min.js
@@ -0,0 +1,7 @@
+/**
+ * State-based routing for AngularJS
+ * @version v0.2.10
+ * @link http://angular-ui.github.com/
+ * @license MIT License, http://www.opensource.org/licenses/MIT
+ */
+"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return I(new(I(function(){},{prototype:a})),b)}function e(a){return H(arguments,function(b){b!==a&&H(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function h(a,b,c,d){var e,h=f(c,d),i={},j=[];for(var k in h)if(h[k].params&&h[k].params.length){e=h[k].params;for(var l in e)g(j,e[l])>=0||(j.push(e[l]),i[e[l]]=a[e[l]])}return I({},i,b)}function i(a,b){var c={};return H(a,function(a){var d=b[a];c[a]=null!=d?String(d):null}),c}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e<c.length;e++){var f=c[e];if(a[f]!=b[f])return!1}return!0}function k(a,b){var c={};return H(a,function(a){c[a]=b[a]}),c}function l(a,b){var d=1,f=2,g={},h=[],i=g,j=I(a.when(g),{$$promises:g,$$values:g});this.study=function(g){function k(a,c){if(o[c]!==f){if(n.push(c),o[c]===d)throw n.splice(0,n.indexOf(c)),new Error("Cyclic dependency: "+n.join(" -> "));if(o[c]=d,E(a))m.push(c,[function(){return b.get(a)}],h);else{var e=b.annotate(a);H(e,function(a){a!==c&&g.hasOwnProperty(a)&&k(g[a],a)}),m.push(c,a,e)}n.pop(),o[c]=f}}function l(a){return F(a)&&a.then&&a.$$promises}if(!F(g))throw new Error("'invocables' must be an object");var m=[],n=[],o={};return H(g,k),g=n=o=null,function(d,f,g){function h(){--s||(t||e(r,f.$$values),p.$$values=r,p.$$promises=!0,o.resolve(r))}function k(a){p.$$failure=a,o.reject(a)}function n(c,e,f){function i(a){l.reject(a),k(a)}function j(){if(!C(p.$$failure))try{l.resolve(b.invoke(e,g,r)),l.promise.then(function(a){r[c]=a,h()},i)}catch(a){i(a)}}var l=a.defer(),m=0;H(f,function(a){q.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,q[a].then(function(b){r[a]=b,--m||j()},i))}),m||j(),q[c]=l.promise}if(l(d)&&g===c&&(g=f,f=d,d=null),d){if(!F(d))throw new Error("'locals' must be an object")}else d=i;if(f){if(!l(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=j;var o=a.defer(),p=o.promise,q=p.$$promises={},r=I({},d),s=1+m.length/3,t=!1;if(C(f.$$failure))return k(f.$$failure),p;f.$$values?(t=e(r,f.$$values),h()):(I(q,f.$$promises),f.then(h,k));for(var u=0,v=m.length;v>u;u+=3)d.hasOwnProperty(m[u])?h():n(m[u],m[u+1],m[u+2]);return p}},this.resolve=function(a,b,c,d){return this.study(a)(b,c,d)}}function m(a,b,c){this.fromConfig=function(a,b,c){return C(a.template)?this.fromString(a.template,b):C(a.templateUrl)?this.fromUrl(a.templateUrl,b):C(a.templateProvider)?this.fromProvider(a.templateProvider,b,c):null},this.fromString=function(a,b){return D(a)?a(b):a},this.fromUrl=function(c,d){return D(c)&&(c=c(d)),null==c?null:a.get(c,{cache:b}).then(function(a){return a.data})},this.fromProvider=function(a,b,d){return c.invoke(a,null,d||{params:b})}}function n(a){function b(b){if(!/^\w+(-+\w+)*$/.test(b))throw new Error("Invalid parameter name '"+b+"' in pattern '"+a+"'");if(f[b])throw new Error("Duplicate parameter name '"+b+"' in pattern '"+a+"'");f[b]=!0,j.push(b)}function c(a){return a.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&")}var d,e=/([:*])(\w+)|\{(\w+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,f={},g="^",h=0,i=this.segments=[],j=this.params=[];this.source=a;for(var k,l,m;(d=e.exec(a))&&(k=d[2]||d[3],l=d[4]||("*"==d[1]?".*":"[^/]*"),m=a.substring(h,d.index),!(m.indexOf("?")>=0));)g+=c(m)+"("+l+")",b(k),i.push(m),h=e.lastIndex;m=a.substring(h);var n=m.indexOf("?");if(n>=0){var o=this.sourceSearch=m.substring(n);m=m.substring(0,n),this.sourcePath=a.substring(0,h+n),H(o.substring(1).split(/[&?]/),b)}else this.sourcePath=a,this.sourceSearch="";g+=c(m)+"$",i.push(m),this.regexp=new RegExp(g),this.prefix=i[0]}function o(){this.compile=function(a){return new n(a)},this.isMatcher=function(a){return F(a)&&D(a.exec)&&D(a.format)&&D(a.concat)},this.$get=function(){return this}}function p(a){function b(a){var b=/^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(a.source);return null!=b?b[1].replace(/\\(.)/g,"$1"):""}function c(a,b){return a.replace(/\$(\$|\d{1,2})/,function(a,c){return b["$"===c?0:Number(c)]})}function d(a,b,c){if(!c)return!1;var d=a.invoke(b,b,{$match:c});return C(d)?d:!0}var e=[],f=null;this.rule=function(a){if(!D(a))throw new Error("'rule' must be a function");return e.push(a),this},this.otherwise=function(a){if(E(a)){var b=a;a=function(){return b}}else if(!D(a))throw new Error("'rule' must be a function");return f=a,this},this.when=function(e,f){var g,h=E(f);if(E(e)&&(e=a.compile(e)),!h&&!D(f)&&!G(f))throw new Error("invalid 'handler' in when()");var i={matcher:function(b,c){return h&&(g=a.compile(c),c=["$match",function(a){return g.format(a)}]),I(function(a,e){return d(a,c,b.exec(e.path(),e.search()))},{prefix:E(b.prefix)?b.prefix:""})},regex:function(a,e){if(a.global||a.sticky)throw new Error("when() RegExp must not be global or sticky");return h&&(g=e,e=["$match",function(a){return c(g,a)}]),I(function(b,c){return d(b,e,a.exec(c.path()))},{prefix:b(a)})}},j={matcher:a.isMatcher(e),regex:e instanceof RegExp};for(var k in j)if(j[k])return this.rule(i[k](e,f));throw new Error("invalid 'what' in when()")},this.$get=["$location","$rootScope","$injector",function(a,b,c){function d(b){function d(b){var d=b(c,a);return d?(E(d)&&a.replace().url(d),!0):!1}if(!b||!b.defaultPrevented){var g,h=e.length;for(g=0;h>g;g++)if(d(e[g]))return;f&&d(f)}}return b.$on("$locationChangeSuccess",d),{sync:function(){d()}}}]}function q(a,e,f){function g(a){return 0===a.indexOf(".")||0===a.indexOf("^")}function l(a,b){var d=E(a),e=d?a:a.name,f=g(e);if(f){if(!b)throw new Error("No reference point given for path '"+e+"'");for(var h=e.split("."),i=0,j=h.length,k=b;j>i;i++)if(""!==h[i]||0!==i){if("^"!==h[i])break;if(!k.parent)throw new Error("Path '"+e+"' not valid for state '"+b.name+"'");k=k.parent}else k=b;h=h.slice(i).join("."),e=k.name+(k.name&&h?".":"")+h}var l=w[e];return!l||!d&&(d||l!==a&&l.self!==a)?c:l}function m(a,b){x[a]||(x[a]=[]),x[a].push(b)}function n(b){b=d(b,{self:b,resolve:b.resolve||{},toString:function(){return this.name}});var c=b.name;if(!E(c)||c.indexOf("@")>=0)throw new Error("State must have a valid name");if(w.hasOwnProperty(c))throw new Error("State '"+c+"'' is already defined");var e=-1!==c.indexOf(".")?c.substring(0,c.lastIndexOf(".")):E(b.parent)?b.parent:"";if(e&&!w[e])return m(e,b.self);for(var f in z)D(z[f])&&(b[f]=z[f](b,z.$delegates[f]));if(w[c]=b,!b[y]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){v.$current.navigable==b&&j(a,c)||v.transitionTo(b,a,{location:!1})}]),x[c])for(var g=0;g<x[c].length;g++)n(x[c][g]);return b}function o(a){return a.indexOf("*")>-1}function p(a){var b=a.split("."),c=v.$current.name.split(".");if("**"===b[0]&&(c=c.slice(c.indexOf(b[1])),c.unshift("**")),"**"===b[b.length-1]&&(c.splice(c.indexOf(b[b.length-2])+1,Number.MAX_VALUE),c.push("**")),b.length!=c.length)return!1;for(var d=0,e=b.length;e>d;d++)"*"===b[d]&&(c[d]="*");return c.join("")===b.join("")}function q(a,b){return E(a)&&!C(b)?z[a]:D(b)&&E(a)?(z[a]&&!z.$delegates[a]&&(z.$delegates[a]=z[a]),z[a]=b,this):this}function r(a,b){return F(a)?b=a:b.name=a,n(b),this}function s(a,e,g,m,n,q,r,s,x){function z(){r.url()!==M&&(r.url(M),r.replace())}function A(a,c,d,f,h){var i=d?c:k(a.params,c),j={$stateParams:i};h.resolve=n.resolve(a.resolve,j,h.resolve,a);var l=[h.resolve.then(function(a){h.globals=a})];return f&&l.push(f),H(a.views,function(c,d){var e=c.resolve&&c.resolve!==a.resolve?c.resolve:{};e.$template=[function(){return g.load(d,{view:c,locals:j,params:i,notify:!1})||""}],l.push(n.resolve(e,j,h.resolve,a).then(function(f){if(D(c.controllerProvider)||G(c.controllerProvider)){var g=b.extend({},e,j);f.$$controller=m.invoke(c.controllerProvider,null,g)}else f.$$controller=c.controller;f.$$state=a,f.$$controllerAs=c.controllerAs,h[d]=f}))}),e.all(l).then(function(){return h})}var B=e.reject(new Error("transition superseded")),F=e.reject(new Error("transition prevented")),K=e.reject(new Error("transition aborted")),L=e.reject(new Error("transition failed")),M=r.url(),N=x.baseHref();return u.locals={resolve:null,globals:{$stateParams:{}}},v={params:{},current:u.self,$current:u,transition:null},v.reload=function(){v.transitionTo(v.current,q,{reload:!0,inherit:!1,notify:!1})},v.go=function(a,b,c){return this.transitionTo(a,b,I({inherit:!0,relative:v.$current},c))},v.transitionTo=function(b,c,f){c=c||{},f=I({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},f||{});var g,k=v.$current,n=v.params,o=k.path,p=l(b,f.relative);if(!C(p)){var s={to:b,toParams:c,options:f};if(g=a.$broadcast("$stateNotFound",s,k.self,n),g.defaultPrevented)return z(),K;if(g.retry){if(f.$retry)return z(),L;var w=v.transition=e.when(g.retry);return w.then(function(){return w!==v.transition?B:(s.options.$retry=!0,v.transitionTo(s.to,s.toParams,s.options))},function(){return K}),z(),w}if(b=s.to,c=s.toParams,f=s.options,p=l(b,f.relative),!C(p)){if(f.relative)throw new Error("Could not resolve '"+b+"' from state '"+f.relative+"'");throw new Error("No such state '"+b+"'")}}if(p[y])throw new Error("Cannot transition to abstract state '"+b+"'");f.inherit&&(c=h(q,c||{},v.$current,p)),b=p;var x,D,E=b.path,G=u.locals,H=[];for(x=0,D=E[x];D&&D===o[x]&&j(c,n,D.ownParams)&&!f.reload;x++,D=E[x])G=H[x]=D.locals;if(t(b,k,G,f))return b.self.reloadOnSearch!==!1&&z(),v.transition=null,e.when(v.current);if(c=i(b.params,c||{}),f.notify&&(g=a.$broadcast("$stateChangeStart",b.self,c,k.self,n),g.defaultPrevented))return z(),F;for(var N=e.when(G),O=x;O<E.length;O++,D=E[O])G=H[O]=d(G),N=A(D,c,D===b,N,G);var P=v.transition=N.then(function(){var d,e,g;if(v.transition!==P)return B;for(d=o.length-1;d>=x;d--)g=o[d],g.self.onExit&&m.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=x;d<E.length;d++)e=E[d],e.locals=H[d],e.self.onEnter&&m.invoke(e.self.onEnter,e.self,e.locals.globals);if(v.transition!==P)return B;v.$current=b,v.current=b.self,v.params=c,J(v.params,q),v.transition=null;var h=b.navigable;return f.location&&h&&(r.url(h.url.format(h.locals.globals.$stateParams)),"replace"===f.location&&r.replace()),f.notify&&a.$broadcast("$stateChangeSuccess",b.self,c,k.self,n),M=r.url(),v.current},function(d){return v.transition!==P?B:(v.transition=null,a.$broadcast("$stateChangeError",b.self,c,k.self,n,d),z(),e.reject(d))});return P},v.is=function(a,d){var e=l(a);return C(e)?v.$current!==e?!1:C(d)&&null!==d?b.equals(q,d):!0:c},v.includes=function(a,d){if(E(a)&&o(a)){if(!p(a))return!1;a=v.$current.name}var e=l(a);if(!C(e))return c;if(!C(v.$current.includes[e.name]))return!1;var f=!0;return b.forEach(d,function(a,b){C(q[b])&&q[b]===a||(f=!1)}),f},v.href=function(a,b,c){c=I({lossy:!0,inherit:!1,absolute:!1,relative:v.$current},c||{});var d=l(a,c.relative);if(!C(d))return null;b=h(q,b||{},v.$current,d);var e=d&&c.lossy?d.navigable:d,g=e&&e.url?e.url.format(i(d.params,b||{})):null;return!f.html5Mode()&&g&&(g="#"+f.hashPrefix()+g),"/"!==N&&(f.html5Mode()?g=N.slice(0,-1)+g:c.absolute&&(g=N.slice(1)+g)),c.absolute&&g&&(g=r.protocol()+"://"+r.host()+(80==r.port()||443==r.port()?"":":"+r.port())+(!f.html5Mode()&&g?"/":"")+g),g},v.get=function(a,b){if(!C(a)){var c=[];return H(w,function(a){c.push(a.self)}),c}var d=l(a,b);return d&&d.self?d.self:null},v}function t(a,b,c,d){return a!==b||(c!==b.locals||d.reload)&&a.self.reloadOnSearch!==!1?void 0:!0}var u,v,w={},x={},y="abstract",z={parent:function(a){if(C(a.parent)&&a.parent)return l(a.parent);var b=/^(.+)\.[^.]+$/.exec(a.name);return b?l(b[1]):u},data:function(a){return a.parent&&a.parent.data&&(a.data=a.self.data=I({},a.parent.data,a.data)),a.data},url:function(a){var b=a.url;if(E(b))return"^"==b.charAt(0)?e.compile(b.substring(1)):(a.parent.navigable||u).url.concat(b);if(e.isMatcher(b)||null==b)return b;throw new Error("Invalid url '"+b+"' in state '"+a+"'")},navigable:function(a){return a.url?a:a.parent?a.parent.navigable:null},params:function(a){if(!a.params)return a.url?a.url.parameters():a.parent.params;if(!G(a.params))throw new Error("Invalid params in state '"+a+"'");if(a.url)throw new Error("Both params and url specicified in state '"+a+"'");return a.params},views:function(a){var b={};return H(C(a.views)?a.views:{"":a},function(c,d){d.indexOf("@")<0&&(d+="@"+a.parent.name),b[d]=c}),b},ownParams:function(a){if(!a.parent)return a.params;var b={};H(a.params,function(a){b[a]=!0}),H(a.parent.params,function(c){if(!b[c])throw new Error("Missing required parameter '"+c+"' in state '"+a.name+"'");b[c]=!1});var c=[];return H(b,function(a,b){a&&c.push(b)}),c},path:function(a){return a.parent?a.parent.path.concat(a):[]},includes:function(a){var b=a.parent?I({},a.parent.includes):{};return b[a.name]=!0,b},$delegates:{}};u=n({name:"",url:"^",views:null,"abstract":!0}),u.navigable=null,this.decorator=q,this.state=r,this.$get=s,s.$inject=["$rootScope","$q","$view","$injector","$resolve","$stateParams","$location","$urlRouter","$browser"]}function r(){function a(a,b){return{load:function(c,d){var e,f={template:null,controller:null,view:null,locals:null,notify:!0,async:!0,params:{}};return d=I(f,d),d.view&&(e=b.fromConfig(d.view,d.params,d.locals)),e&&d.notify&&a.$broadcast("$viewContentLoading",d),e}}}this.$get=a,a.$inject=["$rootScope","$templateFactory"]}function s(){var a=!1;this.useAnchorScroll=function(){a=!0},this.$get=["$anchorScroll","$timeout",function(b,c){return a?b:function(a){c(function(){a[0].scrollIntoView()},0,!1)}}]}function t(a,c,d){function e(){return c.has?function(a){return c.has(a)?c.get(a):null}:function(a){try{return c.get(a)}catch(b){return null}}}function f(a,b){var c=function(){return{enter:function(a,b,c){b.after(a),c()},leave:function(a,b){a.remove(),b()}}};if(i)return{enter:function(a,b,c){i.enter(a,null,b,c)},leave:function(a,b){i.leave(a,b)}};if(h){var d=h&&h(b,a);return{enter:function(a,b,c){d.enter(a,null,b),c()},leave:function(a,b){d.leave(a),b()}}}return c()}var g=e(),h=g("$animator"),i=g("$animate"),j={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,e,g){return function(c,e,h){function i(){k&&(k.remove(),k=null),m&&(m.$destroy(),m=null),l&&(q.leave(l,function(){k=null}),k=l,l=null)}function j(f){var h=c.$new(),j=l&&l.data("$uiViewName"),k=j&&a.$current&&a.$current.locals[j];if(f||k!==n){var r=g(h,function(a){q.enter(a,e,function(){(b.isDefined(p)&&!p||c.$eval(p))&&d(a)}),i()});n=a.$current.locals[r.data("$uiViewName")],l=r,m=h,m.$emit("$viewContentLoaded"),m.$eval(o)}}var k,l,m,n,o=h.onload||"",p=h.autoscroll,q=f(h,c);c.$on("$stateChangeSuccess",function(){j(!1)}),c.$on("$viewContentLoading",function(){j(!1)}),j(!0)}}};return j}function u(a,b,c){return{restrict:"ECA",priority:-400,compile:function(d){var e=d.html();return function(d,f,g){var h=g.uiView||g.name||"",i=f.inheritedData("$uiView");h.indexOf("@")<0&&(h=h+"@"+(i?i.state.name:"")),f.data("$uiViewName",h);var j=c.$current,k=j&&j.locals[h];if(k){f.data("$uiView",{name:h,state:k.$$state}),f.html(k.$template?k.$template:e);var l=a(f.contents());if(k.$$controller){k.$scope=d;var m=b(k.$$controller,k);k.$$controllerAs&&(d[k.$$controllerAs]=m),f.data("$ngControllerController",m),f.children().data("$ngControllerController",m)}l(d)}}}}}function v(a){var b=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/);if(!b||4!==b.length)throw new Error("Invalid state ref '"+a+"'");return{state:b[1],paramExpr:b[3]||null}}function w(a){var b=a.parent().inheritedData("$uiView");return b&&b.state&&b.state.name?b.state:void 0}function x(a,c){var d=["location","inherit","reload"];return{restrict:"A",require:"?^uiSrefActive",link:function(e,f,g,h){var i=v(g.uiSref),j=null,k=w(f)||a.$current,l="FORM"===f[0].nodeName,m=l?"action":"href",n=!0,o={relative:k},p=e.$eval(g.uiSrefOpts)||{};b.forEach(d,function(a){a in p&&(o[a]=p[a])});var q=function(b){if(b&&(j=b),n){var c=a.href(i.state,j,o);return h&&h.$$setStateInfo(i.state,j),c?void(f[0][m]=c):(n=!1,!1)}};i.paramExpr&&(e.$watch(i.paramExpr,function(a){a!==j&&q(a)},!0),j=e.$eval(i.paramExpr)),q(),l||f.bind("click",function(b){var d=b.which||b.button;d>1||b.ctrlKey||b.metaKey||b.shiftKey||f.attr("target")||(c(function(){a.go(i.state,j,o)}),b.preventDefault())})}}}function y(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs",function(d,e,f){function g(){a.$current.self===i&&h()?e.addClass(l):e.removeClass(l)}function h(){return!k||j(k,b)}var i,k,l;l=c(f.uiSrefActive||"",!1)(d),this.$$setStateInfo=function(b,c){i=a.get(b,w(e)),k=c,g()},d.$on("$stateChangeSuccess",g)}]}}function z(a){return function(b){return a.is(b)}}function A(a){return function(b){return a.includes(b)}}function B(a,b){function e(a){this.locals=a.locals.globals,this.params=this.locals.$stateParams}function f(){this.locals=null,this.params=null}function g(c,g){if(null!=g.redirectTo){var h,j=g.redirectTo;if(E(j))h=j;else{if(!D(j))throw new Error("Invalid 'redirectTo' in when()");h=function(a,b){return j(a,b.path(),b.search())}}b.when(c,h)}else a.state(d(g,{parent:null,name:"route:"+encodeURIComponent(c),url:c,onEnter:e,onExit:f}));return i.push(g),this}function h(a,b,d){function e(a){return""!==a.name?a:c}var f={routes:i,params:d,current:c};return b.$on("$stateChangeStart",function(a,c,d,f){b.$broadcast("$routeChangeStart",e(c),e(f))}),b.$on("$stateChangeSuccess",function(a,c,d,g){f.current=e(c),b.$broadcast("$routeChangeSuccess",e(c),e(g)),J(d,f.params)}),b.$on("$stateChangeError",function(a,c,d,f,g,h){b.$broadcast("$routeChangeError",e(c),e(f),h)}),f}var i=[];e.$inject=["$$state"],this.when=g,this.$get=h,h.$inject=["$state","$rootScope","$routeParams"]}var C=b.isDefined,D=b.isFunction,E=b.isString,F=b.isObject,G=b.isArray,H=b.forEach,I=b.extend,J=b.copy;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),l.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",l),m.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",m),n.prototype.concat=function(a){return new n(this.sourcePath+a+this.sourceSearch)},n.prototype.toString=function(){return this.source},n.prototype.exec=function(a,b){var c=this.regexp.exec(a);if(!c)return null;var d,e=this.params,f=e.length,g=this.segments.length-1,h={};if(g!==c.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");for(d=0;g>d;d++)h[e[d]]=c[d+1];for(;f>d;d++)h[e[d]]=b[e[d]];return h},n.prototype.parameters=function(){return this.params},n.prototype.format=function(a){var b=this.segments,c=this.params;if(!a)return b.join("");var d,e,f,g=b.length-1,h=c.length,i=b[0];for(d=0;g>d;d++)f=a[c[d]],null!=f&&(i+=encodeURIComponent(f)),i+=b[d+1];for(;h>d;d++)f=a[c[d]],null!=f&&(i+=(e?"&":"?")+c[d]+"="+encodeURIComponent(f),e=!0);return i},b.module("ui.router.util").provider("$urlMatcherFactory",o),p.$inject=["$urlMatcherFactoryProvider"],b.module("ui.router.router").provider("$urlRouter",p),q.$inject=["$urlRouterProvider","$urlMatcherFactoryProvider","$locationProvider"],b.module("ui.router.state").value("$stateParams",{}).provider("$state",q),r.$inject=[],b.module("ui.router.state").provider("$view",r),b.module("ui.router.state").provider("$uiViewScroll",s),t.$inject=["$state","$injector","$uiViewScroll"],u.$inject=["$compile","$controller","$state"],b.module("ui.router.state").directive("uiView",t),b.module("ui.router.state").directive("uiView",u),x.$inject=["$state","$timeout"],y.$inject=["$state","$stateParams","$interpolate"],b.module("ui.router.state").directive("uiSref",x).directive("uiSrefActive",y),z.$inject=["$state"],A.$inject=["$state"],b.module("ui.router.state").filter("isState",z).filter("includedByState",A),B.$inject=["$stateProvider","$urlRouterProvider"],b.module("ui.router.compat").provider("$route",B).directive("ngView",t)}(window,window.angular);
\ No newline at end of file
diff --git a/setup/pub/angular/angular.js b/setup/pub/angular/angular.js
new file mode 100644
index 0000000000000000000000000000000000000000..66b1d2569b7b7c174055db5672c574ee64ee809b
--- /dev/null
+++ b/setup/pub/angular/angular.js
@@ -0,0 +1,21465 @@
+/**
+ * @license AngularJS v1.2.16
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, document, undefined) {'use strict';
+
+    /**
+     * @description
+     *
+     * This object provides a utility for producing rich Error messages within
+     * Angular. It can be called as follows:
+     *
+     * var exampleMinErr = minErr('example');
+     * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+     *
+     * The above creates an instance of minErr in the example namespace. The
+     * resulting error will have a namespaced error code of example.one.  The
+     * resulting error will replace {0} with the value of foo, and {1} with the
+     * value of bar. The object is not restricted in the number of arguments it can
+     * take.
+     *
+     * If fewer arguments are specified than necessary for interpolation, the extra
+     * interpolation markers will be preserved in the final string.
+     *
+     * Since data will be parsed statically during a build step, some restrictions
+     * are applied with respect to how minErr instances are created and called.
+     * Instances should have names of the form namespaceMinErr for a minErr created
+     * using minErr('namespace') . Error codes, namespaces and template strings
+     * should all be static strings, not variables or general expressions.
+     *
+     * @param {string} module The namespace to use for the new minErr instance.
+     * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+     */
+
+    function minErr(module) {
+        return function () {
+            var code = arguments[0],
+                prefix = '[' + (module ? module + ':' : '') + code + '] ',
+                template = arguments[1],
+                templateArgs = arguments,
+                stringify = function (obj) {
+                    if (typeof obj === 'function') {
+                        return obj.toString().replace(/ \{[\s\S]*$/, '');
+                    } else if (typeof obj === 'undefined') {
+                        return 'undefined';
+                    } else if (typeof obj !== 'string') {
+                        return JSON.stringify(obj);
+                    }
+                    return obj;
+                },
+                message, i;
+
+            message = prefix + template.replace(/\{\d+\}/g, function (match) {
+                var index = +match.slice(1, -1), arg;
+
+                if (index + 2 < templateArgs.length) {
+                    arg = templateArgs[index + 2];
+                    if (typeof arg === 'function') {
+                        return arg.toString().replace(/ ?\{[\s\S]*$/, '');
+                    } else if (typeof arg === 'undefined') {
+                        return 'undefined';
+                    } else if (typeof arg !== 'string') {
+                        return toJson(arg);
+                    }
+                    return arg;
+                }
+                return match;
+            });
+
+            message = message + '\nhttp://errors.angularjs.org/1.2.16/' +
+            (module ? module + '/' : '') + code;
+            for (i = 2; i < arguments.length; i++) {
+                message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
+                encodeURIComponent(stringify(arguments[i]));
+            }
+
+            return new Error(message);
+        };
+    }
+
+    /* We need to tell jshint what variables are being exported */
+    /* global
+     -angular,
+     -msie,
+     -jqLite,
+     -jQuery,
+     -slice,
+     -push,
+     -toString,
+     -ngMinErr,
+     -_angular,
+     -angularModule,
+     -nodeName_,
+     -uid,
+
+     -lowercase,
+     -uppercase,
+     -manualLowercase,
+     -manualUppercase,
+     -nodeName_,
+     -isArrayLike,
+     -forEach,
+     -sortedKeys,
+     -forEachSorted,
+     -reverseParams,
+     -nextUid,
+     -setHashKey,
+     -extend,
+     -int,
+     -inherit,
+     -noop,
+     -identity,
+     -valueFn,
+     -isUndefined,
+     -isDefined,
+     -isObject,
+     -isString,
+     -isNumber,
+     -isDate,
+     -isArray,
+     -isFunction,
+     -isRegExp,
+     -isWindow,
+     -isScope,
+     -isFile,
+     -isBlob,
+     -isBoolean,
+     -trim,
+     -isElement,
+     -makeMap,
+     -map,
+     -size,
+     -includes,
+     -indexOf,
+     -arrayRemove,
+     -isLeafNode,
+     -copy,
+     -shallowCopy,
+     -equals,
+     -csp,
+     -concat,
+     -sliceArgs,
+     -bind,
+     -toJsonReplacer,
+     -toJson,
+     -fromJson,
+     -toBoolean,
+     -startingTag,
+     -tryDecodeURIComponent,
+     -parseKeyValue,
+     -toKeyValue,
+     -encodeUriSegment,
+     -encodeUriQuery,
+     -angularInit,
+     -bootstrap,
+     -snake_case,
+     -bindJQuery,
+     -assertArg,
+     -assertArgFn,
+     -assertNotHasOwnProperty,
+     -getter,
+     -getBlockElements,
+     -hasOwnProperty,
+
+     */
+
+////////////////////////////////////
+
+    /**
+     * @ngdoc module
+     * @name ng
+     * @module ng
+     * @description
+     *
+     * # ng (core module)
+     * The ng module is loaded by default when an AngularJS application is started. The module itself
+     * contains the essential components for an AngularJS application to function. The table below
+     * lists a high level breakdown of each of the services/factories, filters, directives and testing
+     * components available within this core module.
+     *
+     * <div doc-module-components="ng"></div>
+     */
+
+    /**
+     * @ngdoc function
+     * @name angular.lowercase
+     * @module ng
+     * @function
+     *
+     * @description Converts the specified string to lowercase.
+     * @param {string} string String to be converted to lowercase.
+     * @returns {string} Lowercased string.
+     */
+    var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;};
+    var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+    /**
+     * @ngdoc function
+     * @name angular.uppercase
+     * @module ng
+     * @function
+     *
+     * @description Converts the specified string to uppercase.
+     * @param {string} string String to be converted to uppercase.
+     * @returns {string} Uppercased string.
+     */
+    var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;};
+
+
+    var manualLowercase = function(s) {
+        /* jshint bitwise: false */
+        return isString(s)
+            ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
+            : s;
+    };
+    var manualUppercase = function(s) {
+        /* jshint bitwise: false */
+        return isString(s)
+            ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
+            : s;
+    };
+
+
+// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
+// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
+// with correct but slower alternatives.
+    if ('i' !== 'I'.toLowerCase()) {
+        lowercase = manualLowercase;
+        uppercase = manualUppercase;
+    }
+
+
+    var /** holds major version number for IE or NaN for real browsers */
+        msie,
+        jqLite,           // delay binding since jQuery could be loaded after us.
+        jQuery,           // delay binding
+        slice             = [].slice,
+        push              = [].push,
+        toString          = Object.prototype.toString,
+        ngMinErr          = minErr('ng'),
+
+
+        _angular          = window.angular,
+        /** @name angular */
+        angular           = window.angular || (window.angular = {}),
+        angularModule,
+        nodeName_,
+        uid               = ['0', '0', '0'];
+
+    /**
+     * IE 11 changed the format of the UserAgent string.
+     * See http://msdn.microsoft.com/en-us/library/ms537503.aspx
+     */
+    msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);
+    if (isNaN(msie)) {
+        msie = int((/trident\/.*; rv:(\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);
+    }
+
+
+    /**
+     * @private
+     * @param {*} obj
+     * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
+     *                   String ...)
+     */
+    function isArrayLike(obj) {
+        if (obj == null || isWindow(obj)) {
+            return false;
+        }
+
+        var length = obj.length;
+
+        if (obj.nodeType === 1 && length) {
+            return true;
+        }
+
+        return isString(obj) || isArray(obj) || length === 0 ||
+        typeof length === 'number' && length > 0 && (length - 1) in obj;
+    }
+
+    /**
+     * @ngdoc function
+     * @name angular.forEach
+     * @module ng
+     * @function
+     *
+     * @description
+     * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
+     * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`
+     * is the value of an object property or an array element and `key` is the object property key or
+     * array element index. Specifying a `context` for the function is optional.
+     *
+     * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
+     * using the `hasOwnProperty` method.
+     *
+     ```js
+     var values = {name: 'misko', gender: 'male'};
+     var log = [];
+     angular.forEach(values, function(value, key){
+       this.push(key + ': ' + value);
+     }, log);
+     expect(log).toEqual(['name: misko', 'gender: male']);
+     ```
+     *
+     * @param {Object|Array} obj Object to iterate over.
+     * @param {Function} iterator Iterator function.
+     * @param {Object=} context Object to become context (`this`) for the iterator function.
+     * @returns {Object|Array} Reference to `obj`.
+     */
+    function forEach(obj, iterator, context) {
+        var key;
+        if (obj) {
+            if (isFunction(obj)){
+                for (key in obj) {
+                    // Need to check if hasOwnProperty exists,
+                    // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+                    if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+                        iterator.call(context, obj[key], key);
+                    }
+                }
+            } else if (obj.forEach && obj.forEach !== forEach) {
+                obj.forEach(iterator, context);
+            } else if (isArrayLike(obj)) {
+                for (key = 0; key < obj.length; key++)
+                    iterator.call(context, obj[key], key);
+            } else {
+                for (key in obj) {
+                    if (obj.hasOwnProperty(key)) {
+                        iterator.call(context, obj[key], key);
+                    }
+                }
+            }
+        }
+        return obj;
+    }
+
+    function sortedKeys(obj) {
+        var keys = [];
+        for (var key in obj) {
+            if (obj.hasOwnProperty(key)) {
+                keys.push(key);
+            }
+        }
+        return keys.sort();
+    }
+
+    function forEachSorted(obj, iterator, context) {
+        var keys = sortedKeys(obj);
+        for ( var i = 0; i < keys.length; i++) {
+            iterator.call(context, obj[keys[i]], keys[i]);
+        }
+        return keys;
+    }
+
+
+    /**
+     * when using forEach the params are value, key, but it is often useful to have key, value.
+     * @param {function(string, *)} iteratorFn
+     * @returns {function(*, string)}
+     */
+    function reverseParams(iteratorFn) {
+        return function(value, key) { iteratorFn(key, value); };
+    }
+
+    /**
+     * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
+     * characters such as '012ABC'. The reason why we are not using simply a number counter is that
+     * the number string gets longer over time, and it can also overflow, where as the nextId
+     * will grow much slower, it is a string, and it will never overflow.
+     *
+     * @returns {string} an unique alpha-numeric string
+     */
+    function nextUid() {
+        var index = uid.length;
+        var digit;
+
+        while(index) {
+            index--;
+            digit = uid[index].charCodeAt(0);
+            if (digit == 57 /*'9'*/) {
+                uid[index] = 'A';
+                return uid.join('');
+            }
+            if (digit == 90  /*'Z'*/) {
+                uid[index] = '0';
+            } else {
+                uid[index] = String.fromCharCode(digit + 1);
+                return uid.join('');
+            }
+        }
+        uid.unshift('0');
+        return uid.join('');
+    }
+
+
+    /**
+     * Set or clear the hashkey for an object.
+     * @param obj object
+     * @param h the hashkey (!truthy to delete the hashkey)
+     */
+    function setHashKey(obj, h) {
+        if (h) {
+            obj.$$hashKey = h;
+        }
+        else {
+            delete obj.$$hashKey;
+        }
+    }
+
+    /**
+     * @ngdoc function
+     * @name angular.extend
+     * @module ng
+     * @function
+     *
+     * @description
+     * Extends the destination object `dst` by copying all of the properties from the `src` object(s)
+     * to `dst`. You can specify multiple `src` objects.
+     *
+     * @param {Object} dst Destination object.
+     * @param {...Object} src Source object(s).
+     * @returns {Object} Reference to `dst`.
+     */
+    function extend(dst) {
+        var h = dst.$$hashKey;
+        forEach(arguments, function(obj){
+            if (obj !== dst) {
+                forEach(obj, function(value, key){
+                    dst[key] = value;
+                });
+            }
+        });
+
+        setHashKey(dst,h);
+        return dst;
+    }
+
+    function int(str) {
+        return parseInt(str, 10);
+    }
+
+
+    function inherit(parent, extra) {
+        return extend(new (extend(function() {}, {prototype:parent}))(), extra);
+    }
+
+    /**
+     * @ngdoc function
+     * @name angular.noop
+     * @module ng
+     * @function
+     *
+     * @description
+     * A function that performs no operations. This function can be useful when writing code in the
+     * functional style.
+     ```js
+     function foo(callback) {
+       var result = calculateResult();
+       (callback || angular.noop)(result);
+     }
+     ```
+     */
+    function noop() {}
+    noop.$inject = [];
+
+
+    /**
+     * @ngdoc function
+     * @name angular.identity
+     * @module ng
+     * @function
+     *
+     * @description
+     * A function that returns its first argument. This function is useful when writing code in the
+     * functional style.
+     *
+     ```js
+     function transformer(transformationFn, value) {
+       return (transformationFn || angular.identity)(value);
+     };
+     ```
+     */
+    function identity($) {return $;}
+    identity.$inject = [];
+
+
+    function valueFn(value) {return function() {return value;};}
+
+    /**
+     * @ngdoc function
+     * @name angular.isUndefined
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is undefined.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is undefined.
+     */
+    function isUndefined(value){return typeof value === 'undefined';}
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isDefined
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is defined.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is defined.
+     */
+    function isDefined(value){return typeof value !== 'undefined';}
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isObject
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
+     * considered to be objects. Note that JavaScript arrays are objects.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is an `Object` but not `null`.
+     */
+    function isObject(value){return value != null && typeof value === 'object';}
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isString
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is a `String`.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is a `String`.
+     */
+    function isString(value){return typeof value === 'string';}
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isNumber
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is a `Number`.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is a `Number`.
+     */
+    function isNumber(value){return typeof value === 'number';}
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isDate
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a value is a date.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is a `Date`.
+     */
+    function isDate(value){
+        return toString.call(value) === '[object Date]';
+    }
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isArray
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is an `Array`.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is an `Array`.
+     */
+    function isArray(value) {
+        return toString.call(value) === '[object Array]';
+    }
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isFunction
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is a `Function`.
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is a `Function`.
+     */
+    function isFunction(value){return typeof value === 'function';}
+
+
+    /**
+     * Determines if a value is a regular expression object.
+     *
+     * @private
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is a `RegExp`.
+     */
+    function isRegExp(value) {
+        return toString.call(value) === '[object RegExp]';
+    }
+
+
+    /**
+     * Checks if `obj` is a window object.
+     *
+     * @private
+     * @param {*} obj Object to check
+     * @returns {boolean} True if `obj` is a window obj.
+     */
+    function isWindow(obj) {
+        return obj && obj.document && obj.location && obj.alert && obj.setInterval;
+    }
+
+
+    function isScope(obj) {
+        return obj && obj.$evalAsync && obj.$watch;
+    }
+
+
+    function isFile(obj) {
+        return toString.call(obj) === '[object File]';
+    }
+
+
+    function isBlob(obj) {
+        return toString.call(obj) === '[object Blob]';
+    }
+
+
+    function isBoolean(value) {
+        return typeof value === 'boolean';
+    }
+
+
+    var trim = (function() {
+        // native trim is way faster: http://jsperf.com/angular-trim-test
+        // but IE doesn't have it... :-(
+        // TODO: we should move this into IE/ES5 polyfill
+        if (!String.prototype.trim) {
+            return function(value) {
+                return isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value;
+            };
+        }
+        return function(value) {
+            return isString(value) ? value.trim() : value;
+        };
+    })();
+
+
+    /**
+     * @ngdoc function
+     * @name angular.isElement
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if a reference is a DOM element (or wrapped jQuery element).
+     *
+     * @param {*} value Reference to check.
+     * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
+     */
+    function isElement(node) {
+        return !!(node &&
+        (node.nodeName  // we are a direct element
+        || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API
+    }
+
+    /**
+     * @param str 'key1,key2,...'
+     * @returns {object} in the form of {key1:true, key2:true, ...}
+     */
+    function makeMap(str){
+        var obj = {}, items = str.split(","), i;
+        for ( i = 0; i < items.length; i++ )
+            obj[ items[i] ] = true;
+        return obj;
+    }
+
+
+    if (msie < 9) {
+        nodeName_ = function(element) {
+            element = element.nodeName ? element : element[0];
+            return (element.scopeName && element.scopeName != 'HTML')
+                ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;
+        };
+    } else {
+        nodeName_ = function(element) {
+            return element.nodeName ? element.nodeName : element[0].nodeName;
+        };
+    }
+
+
+    function map(obj, iterator, context) {
+        var results = [];
+        forEach(obj, function(value, index, list) {
+            results.push(iterator.call(context, value, index, list));
+        });
+        return results;
+    }
+
+
+    /**
+     * @description
+     * Determines the number of elements in an array, the number of properties an object has, or
+     * the length of a string.
+     *
+     * Note: This function is used to augment the Object type in Angular expressions. See
+     * {@link angular.Object} for more information about Angular arrays.
+     *
+     * @param {Object|Array|string} obj Object, array, or string to inspect.
+     * @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object
+     * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array.
+     */
+    function size(obj, ownPropsOnly) {
+        var count = 0, key;
+
+        if (isArray(obj) || isString(obj)) {
+            return obj.length;
+        } else if (isObject(obj)){
+            for (key in obj)
+                if (!ownPropsOnly || obj.hasOwnProperty(key))
+                    count++;
+        }
+
+        return count;
+    }
+
+
+    function includes(array, obj) {
+        return indexOf(array, obj) != -1;
+    }
+
+    function indexOf(array, obj) {
+        if (array.indexOf) return array.indexOf(obj);
+
+        for (var i = 0; i < array.length; i++) {
+            if (obj === array[i]) return i;
+        }
+        return -1;
+    }
+
+    function arrayRemove(array, value) {
+        var index = indexOf(array, value);
+        if (index >=0)
+            array.splice(index, 1);
+        return value;
+    }
+
+    function isLeafNode (node) {
+        if (node) {
+            switch (node.nodeName) {
+                case "OPTION":
+                case "PRE":
+                case "TITLE":
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @ngdoc function
+     * @name angular.copy
+     * @module ng
+     * @function
+     *
+     * @description
+     * Creates a deep copy of `source`, which should be an object or an array.
+     *
+     * * If no destination is supplied, a copy of the object or array is created.
+     * * If a destination is provided, all of its elements (for array) or properties (for objects)
+     *   are deleted and then all elements/properties from the source are copied to it.
+     * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
+     * * If `source` is identical to 'destination' an exception will be thrown.
+     *
+     * @param {*} source The source that will be used to make a copy.
+     *                   Can be any type, including primitives, `null`, and `undefined`.
+     * @param {(Object|Array)=} destination Destination into which the source is copied. If
+     *     provided, must be of the same type as `source`.
+     * @returns {*} The copy or updated `destination`, if `destination` was specified.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <div ng-controller="Controller">
+     <form novalidate class="simple-form">
+     Name: <input type="text" ng-model="user.name" /><br />
+     E-mail: <input type="email" ng-model="user.email" /><br />
+     Gender: <input type="radio" ng-model="user.gender" value="male" />male
+     <input type="radio" ng-model="user.gender" value="female" />female<br />
+     <button ng-click="reset()">RESET</button>
+     <button ng-click="update(user)">SAVE</button>
+     </form>
+     <pre>form = {{user | json}}</pre>
+     <pre>master = {{master | json}}</pre>
+     </div>
+
+     <script>
+     function Controller($scope) {
+    $scope.master= {};
+
+    $scope.update = function(user) {
+      // Example with 1 argument
+      $scope.master= angular.copy(user);
+    };
+
+    $scope.reset = function() {
+      // Example with 2 arguments
+      angular.copy($scope.master, $scope.user);
+    };
+
+    $scope.reset();
+  }
+     </script>
+     </file>
+     </example>
+     */
+    function copy(source, destination){
+        if (isWindow(source) || isScope(source)) {
+            throw ngMinErr('cpws',
+                "Can't copy! Making copies of Window or Scope instances is not supported.");
+        }
+
+        if (!destination) {
+            destination = source;
+            if (source) {
+                if (isArray(source)) {
+                    destination = copy(source, []);
+                } else if (isDate(source)) {
+                    destination = new Date(source.getTime());
+                } else if (isRegExp(source)) {
+                    destination = new RegExp(source.source);
+                } else if (isObject(source)) {
+                    destination = copy(source, {});
+                }
+            }
+        } else {
+            if (source === destination) throw ngMinErr('cpi',
+                "Can't copy! Source and destination are identical.");
+            if (isArray(source)) {
+                destination.length = 0;
+                for ( var i = 0; i < source.length; i++) {
+                    destination.push(copy(source[i]));
+                }
+            } else {
+                var h = destination.$$hashKey;
+                forEach(destination, function(value, key){
+                    delete destination[key];
+                });
+                for ( var key in source) {
+                    destination[key] = copy(source[key]);
+                }
+                setHashKey(destination,h);
+            }
+        }
+        return destination;
+    }
+
+    /**
+     * Create a shallow copy of an object
+     */
+    function shallowCopy(src, dst) {
+        dst = dst || {};
+
+        for(var key in src) {
+            // shallowCopy is only ever called by $compile nodeLinkFn, which has control over src
+            // so we don't need to worry about using our custom hasOwnProperty here
+            if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+                dst[key] = src[key];
+            }
+        }
+
+        return dst;
+    }
+
+
+    /**
+     * @ngdoc function
+     * @name angular.equals
+     * @module ng
+     * @function
+     *
+     * @description
+     * Determines if two objects or two values are equivalent. Supports value types, regular
+     * expressions, arrays and objects.
+     *
+     * Two objects or values are considered equivalent if at least one of the following is true:
+     *
+     * * Both objects or values pass `===` comparison.
+     * * Both objects or values are of the same type and all of their properties are equal by
+     *   comparing them with `angular.equals`.
+     * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
+     * * Both values represent the same regular expression (In JavasScript,
+     *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
+     *   representation matches).
+     *
+     * During a property comparison, properties of `function` type and properties with names
+     * that begin with `$` are ignored.
+     *
+     * Scope and DOMWindow objects are being compared only by identify (`===`).
+     *
+     * @param {*} o1 Object or value to compare.
+     * @param {*} o2 Object or value to compare.
+     * @returns {boolean} True if arguments are equal.
+     */
+    function equals(o1, o2) {
+        if (o1 === o2) return true;
+        if (o1 === null || o2 === null) return false;
+        if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
+        var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
+        if (t1 == t2) {
+            if (t1 == 'object') {
+                if (isArray(o1)) {
+                    if (!isArray(o2)) return false;
+                    if ((length = o1.length) == o2.length) {
+                        for(key=0; key<length; key++) {
+                            if (!equals(o1[key], o2[key])) return false;
+                        }
+                        return true;
+                    }
+                } else if (isDate(o1)) {
+                    return isDate(o2) && o1.getTime() == o2.getTime();
+                } else if (isRegExp(o1) && isRegExp(o2)) {
+                    return o1.toString() == o2.toString();
+                } else {
+                    if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;
+                    keySet = {};
+                    for(key in o1) {
+                        if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+                        if (!equals(o1[key], o2[key])) return false;
+                        keySet[key] = true;
+                    }
+                    for(key in o2) {
+                        if (!keySet.hasOwnProperty(key) &&
+                            key.charAt(0) !== '$' &&
+                            o2[key] !== undefined &&
+                            !isFunction(o2[key])) return false;
+                    }
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+
+    function csp() {
+        return (document.securityPolicy && document.securityPolicy.isActive) ||
+        (document.querySelector &&
+        !!(document.querySelector('[ng-csp]') || document.querySelector('[data-ng-csp]')));
+    }
+
+
+    function concat(array1, array2, index) {
+        return array1.concat(slice.call(array2, index));
+    }
+
+    function sliceArgs(args, startIndex) {
+        return slice.call(args, startIndex || 0);
+    }
+
+
+    /* jshint -W101 */
+    /**
+     * @ngdoc function
+     * @name angular.bind
+     * @module ng
+     * @function
+     *
+     * @description
+     * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
+     * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
+     * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as
+     * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
+     *
+     * @param {Object} self Context which `fn` should be evaluated in.
+     * @param {function()} fn Function to be bound.
+     * @param {...*} args Optional arguments to be prebound to the `fn` function call.
+     * @returns {function()} Function that wraps the `fn` with all the specified bindings.
+     */
+    /* jshint +W101 */
+    function bind(self, fn) {
+        var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
+        if (isFunction(fn) && !(fn instanceof RegExp)) {
+            return curryArgs.length
+                ? function() {
+                return arguments.length
+                    ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0)))
+                    : fn.apply(self, curryArgs);
+            }
+                : function() {
+                return arguments.length
+                    ? fn.apply(self, arguments)
+                    : fn.call(self);
+            };
+        } else {
+            // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
+            return fn;
+        }
+    }
+
+
+    function toJsonReplacer(key, value) {
+        var val = value;
+
+        if (typeof key === 'string' && key.charAt(0) === '$') {
+            val = undefined;
+        } else if (isWindow(value)) {
+            val = '$WINDOW';
+        } else if (value &&  document === value) {
+            val = '$DOCUMENT';
+        } else if (isScope(value)) {
+            val = '$SCOPE';
+        }
+
+        return val;
+    }
+
+
+    /**
+     * @ngdoc function
+     * @name angular.toJson
+     * @module ng
+     * @function
+     *
+     * @description
+     * Serializes input into a JSON-formatted string. Properties with leading $ characters will be
+     * stripped since angular uses this notation internally.
+     *
+     * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+     * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace.
+     * @returns {string|undefined} JSON-ified string representing `obj`.
+     */
+    function toJson(obj, pretty) {
+        if (typeof obj === 'undefined') return undefined;
+        return JSON.stringify(obj, toJsonReplacer, pretty ? '  ' : null);
+    }
+
+
+    /**
+     * @ngdoc function
+     * @name angular.fromJson
+     * @module ng
+     * @function
+     *
+     * @description
+     * Deserializes a JSON string.
+     *
+     * @param {string} json JSON string to deserialize.
+     * @returns {Object|Array|string|number} Deserialized thingy.
+     */
+    function fromJson(json) {
+        return isString(json)
+            ? JSON.parse(json)
+            : json;
+    }
+
+
+    function toBoolean(value) {
+        if (typeof value === 'function') {
+            value = true;
+        } else if (value && value.length !== 0) {
+            var v = lowercase("" + value);
+            value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
+        } else {
+            value = false;
+        }
+        return value;
+    }
+
+    /**
+     * @returns {string} Returns the string representation of the element.
+     */
+    function startingTag(element) {
+        element = jqLite(element).clone();
+        try {
+            // turns out IE does not let you set .html() on elements which
+            // are not allowed to have children. So we just ignore it.
+            element.empty();
+        } catch(e) {}
+        // As Per DOM Standards
+        var TEXT_NODE = 3;
+        var elemHtml = jqLite('<div>').append(element).html();
+        try {
+            return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :
+                elemHtml.
+                    match(/^(<[^>]+>)/)[1].
+                    replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
+        } catch(e) {
+            return lowercase(elemHtml);
+        }
+
+    }
+
+
+/////////////////////////////////////////////////
+
+    /**
+     * Tries to decode the URI component without throwing an exception.
+     *
+     * @private
+     * @param str value potential URI component to check.
+     * @returns {boolean} True if `value` can be decoded
+     * with the decodeURIComponent function.
+     */
+    function tryDecodeURIComponent(value) {
+        try {
+            return decodeURIComponent(value);
+        } catch(e) {
+            // Ignore any invalid uri component
+        }
+    }
+
+
+    /**
+     * Parses an escaped url query string into key-value pairs.
+     * @returns {Object.<string,boolean|Array>}
+     */
+    function parseKeyValue(/**string*/keyValue) {
+        var obj = {}, key_value, key;
+        forEach((keyValue || "").split('&'), function(keyValue){
+            if ( keyValue ) {
+                key_value = keyValue.split('=');
+                key = tryDecodeURIComponent(key_value[0]);
+                if ( isDefined(key) ) {
+                    var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
+                    if (!obj[key]) {
+                        obj[key] = val;
+                    } else if(isArray(obj[key])) {
+                        obj[key].push(val);
+                    } else {
+                        obj[key] = [obj[key],val];
+                    }
+                }
+            }
+        });
+        return obj;
+    }
+
+    function toKeyValue(obj) {
+        var parts = [];
+        forEach(obj, function(value, key) {
+            if (isArray(value)) {
+                forEach(value, function(arrayValue) {
+                    parts.push(encodeUriQuery(key, true) +
+                    (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+                });
+            } else {
+                parts.push(encodeUriQuery(key, true) +
+                (value === true ? '' : '=' + encodeUriQuery(value, true)));
+            }
+        });
+        return parts.length ? parts.join('&') : '';
+    }
+
+
+    /**
+     * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+     * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+     * segments:
+     *    segment       = *pchar
+     *    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
+     *    pct-encoded   = "%" HEXDIG HEXDIG
+     *    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
+     *    sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
+     *                     / "*" / "+" / "," / ";" / "="
+     */
+    function encodeUriSegment(val) {
+        return encodeUriQuery(val, true).
+            replace(/%26/gi, '&').
+            replace(/%3D/gi, '=').
+            replace(/%2B/gi, '+');
+    }
+
+
+    /**
+     * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+     * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
+     * encoded per http://tools.ietf.org/html/rfc3986:
+     *    query       = *( pchar / "/" / "?" )
+     *    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
+     *    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
+     *    pct-encoded   = "%" HEXDIG HEXDIG
+     *    sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
+     *                     / "*" / "+" / "," / ";" / "="
+     */
+    function encodeUriQuery(val, pctEncodeSpaces) {
+        return encodeURIComponent(val).
+            replace(/%40/gi, '@').
+            replace(/%3A/gi, ':').
+            replace(/%24/g, '$').
+            replace(/%2C/gi, ',').
+            replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+    }
+
+
+    /**
+     * @ngdoc directive
+     * @name ngApp
+     * @module ng
+     *
+     * @element ANY
+     * @param {angular.Module} ngApp an optional application
+     *   {@link angular.module module} name to load.
+     *
+     * @description
+     *
+     * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
+     * designates the **root element** of the application and is typically placed near the root element
+     * of the page - e.g. on the `<body>` or `<html>` tags.
+     *
+     * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
+     * found in the document will be used to define the root element to auto-bootstrap as an
+     * application. To run multiple applications in an HTML document you must manually bootstrap them using
+     * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.
+     *
+     * You can specify an **AngularJS module** to be used as the root module for the application.  This
+     * module will be loaded into the {@link auto.$injector} when the application is bootstrapped and
+     * should contain the application code needed or have dependencies on other modules that will
+     * contain the code. See {@link angular.module} for more information.
+     *
+     * In the example below if the `ngApp` directive were not placed on the `html` element then the
+     * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
+     * would not be resolved to `3`.
+     *
+     * `ngApp` is the easiest, and most common, way to bootstrap an application.
+     *
+     <example module="ngAppDemo">
+     <file name="index.html">
+     <div ng-controller="ngAppDemoController">
+     I can add: {{a}} + {{b}} =  {{ a+b }}
+     </div>
+     </file>
+     <file name="script.js">
+     angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
+     $scope.a = 1;
+     $scope.b = 2;
+   });
+     </file>
+     </example>
+     *
+     */
+    function angularInit(element, bootstrap) {
+        var elements = [element],
+            appElement,
+            module,
+            names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'],
+            NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;
+
+        function append(element) {
+            element && elements.push(element);
+        }
+
+        forEach(names, function(name) {
+            names[name] = true;
+            append(document.getElementById(name));
+            name = name.replace(':', '\\:');
+            if (element.querySelectorAll) {
+                forEach(element.querySelectorAll('.' + name), append);
+                forEach(element.querySelectorAll('.' + name + '\\:'), append);
+                forEach(element.querySelectorAll('[' + name + ']'), append);
+            }
+        });
+
+        forEach(elements, function(element) {
+            if (!appElement) {
+                var className = ' ' + element.className + ' ';
+                var match = NG_APP_CLASS_REGEXP.exec(className);
+                if (match) {
+                    appElement = element;
+                    module = (match[2] || '').replace(/\s+/g, ',');
+                } else {
+                    forEach(element.attributes, function(attr) {
+                        if (!appElement && names[attr.name]) {
+                            appElement = element;
+                            module = attr.value;
+                        }
+                    });
+                }
+            }
+        });
+        if (appElement) {
+            bootstrap(appElement, module ? [module] : []);
+        }
+    }
+
+    /**
+     * @ngdoc function
+     * @name angular.bootstrap
+     * @module ng
+     * @description
+     * Use this function to manually start up angular application.
+     *
+     * See: {@link guide/bootstrap Bootstrap}
+     *
+     * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually.
+     * They must use {@link ng.directive:ngApp ngApp}.
+     *
+     * Angular will detect if it has been loaded into the browser more than once and only allow the
+     * first loaded script to be bootstrapped and will report a warning to the browser console for
+     * each of the subsequent scripts.   This prevents strange results in applications, where otherwise
+     * multiple instances of Angular try to work on the DOM.
+     *
+     * <example name="multi-bootstrap" module="multi-bootstrap">
+     * <file name="index.html">
+     * <script src="../../../angular.js"></script>
+     * <div ng-controller="BrokenTable">
+     *   <table>
+     *   <tr>
+     *     <th ng-repeat="heading in headings">{{heading}}</th>
+     *   </tr>
+     *   <tr ng-repeat="filling in fillings">
+     *     <td ng-repeat="fill in filling">{{fill}}</td>
+     *   </tr>
+     * </table>
+     * </div>
+     * </file>
+     * <file name="controller.js">
+     * var app = angular.module('multi-bootstrap', [])
+     *
+     * .controller('BrokenTable', function($scope) {
+ *     $scope.headings = ['One', 'Two', 'Three'];
+ *     $scope.fillings = [[1, 2, 3], ['A', 'B', 'C'], [7, 8, 9]];
+ * });
+     * </file>
+     * <file name="protractor.js" type="protractor">
+     * it('should only insert one table cell for each item in $scope.fillings', function() {
+ *  expect(element.all(by.css('td')).count())
+ *      .toBe(9);
+ * });
+     * </file>
+     * </example>
+     *
+     * @param {DOMElement} element DOM element which is the root of angular application.
+     * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
+     *     Each item in the array should be the name of a predefined module or a (DI annotated)
+     *     function that will be invoked by the injector as a run block.
+     *     See: {@link angular.module modules}
+     * @returns {auto.$injector} Returns the newly created injector for this app.
+     */
+    function bootstrap(element, modules) {
+        var doBootstrap = function() {
+            element = jqLite(element);
+
+            if (element.injector()) {
+                var tag = (element[0] === document) ? 'document' : startingTag(element);
+                throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag);
+            }
+
+            modules = modules || [];
+            modules.unshift(['$provide', function($provide) {
+                $provide.value('$rootElement', element);
+            }]);
+            modules.unshift('ng');
+            var injector = createInjector(modules);
+            injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate',
+                    function(scope, element, compile, injector, animate) {
+                        scope.$apply(function() {
+                            element.data('$injector', injector);
+                            compile(element)(scope);
+                        });
+                    }]
+            );
+            return injector;
+        };
+
+        var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
+
+        if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
+            return doBootstrap();
+        }
+
+        window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
+        angular.resumeBootstrap = function(extraModules) {
+            forEach(extraModules, function(module) {
+                modules.push(module);
+            });
+            doBootstrap();
+        };
+    }
+
+    var SNAKE_CASE_REGEXP = /[A-Z]/g;
+    function snake_case(name, separator){
+        separator = separator || '_';
+        return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+            return (pos ? separator : '') + letter.toLowerCase();
+        });
+    }
+
+    function bindJQuery() {
+        // bind to jQuery if present;
+        jQuery = window.jQuery;
+        // reset to jQuery or default to us.
+        if (jQuery) {
+            jqLite = jQuery;
+            extend(jQuery.fn, {
+                scope: JQLitePrototype.scope,
+                isolateScope: JQLitePrototype.isolateScope,
+                controller: JQLitePrototype.controller,
+                injector: JQLitePrototype.injector,
+                inheritedData: JQLitePrototype.inheritedData
+            });
+            // Method signature:
+            //     jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments)
+            jqLitePatchJQueryRemove('remove', true, true, false);
+            jqLitePatchJQueryRemove('empty', false, false, false);
+            jqLitePatchJQueryRemove('html', false, false, true);
+        } else {
+            jqLite = JQLite;
+        }
+        angular.element = jqLite;
+    }
+
+    /**
+     * throw error if the argument is falsy.
+     */
+    function assertArg(arg, name, reason) {
+        if (!arg) {
+            throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+        }
+        return arg;
+    }
+
+    function assertArgFn(arg, name, acceptArrayAnnotation) {
+        if (acceptArrayAnnotation && isArray(arg)) {
+            arg = arg[arg.length - 1];
+        }
+
+        assertArg(isFunction(arg), name, 'not a function, got ' +
+        (arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg));
+        return arg;
+    }
+
+    /**
+     * throw error if the name given is hasOwnProperty
+     * @param  {String} name    the name to test
+     * @param  {String} context the context in which the name is used, such as module or directive
+     */
+    function assertNotHasOwnProperty(name, context) {
+        if (name === 'hasOwnProperty') {
+            throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+        }
+    }
+
+    /**
+     * Return the value accessible from the object by path. Any undefined traversals are ignored
+     * @param {Object} obj starting object
+     * @param {String} path path to traverse
+     * @param {boolean} [bindFnToScope=true]
+     * @returns {Object} value as accessible by path
+     */
+//TODO(misko): this function needs to be removed
+    function getter(obj, path, bindFnToScope) {
+        if (!path) return obj;
+        var keys = path.split('.');
+        var key;
+        var lastInstance = obj;
+        var len = keys.length;
+
+        for (var i = 0; i < len; i++) {
+            key = keys[i];
+            if (obj) {
+                obj = (lastInstance = obj)[key];
+            }
+        }
+        if (!bindFnToScope && isFunction(obj)) {
+            return bind(lastInstance, obj);
+        }
+        return obj;
+    }
+
+    /**
+     * Return the DOM siblings between the first and last node in the given array.
+     * @param {Array} array like object
+     * @returns {DOMElement} object containing the elements
+     */
+    function getBlockElements(nodes) {
+        var startNode = nodes[0],
+            endNode = nodes[nodes.length - 1];
+        if (startNode === endNode) {
+            return jqLite(startNode);
+        }
+
+        var element = startNode;
+        var elements = [element];
+
+        do {
+            element = element.nextSibling;
+            if (!element) break;
+            elements.push(element);
+        } while (element !== endNode);
+
+        return jqLite(elements);
+    }
+
+    /**
+     * @ngdoc type
+     * @name angular.Module
+     * @module ng
+     * @description
+     *
+     * Interface for configuring angular {@link angular.module modules}.
+     */
+
+    function setupModuleLoader(window) {
+
+        var $injectorMinErr = minErr('$injector');
+        var ngMinErr = minErr('ng');
+
+        function ensure(obj, name, factory) {
+            return obj[name] || (obj[name] = factory());
+        }
+
+        var angular = ensure(window, 'angular', Object);
+
+        // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+        angular.$$minErr = angular.$$minErr || minErr;
+
+        return ensure(angular, 'module', function() {
+            /** @type {Object.<string, angular.Module>} */
+            var modules = {};
+
+            /**
+             * @ngdoc function
+             * @name angular.module
+             * @module ng
+             * @description
+             *
+             * The `angular.module` is a global place for creating, registering and retrieving Angular
+             * modules.
+             * All modules (angular core or 3rd party) that should be available to an application must be
+             * registered using this mechanism.
+             *
+             * When passed two or more arguments, a new module is created.  If passed only one argument, an
+             * existing module (the name passed as the first argument to `module`) is retrieved.
+             *
+             *
+             * # Module
+             *
+             * A module is a collection of services, directives, filters, and configuration information.
+             * `angular.module` is used to configure the {@link auto.$injector $injector}.
+             *
+             * ```js
+             * // Create a new module
+             * var myModule = angular.module('myModule', []);
+             *
+             * // register a new service
+             * myModule.value('appName', 'MyCoolApp');
+             *
+             * // configure existing services inside initialization blocks.
+             * myModule.config(['$locationProvider', function($locationProvider) {
+     *   // Configure existing providers
+     *   $locationProvider.hashPrefix('!');
+     * }]);
+             * ```
+             *
+             * Then you can create an injector and load your modules like this:
+             *
+             * ```js
+             * var injector = angular.injector(['ng', 'myModule'])
+             * ```
+             *
+             * However it's more likely that you'll just use
+             * {@link ng.directive:ngApp ngApp} or
+             * {@link angular.bootstrap} to simplify this process for you.
+             *
+             * @param {!string} name The name of the module to create or retrieve.
+             <<<<<* @param {!Array.<string>=} requires If specified then new module is being created. If
+             >>>>>*        unspecified then the module is being retrieved for further configuration.
+             * @param {Function} configFn Optional configuration function for the module. Same as
+             *        {@link angular.Module#config Module#config()}.
+             * @returns {module} new module with the {@link angular.Module} api.
+             */
+            return function module(name, requires, configFn) {
+                var assertNotHasOwnProperty = function(name, context) {
+                    if (name === 'hasOwnProperty') {
+                        throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+                    }
+                };
+
+                assertNotHasOwnProperty(name, 'module');
+                if (requires && modules.hasOwnProperty(name)) {
+                    modules[name] = null;
+                }
+                return ensure(modules, name, function() {
+                    if (!requires) {
+                        throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+                        "the module name or forgot to load it. If registering a module ensure that you " +
+                        "specify the dependencies as the second argument.", name);
+                    }
+
+                    /** @type {!Array.<Array.<*>>} */
+                    var invokeQueue = [];
+
+                    /** @type {!Array.<Function>} */
+                    var runBlocks = [];
+
+                    var config = invokeLater('$injector', 'invoke');
+
+                    /** @type {angular.Module} */
+                    var moduleInstance = {
+                        // Private state
+                        _invokeQueue: invokeQueue,
+                        _runBlocks: runBlocks,
+
+                        /**
+                         * @ngdoc property
+                         * @name angular.Module#requires
+                         * @module ng
+                         * @returns {Array.<string>} List of module names which must be loaded before this module.
+                         * @description
+                         * Holds the list of modules which the injector will load before the current module is
+                         * loaded.
+                         */
+                        requires: requires,
+
+                        /**
+                         * @ngdoc property
+                         * @name angular.Module#name
+                         * @module ng
+                         * @returns {string} Name of the module.
+                         * @description
+                         */
+                        name: name,
+
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#provider
+                         * @module ng
+                         * @param {string} name service name
+                         * @param {Function} providerType Construction function for creating new instance of the
+                         *                                service.
+                         * @description
+                         * See {@link auto.$provide#provider $provide.provider()}.
+                         */
+                        provider: invokeLater('$provide', 'provider'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#factory
+                         * @module ng
+                         * @param {string} name service name
+                         * @param {Function} providerFunction Function for creating new instance of the service.
+                         * @description
+                         * See {@link auto.$provide#factory $provide.factory()}.
+                         */
+                        factory: invokeLater('$provide', 'factory'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#service
+                         * @module ng
+                         * @param {string} name service name
+                         * @param {Function} constructor A constructor function that will be instantiated.
+                         * @description
+                         * See {@link auto.$provide#service $provide.service()}.
+                         */
+                        service: invokeLater('$provide', 'service'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#value
+                         * @module ng
+                         * @param {string} name service name
+                         * @param {*} object Service instance object.
+                         * @description
+                         * See {@link auto.$provide#value $provide.value()}.
+                         */
+                        value: invokeLater('$provide', 'value'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#constant
+                         * @module ng
+                         * @param {string} name constant name
+                         * @param {*} object Constant value.
+                         * @description
+                         * Because the constant are fixed, they get applied before other provide methods.
+                         * See {@link auto.$provide#constant $provide.constant()}.
+                         */
+                        constant: invokeLater('$provide', 'constant', 'unshift'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#animation
+                         * @module ng
+                         * @param {string} name animation name
+                         * @param {Function} animationFactory Factory function for creating new instance of an
+                         *                                    animation.
+                         * @description
+                         *
+                         * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+                         *
+                         *
+                         * Defines an animation hook that can be later used with
+                         * {@link ngAnimate.$animate $animate} service and directives that use this service.
+                         *
+                         * ```js
+                         * module.animation('.animation-name', function($inject1, $inject2) {
+           *   return {
+           *     eventName : function(element, done) {
+           *       //code to run the animation
+           *       //once complete, then run done()
+           *       return function cancellationFunction(element) {
+           *         //code to cancel the animation
+           *       }
+           *     }
+           *   }
+           * })
+                         * ```
+                         *
+                         * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
+                         * {@link ngAnimate ngAnimate module} for more information.
+                         */
+                        animation: invokeLater('$animateProvider', 'register'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#filter
+                         * @module ng
+                         * @param {string} name Filter name.
+                         * @param {Function} filterFactory Factory function for creating new instance of filter.
+                         * @description
+                         * See {@link ng.$filterProvider#register $filterProvider.register()}.
+                         */
+                        filter: invokeLater('$filterProvider', 'register'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#controller
+                         * @module ng
+                         * @param {string|Object} name Controller name, or an object map of controllers where the
+                         *    keys are the names and the values are the constructors.
+                         * @param {Function} constructor Controller constructor function.
+                         * @description
+                         * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+                         */
+                        controller: invokeLater('$controllerProvider', 'register'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#directive
+                         * @module ng
+                         * @param {string|Object} name Directive name, or an object map of directives where the
+                         *    keys are the names and the values are the factories.
+                         * @param {Function} directiveFactory Factory function for creating new instance of
+                         * directives.
+                         * @description
+                         * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+                         */
+                        directive: invokeLater('$compileProvider', 'directive'),
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#config
+                         * @module ng
+                         * @param {Function} configFn Execute this function on module load. Useful for service
+                         *    configuration.
+                         * @description
+                         * Use this method to register work which needs to be performed on module loading.
+                         */
+                        config: config,
+
+                        /**
+                         * @ngdoc method
+                         * @name angular.Module#run
+                         * @module ng
+                         * @param {Function} initializationFn Execute this function after injector creation.
+                         *    Useful for application initialization.
+                         * @description
+                         * Use this method to register work which should be performed when the injector is done
+                         * loading all modules.
+                         */
+                        run: function(block) {
+                            runBlocks.push(block);
+                            return this;
+                        }
+                    };
+
+                    if (configFn) {
+                        config(configFn);
+                    }
+
+                    return  moduleInstance;
+
+                    /**
+                     * @param {string} provider
+                     * @param {string} method
+                     * @param {String=} insertMethod
+                     * @returns {angular.Module}
+                     */
+                    function invokeLater(provider, method, insertMethod) {
+                        return function() {
+                            invokeQueue[insertMethod || 'push']([provider, method, arguments]);
+                            return moduleInstance;
+                        };
+                    }
+                });
+            };
+        });
+
+    }
+
+    /* global
+     angularModule: true,
+     version: true,
+
+     $LocaleProvider,
+     $CompileProvider,
+
+     htmlAnchorDirective,
+     inputDirective,
+     inputDirective,
+     formDirective,
+     scriptDirective,
+     selectDirective,
+     styleDirective,
+     optionDirective,
+     ngBindDirective,
+     ngBindHtmlDirective,
+     ngBindTemplateDirective,
+     ngClassDirective,
+     ngClassEvenDirective,
+     ngClassOddDirective,
+     ngCspDirective,
+     ngCloakDirective,
+     ngControllerDirective,
+     ngFormDirective,
+     ngHideDirective,
+     ngIfDirective,
+     ngIncludeDirective,
+     ngIncludeFillContentDirective,
+     ngInitDirective,
+     ngNonBindableDirective,
+     ngPluralizeDirective,
+     ngRepeatDirective,
+     ngShowDirective,
+     ngStyleDirective,
+     ngSwitchDirective,
+     ngSwitchWhenDirective,
+     ngSwitchDefaultDirective,
+     ngOptionsDirective,
+     ngTranscludeDirective,
+     ngModelDirective,
+     ngListDirective,
+     ngChangeDirective,
+     requiredDirective,
+     requiredDirective,
+     ngValueDirective,
+     ngAttributeAliasDirectives,
+     ngEventDirectives,
+
+     $AnchorScrollProvider,
+     $AnimateProvider,
+     $BrowserProvider,
+     $CacheFactoryProvider,
+     $ControllerProvider,
+     $DocumentProvider,
+     $ExceptionHandlerProvider,
+     $FilterProvider,
+     $InterpolateProvider,
+     $IntervalProvider,
+     $HttpProvider,
+     $HttpBackendProvider,
+     $LocationProvider,
+     $LogProvider,
+     $ParseProvider,
+     $RootScopeProvider,
+     $QProvider,
+     $$SanitizeUriProvider,
+     $SceProvider,
+     $SceDelegateProvider,
+     $SnifferProvider,
+     $TemplateCacheProvider,
+     $TimeoutProvider,
+     $$RAFProvider,
+     $$AsyncCallbackProvider,
+     $WindowProvider
+     */
+
+
+    /**
+     * @ngdoc object
+     * @name angular.version
+     * @module ng
+     * @description
+     * An object that contains information about the current AngularJS version. This object has the
+     * following properties:
+     *
+     * - `full` – `{string}` – Full version string, such as "0.9.18".
+     * - `major` – `{number}` – Major version number, such as "0".
+     * - `minor` – `{number}` – Minor version number, such as "9".
+     * - `dot` – `{number}` – Dot version number, such as "18".
+     * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
+     */
+    var version = {
+        full: '1.2.16',    // all of these placeholder strings will be replaced by grunt's
+        major: 1,    // package task
+        minor: 2,
+        dot: 16,
+        codeName: 'badger-enumeration'
+    };
+
+
+    function publishExternalAPI(angular){
+        extend(angular, {
+            'bootstrap': bootstrap,
+            'copy': copy,
+            'extend': extend,
+            'equals': equals,
+            'element': jqLite,
+            'forEach': forEach,
+            'injector': createInjector,
+            'noop':noop,
+            'bind':bind,
+            'toJson': toJson,
+            'fromJson': fromJson,
+            'identity':identity,
+            'isUndefined': isUndefined,
+            'isDefined': isDefined,
+            'isString': isString,
+            'isFunction': isFunction,
+            'isObject': isObject,
+            'isNumber': isNumber,
+            'isElement': isElement,
+            'isArray': isArray,
+            'version': version,
+            'isDate': isDate,
+            'lowercase': lowercase,
+            'uppercase': uppercase,
+            'callbacks': {counter: 0},
+            '$$minErr': minErr,
+            '$$csp': csp
+        });
+
+        angularModule = setupModuleLoader(window);
+        try {
+            angularModule('ngLocale');
+        } catch (e) {
+            angularModule('ngLocale', []).provider('$locale', $LocaleProvider);
+        }
+
+        angularModule('ng', ['ngLocale'], ['$provide',
+            function ngModule($provide) {
+                // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
+                $provide.provider({
+                    $$sanitizeUri: $$SanitizeUriProvider
+                });
+                $provide.provider('$compile', $CompileProvider).
+                    directive({
+                        a: htmlAnchorDirective,
+                        input: inputDirective,
+                        textarea: inputDirective,
+                        form: formDirective,
+                        script: scriptDirective,
+                        select: selectDirective,
+                        style: styleDirective,
+                        option: optionDirective,
+                        ngBind: ngBindDirective,
+                        ngBindHtml: ngBindHtmlDirective,
+                        ngBindTemplate: ngBindTemplateDirective,
+                        ngClass: ngClassDirective,
+                        ngClassEven: ngClassEvenDirective,
+                        ngClassOdd: ngClassOddDirective,
+                        ngCloak: ngCloakDirective,
+                        ngController: ngControllerDirective,
+                        ngForm: ngFormDirective,
+                        ngHide: ngHideDirective,
+                        ngIf: ngIfDirective,
+                        ngInclude: ngIncludeDirective,
+                        ngInit: ngInitDirective,
+                        ngNonBindable: ngNonBindableDirective,
+                        ngPluralize: ngPluralizeDirective,
+                        ngRepeat: ngRepeatDirective,
+                        ngShow: ngShowDirective,
+                        ngStyle: ngStyleDirective,
+                        ngSwitch: ngSwitchDirective,
+                        ngSwitchWhen: ngSwitchWhenDirective,
+                        ngSwitchDefault: ngSwitchDefaultDirective,
+                        ngOptions: ngOptionsDirective,
+                        ngTransclude: ngTranscludeDirective,
+                        ngModel: ngModelDirective,
+                        ngList: ngListDirective,
+                        ngChange: ngChangeDirective,
+                        required: requiredDirective,
+                        ngRequired: requiredDirective,
+                        ngValue: ngValueDirective
+                    }).
+                    directive({
+                        ngInclude: ngIncludeFillContentDirective
+                    }).
+                    directive(ngAttributeAliasDirectives).
+                    directive(ngEventDirectives);
+                $provide.provider({
+                    $anchorScroll: $AnchorScrollProvider,
+                    $animate: $AnimateProvider,
+                    $browser: $BrowserProvider,
+                    $cacheFactory: $CacheFactoryProvider,
+                    $controller: $ControllerProvider,
+                    $document: $DocumentProvider,
+                    $exceptionHandler: $ExceptionHandlerProvider,
+                    $filter: $FilterProvider,
+                    $interpolate: $InterpolateProvider,
+                    $interval: $IntervalProvider,
+                    $http: $HttpProvider,
+                    $httpBackend: $HttpBackendProvider,
+                    $location: $LocationProvider,
+                    $log: $LogProvider,
+                    $parse: $ParseProvider,
+                    $rootScope: $RootScopeProvider,
+                    $q: $QProvider,
+                    $sce: $SceProvider,
+                    $sceDelegate: $SceDelegateProvider,
+                    $sniffer: $SnifferProvider,
+                    $templateCache: $TemplateCacheProvider,
+                    $timeout: $TimeoutProvider,
+                    $window: $WindowProvider,
+                    $$rAF: $$RAFProvider,
+                    $$asyncCallback : $$AsyncCallbackProvider
+                });
+            }
+        ]);
+    }
+
+    /* global
+
+     -JQLitePrototype,
+     -addEventListenerFn,
+     -removeEventListenerFn,
+     -BOOLEAN_ATTR
+     */
+
+//////////////////////////////////
+//JQLite
+//////////////////////////////////
+
+    /**
+     * @ngdoc function
+     * @name angular.element
+     * @module ng
+     * @function
+     *
+     * @description
+     * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
+     *
+     * If jQuery is available, `angular.element` is an alias for the
+     * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`
+     * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
+     *
+     * <div class="alert alert-success">jqLite is a tiny, API-compatible subset of jQuery that allows
+     * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most
+     * commonly needed functionality with the goal of having a very small footprint.</div>
+     *
+     * To use jQuery, simply load it before `DOMContentLoaded` event fired.
+     *
+     * <div class="alert">**Note:** all element references in Angular are always wrapped with jQuery or
+     * jqLite; they are never raw DOM references.</div>
+     *
+     * ## Angular's jqLite
+     * jqLite provides only the following jQuery methods:
+     *
+     * - [`addClass()`](http://api.jquery.com/addClass/)
+     * - [`after()`](http://api.jquery.com/after/)
+     * - [`append()`](http://api.jquery.com/append/)
+     * - [`attr()`](http://api.jquery.com/attr/)
+     * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+     * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
+     * - [`clone()`](http://api.jquery.com/clone/)
+     * - [`contents()`](http://api.jquery.com/contents/)
+     * - [`css()`](http://api.jquery.com/css/)
+     * - [`data()`](http://api.jquery.com/data/)
+     * - [`empty()`](http://api.jquery.com/empty/)
+     * - [`eq()`](http://api.jquery.com/eq/)
+     * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
+     * - [`hasClass()`](http://api.jquery.com/hasClass/)
+     * - [`html()`](http://api.jquery.com/html/)
+     * - [`next()`](http://api.jquery.com/next/) - Does not support selectors
+     * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
+     * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors
+     * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
+     * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
+     * - [`prepend()`](http://api.jquery.com/prepend/)
+     * - [`prop()`](http://api.jquery.com/prop/)
+     * - [`ready()`](http://api.jquery.com/ready/)
+     * - [`remove()`](http://api.jquery.com/remove/)
+     * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+     * - [`removeClass()`](http://api.jquery.com/removeClass/)
+     * - [`removeData()`](http://api.jquery.com/removeData/)
+     * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
+     * - [`text()`](http://api.jquery.com/text/)
+     * - [`toggleClass()`](http://api.jquery.com/toggleClass/)
+     * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
+     * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces
+     * - [`val()`](http://api.jquery.com/val/)
+     * - [`wrap()`](http://api.jquery.com/wrap/)
+     *
+     * ## jQuery/jqLite Extras
+     * Angular also provides the following additional methods and events to both jQuery and jqLite:
+     *
+     * ### Events
+     * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
+     *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM
+     *    element before it is removed.
+     *
+     * ### Methods
+     * - `controller(name)` - retrieves the controller of the current element or its parent. By default
+     *   retrieves controller associated with the `ngController` directive. If `name` is provided as
+     *   camelCase directive name, then the controller for this directive will be retrieved (e.g.
+     *   `'ngModel'`).
+     * - `injector()` - retrieves the injector of the current element or its parent.
+     * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
+     *   element or its parent.
+     * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
+     *   current element. This getter should be used only on elements that contain a directive which starts a new isolate
+     *   scope. Calling `scope()` on this element always returns the original non-isolate scope.
+     * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
+     *   parent element is reached.
+     *
+     * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
+     * @returns {Object} jQuery object.
+     */
+
+    var jqCache = JQLite.cache = {},
+        jqName = JQLite.expando = 'ng-' + new Date().getTime(),
+        jqId = 1,
+        addEventListenerFn = (window.document.addEventListener
+            ? function(element, type, fn) {element.addEventListener(type, fn, false);}
+            : function(element, type, fn) {element.attachEvent('on' + type, fn);}),
+        removeEventListenerFn = (window.document.removeEventListener
+            ? function(element, type, fn) {element.removeEventListener(type, fn, false); }
+            : function(element, type, fn) {element.detachEvent('on' + type, fn); });
+
+    /*
+     * !!! This is an undocumented "private" function !!!
+     */
+    var jqData = JQLite._data = function(node) {
+        //jQuery always returns an object on cache miss
+        return this.cache[node[this.expando]] || {};
+    };
+
+    function jqNextId() { return ++jqId; }
+
+
+    var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+    var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+    var jqLiteMinErr = minErr('jqLite');
+
+    /**
+     * Converts snake_case to camelCase.
+     * Also there is special case for Moz prefix starting with upper case letter.
+     * @param name Name to normalize
+     */
+    function camelCase(name) {
+        return name.
+            replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+                return offset ? letter.toUpperCase() : letter;
+            }).
+            replace(MOZ_HACK_REGEXP, 'Moz$1');
+    }
+
+/////////////////////////////////////////////
+// jQuery mutation patch
+//
+// In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a
+// $destroy event on all DOM nodes being removed.
+//
+/////////////////////////////////////////////
+
+    function jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArguments) {
+        var originalJqFn = jQuery.fn[name];
+        originalJqFn = originalJqFn.$original || originalJqFn;
+        removePatch.$original = originalJqFn;
+        jQuery.fn[name] = removePatch;
+
+        function removePatch(param) {
+            // jshint -W040
+            var list = filterElems && param ? [this.filter(param)] : [this],
+                fireEvent = dispatchThis,
+                set, setIndex, setLength,
+                element, childIndex, childLength, children;
+
+            if (!getterIfNoArguments || param != null) {
+                while(list.length) {
+                    set = list.shift();
+                    for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {
+                        element = jqLite(set[setIndex]);
+                        if (fireEvent) {
+                            element.triggerHandler('$destroy');
+                        } else {
+                            fireEvent = !fireEvent;
+                        }
+                        for(childIndex = 0, childLength = (children = element.children()).length;
+                            childIndex < childLength;
+                            childIndex++) {
+                            list.push(jQuery(children[childIndex]));
+                        }
+                    }
+                }
+            }
+            return originalJqFn.apply(this, arguments);
+        }
+    }
+
+    var SINGLE_TAG_REGEXP = /^<(\w+)\s*\/?>(?:<\/\1>|)$/;
+    var HTML_REGEXP = /<|&#?\w+;/;
+    var TAG_NAME_REGEXP = /<([\w:]+)/;
+    var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;
+
+    var wrapMap = {
+        '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, "", ""]
+    };
+
+    wrapMap.optgroup = wrapMap.option;
+    wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+    wrapMap.th = wrapMap.td;
+
+    function jqLiteIsTextNode(html) {
+        return !HTML_REGEXP.test(html);
+    }
+
+    function jqLiteBuildFragment(html, context) {
+        var elem, tmp, tag, wrap,
+            fragment = context.createDocumentFragment(),
+            nodes = [], i, j, jj;
+
+        if (jqLiteIsTextNode(html)) {
+            // Convert non-html into a text node
+            nodes.push(context.createTextNode(html));
+        } else {
+            tmp = fragment.appendChild(context.createElement('div'));
+            // Convert html into DOM nodes
+            tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
+            wrap = wrapMap[tag] || wrapMap._default;
+            tmp.innerHTML = '<div>&#160;</div>' +
+            wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
+            tmp.removeChild(tmp.firstChild);
+
+            // Descend through wrappers to the right content
+            i = wrap[0];
+            while (i--) {
+                tmp = tmp.lastChild;
+            }
+
+            for (j=0, jj=tmp.childNodes.length; j<jj; ++j) nodes.push(tmp.childNodes[j]);
+
+            tmp = fragment.firstChild;
+            tmp.textContent = "";
+        }
+
+        // Remove wrapper from fragment
+        fragment.textContent = "";
+        fragment.innerHTML = ""; // Clear inner HTML
+        return nodes;
+    }
+
+    function jqLiteParseHTML(html, context) {
+        context = context || document;
+        var parsed;
+
+        if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
+            return [context.createElement(parsed[1])];
+        }
+
+        return jqLiteBuildFragment(html, context);
+    }
+
+/////////////////////////////////////////////
+    function JQLite(element) {
+        if (element instanceof JQLite) {
+            return element;
+        }
+        if (isString(element)) {
+            element = trim(element);
+        }
+        if (!(this instanceof JQLite)) {
+            if (isString(element) && element.charAt(0) != '<') {
+                throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
+            }
+            return new JQLite(element);
+        }
+
+        if (isString(element)) {
+            jqLiteAddNodes(this, jqLiteParseHTML(element));
+            var fragment = jqLite(document.createDocumentFragment());
+            fragment.append(this);
+        } else {
+            jqLiteAddNodes(this, element);
+        }
+    }
+
+    function jqLiteClone(element) {
+        return element.cloneNode(true);
+    }
+
+    function jqLiteDealoc(element){
+        jqLiteRemoveData(element);
+        for ( var i = 0, children = element.childNodes || []; i < children.length; i++) {
+            jqLiteDealoc(children[i]);
+        }
+    }
+
+    function jqLiteOff(element, type, fn, unsupported) {
+        if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
+
+        var events = jqLiteExpandoStore(element, 'events'),
+            handle = jqLiteExpandoStore(element, 'handle');
+
+        if (!handle) return; //no listeners registered
+
+        if (isUndefined(type)) {
+            forEach(events, function(eventHandler, type) {
+                removeEventListenerFn(element, type, eventHandler);
+                delete events[type];
+            });
+        } else {
+            forEach(type.split(' '), function(type) {
+                if (isUndefined(fn)) {
+                    removeEventListenerFn(element, type, events[type]);
+                    delete events[type];
+                } else {
+                    arrayRemove(events[type] || [], fn);
+                }
+            });
+        }
+    }
+
+    function jqLiteRemoveData(element, name) {
+        var expandoId = element[jqName],
+            expandoStore = jqCache[expandoId];
+
+        if (expandoStore) {
+            if (name) {
+                delete jqCache[expandoId].data[name];
+                return;
+            }
+
+            if (expandoStore.handle) {
+                expandoStore.events.$destroy && expandoStore.handle({}, '$destroy');
+                jqLiteOff(element);
+            }
+            delete jqCache[expandoId];
+            element[jqName] = undefined; // ie does not allow deletion of attributes on elements.
+        }
+    }
+
+    function jqLiteExpandoStore(element, key, value) {
+        var expandoId = element[jqName],
+            expandoStore = jqCache[expandoId || -1];
+
+        if (isDefined(value)) {
+            if (!expandoStore) {
+                element[jqName] = expandoId = jqNextId();
+                expandoStore = jqCache[expandoId] = {};
+            }
+            expandoStore[key] = value;
+        } else {
+            return expandoStore && expandoStore[key];
+        }
+    }
+
+    function jqLiteData(element, key, value) {
+        var data = jqLiteExpandoStore(element, 'data'),
+            isSetter = isDefined(value),
+            keyDefined = !isSetter && isDefined(key),
+            isSimpleGetter = keyDefined && !isObject(key);
+
+        if (!data && !isSimpleGetter) {
+            jqLiteExpandoStore(element, 'data', data = {});
+        }
+
+        if (isSetter) {
+            data[key] = value;
+        } else {
+            if (keyDefined) {
+                if (isSimpleGetter) {
+                    // don't create data in this case.
+                    return data && data[key];
+                } else {
+                    extend(data, key);
+                }
+            } else {
+                return data;
+            }
+        }
+    }
+
+    function jqLiteHasClass(element, selector) {
+        if (!element.getAttribute) return false;
+        return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+            indexOf( " " + selector + " " ) > -1);
+    }
+
+    function jqLiteRemoveClass(element, cssClasses) {
+        if (cssClasses && element.setAttribute) {
+            forEach(cssClasses.split(' '), function(cssClass) {
+                element.setAttribute('class', trim(
+                        (" " + (element.getAttribute('class') || '') + " ")
+                            .replace(/[\n\t]/g, " ")
+                            .replace(" " + trim(cssClass) + " ", " "))
+                );
+            });
+        }
+    }
+
+    function jqLiteAddClass(element, cssClasses) {
+        if (cssClasses && element.setAttribute) {
+            var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
+                .replace(/[\n\t]/g, " ");
+
+            forEach(cssClasses.split(' '), function(cssClass) {
+                cssClass = trim(cssClass);
+                if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
+                    existingClasses += cssClass + ' ';
+                }
+            });
+
+            element.setAttribute('class', trim(existingClasses));
+        }
+    }
+
+    function jqLiteAddNodes(root, elements) {
+        if (elements) {
+            elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements))
+                ? elements
+                : [ elements ];
+            for(var i=0; i < elements.length; i++) {
+                root.push(elements[i]);
+            }
+        }
+    }
+
+    function jqLiteController(element, name) {
+        return jqLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller');
+    }
+
+    function jqLiteInheritedData(element, name, value) {
+        element = jqLite(element);
+
+        // if element is the document object work with the html element instead
+        // this makes $(document).scope() possible
+        if(element[0].nodeType == 9) {
+            element = element.find('html');
+        }
+        var names = isArray(name) ? name : [name];
+
+        while (element.length) {
+            var node = element[0];
+            for (var i = 0, ii = names.length; i < ii; i++) {
+                if ((value = element.data(names[i])) !== undefined) return value;
+            }
+
+            // If dealing with a document fragment node with a host element, and no parent, use the host
+            // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+            // to lookup parent controllers.
+            element = jqLite(node.parentNode || (node.nodeType === 11 && node.host));
+        }
+    }
+
+    function jqLiteEmpty(element) {
+        for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
+            jqLiteDealoc(childNodes[i]);
+        }
+        while (element.firstChild) {
+            element.removeChild(element.firstChild);
+        }
+    }
+
+//////////////////////////////////////////
+// Functions which are declared directly.
+//////////////////////////////////////////
+    var JQLitePrototype = JQLite.prototype = {
+        ready: function(fn) {
+            var fired = false;
+
+            function trigger() {
+                if (fired) return;
+                fired = true;
+                fn();
+            }
+
+            // check if document already is loaded
+            if (document.readyState === 'complete'){
+                setTimeout(trigger);
+            } else {
+                this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+                // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+                // jshint -W064
+                JQLite(window).on('load', trigger); // fallback to window.onload for others
+                // jshint +W064
+            }
+        },
+        toString: function() {
+            var value = [];
+            forEach(this, function(e){ value.push('' + e);});
+            return '[' + value.join(', ') + ']';
+        },
+
+        eq: function(index) {
+            return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
+        },
+
+        length: 0,
+        push: push,
+        sort: [].sort,
+        splice: [].splice
+    };
+
+//////////////////////////////////////////
+// Functions iterating getter/setters.
+// these functions return self on setter and
+// value on get.
+//////////////////////////////////////////
+    var BOOLEAN_ATTR = {};
+    forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
+        BOOLEAN_ATTR[lowercase(value)] = value;
+    });
+    var BOOLEAN_ELEMENTS = {};
+    forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
+        BOOLEAN_ELEMENTS[uppercase(value)] = true;
+    });
+
+    function getBooleanAttrName(element, name) {
+        // check dom last since we will most likely fail on name
+        var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
+
+        // booleanAttr is here twice to minimize DOM access
+        return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;
+    }
+
+    forEach({
+        data: jqLiteData,
+        inheritedData: jqLiteInheritedData,
+
+        scope: function(element) {
+            // Can't use jqLiteData here directly so we stay compatible with jQuery!
+            return jqLite(element).data('$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
+        },
+
+        isolateScope: function(element) {
+            // Can't use jqLiteData here directly so we stay compatible with jQuery!
+            return jqLite(element).data('$isolateScope') || jqLite(element).data('$isolateScopeNoTemplate');
+        },
+
+        controller: jqLiteController,
+
+        injector: function(element) {
+            return jqLiteInheritedData(element, '$injector');
+        },
+
+        removeAttr: function(element,name) {
+            element.removeAttribute(name);
+        },
+
+        hasClass: jqLiteHasClass,
+
+        css: function(element, name, value) {
+            name = camelCase(name);
+
+            if (isDefined(value)) {
+                element.style[name] = value;
+            } else {
+                var val;
+
+                if (msie <= 8) {
+                    // this is some IE specific weirdness that jQuery 1.6.4 does not sure why
+                    val = element.currentStyle && element.currentStyle[name];
+                    if (val === '') val = 'auto';
+                }
+
+                val = val || element.style[name];
+
+                if (msie <= 8) {
+                    // jquery weirdness :-/
+                    val = (val === '') ? undefined : val;
+                }
+
+                return  val;
+            }
+        },
+
+        attr: function(element, name, value){
+            var lowercasedName = lowercase(name);
+            if (BOOLEAN_ATTR[lowercasedName]) {
+                if (isDefined(value)) {
+                    if (!!value) {
+                        element[name] = true;
+                        element.setAttribute(name, lowercasedName);
+                    } else {
+                        element[name] = false;
+                        element.removeAttribute(lowercasedName);
+                    }
+                } else {
+                    return (element[name] ||
+                    (element.attributes.getNamedItem(name)|| noop).specified)
+                        ? lowercasedName
+                        : undefined;
+                }
+            } else if (isDefined(value)) {
+                element.setAttribute(name, value);
+            } else if (element.getAttribute) {
+                // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+                // some elements (e.g. Document) don't have get attribute, so return undefined
+                var ret = element.getAttribute(name, 2);
+                // normalize non-existing attributes to undefined (as jQuery)
+                return ret === null ? undefined : ret;
+            }
+        },
+
+        prop: function(element, name, value) {
+            if (isDefined(value)) {
+                element[name] = value;
+            } else {
+                return element[name];
+            }
+        },
+
+        text: (function() {
+            var NODE_TYPE_TEXT_PROPERTY = [];
+            if (msie < 9) {
+                NODE_TYPE_TEXT_PROPERTY[1] = 'innerText';    /** Element **/
+                NODE_TYPE_TEXT_PROPERTY[3] = 'nodeValue';    /** Text **/
+            } else {
+                NODE_TYPE_TEXT_PROPERTY[1] =                 /** Element **/
+                    NODE_TYPE_TEXT_PROPERTY[3] = 'textContent';  /** Text **/
+            }
+            getText.$dv = '';
+            return getText;
+
+            function getText(element, value) {
+                var textProp = NODE_TYPE_TEXT_PROPERTY[element.nodeType];
+                if (isUndefined(value)) {
+                    return textProp ? element[textProp] : '';
+                }
+                element[textProp] = value;
+            }
+        })(),
+
+        val: function(element, value) {
+            if (isUndefined(value)) {
+                if (nodeName_(element) === 'SELECT' && element.multiple) {
+                    var result = [];
+                    forEach(element.options, function (option) {
+                        if (option.selected) {
+                            result.push(option.value || option.text);
+                        }
+                    });
+                    return result.length === 0 ? null : result;
+                }
+                return element.value;
+            }
+            element.value = value;
+        },
+
+        html: function(element, value) {
+            if (isUndefined(value)) {
+                return element.innerHTML;
+            }
+            for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
+                jqLiteDealoc(childNodes[i]);
+            }
+            element.innerHTML = value;
+        },
+
+        empty: jqLiteEmpty
+    }, function(fn, name){
+        /**
+         * Properties: writes return selection, reads return first value
+         */
+        JQLite.prototype[name] = function(arg1, arg2) {
+            var i, key;
+
+            // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+            // in a way that survives minification.
+            // jqLiteEmpty takes no arguments but is a setter.
+            if (fn !== jqLiteEmpty &&
+                (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) {
+                if (isObject(arg1)) {
+
+                    // we are a write, but the object properties are the key/values
+                    for (i = 0; i < this.length; i++) {
+                        if (fn === jqLiteData) {
+                            // data() takes the whole object in jQuery
+                            fn(this[i], arg1);
+                        } else {
+                            for (key in arg1) {
+                                fn(this[i], key, arg1[key]);
+                            }
+                        }
+                    }
+                    // return self for chaining
+                    return this;
+                } else {
+                    // we are a read, so read the first child.
+                    var value = fn.$dv;
+                    // Only if we have $dv do we iterate over all, otherwise it is just the first element.
+                    var jj = (value === undefined) ? Math.min(this.length, 1) : this.length;
+                    for (var j = 0; j < jj; j++) {
+                        var nodeValue = fn(this[j], arg1, arg2);
+                        value = value ? value + nodeValue : nodeValue;
+                    }
+                    return value;
+                }
+            } else {
+                // we are a write, so apply to all children
+                for (i = 0; i < this.length; i++) {
+                    fn(this[i], arg1, arg2);
+                }
+                // return self for chaining
+                return this;
+            }
+        };
+    });
+
+    function createEventHandler(element, events) {
+        var eventHandler = function (event, type) {
+            if (!event.preventDefault) {
+                event.preventDefault = function() {
+                    event.returnValue = false; //ie
+                };
+            }
+
+            if (!event.stopPropagation) {
+                event.stopPropagation = function() {
+                    event.cancelBubble = true; //ie
+                };
+            }
+
+            if (!event.target) {
+                event.target = event.srcElement || document;
+            }
+
+            if (isUndefined(event.defaultPrevented)) {
+                var prevent = event.preventDefault;
+                event.preventDefault = function() {
+                    event.defaultPrevented = true;
+                    prevent.call(event);
+                };
+                event.defaultPrevented = false;
+            }
+
+            event.isDefaultPrevented = function() {
+                return event.defaultPrevented || event.returnValue === false;
+            };
+
+            // Copy event handlers in case event handlers array is modified during execution.
+            var eventHandlersCopy = shallowCopy(events[type || event.type] || []);
+
+            forEach(eventHandlersCopy, function(fn) {
+                fn.call(element, event);
+            });
+
+            // Remove monkey-patched methods (IE),
+            // as they would cause memory leaks in IE8.
+            if (msie <= 8) {
+                // IE7/8 does not allow to delete property on native object
+                event.preventDefault = null;
+                event.stopPropagation = null;
+                event.isDefaultPrevented = null;
+            } else {
+                // It shouldn't affect normal browsers (native methods are defined on prototype).
+                delete event.preventDefault;
+                delete event.stopPropagation;
+                delete event.isDefaultPrevented;
+            }
+        };
+        eventHandler.elem = element;
+        return eventHandler;
+    }
+
+//////////////////////////////////////////
+// Functions iterating traversal.
+// These functions chain results into a single
+// selector.
+//////////////////////////////////////////
+    forEach({
+        removeData: jqLiteRemoveData,
+
+        dealoc: jqLiteDealoc,
+
+        on: function onFn(element, type, fn, unsupported){
+            if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
+
+            var events = jqLiteExpandoStore(element, 'events'),
+                handle = jqLiteExpandoStore(element, 'handle');
+
+            if (!events) jqLiteExpandoStore(element, 'events', events = {});
+            if (!handle) jqLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));
+
+            forEach(type.split(' '), function(type){
+                var eventFns = events[type];
+
+                if (!eventFns) {
+                    if (type == 'mouseenter' || type == 'mouseleave') {
+                        var contains = document.body.contains || document.body.compareDocumentPosition ?
+                            function( a, b ) {
+                                // jshint bitwise: false
+                                var adown = a.nodeType === 9 ? a.documentElement : a,
+                                    bup = b && b.parentNode;
+                                return a === bup || !!( bup && bup.nodeType === 1 && (
+                                    adown.contains ?
+                                        adown.contains( bup ) :
+                                    a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+                                ));
+                            } :
+                            function( a, b ) {
+                                if ( b ) {
+                                    while ( (b = b.parentNode) ) {
+                                        if ( b === a ) {
+                                            return true;
+                                        }
+                                    }
+                                }
+                                return false;
+                            };
+
+                        events[type] = [];
+
+                        // Refer to jQuery's implementation of mouseenter & mouseleave
+                        // Read about mouseenter and mouseleave:
+                        // http://www.quirksmode.org/js/events_mouse.html#link8
+                        var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"};
+
+                        onFn(element, eventmap[type], function(event) {
+                            var target = this, related = event.relatedTarget;
+                            // For mousenter/leave call the handler if related is outside the target.
+                            // NB: No relatedTarget if the mouse left/entered the browser window
+                            if ( !related || (related !== target && !contains(target, related)) ){
+                                handle(event, type);
+                            }
+                        });
+
+                    } else {
+                        addEventListenerFn(element, type, handle);
+                        events[type] = [];
+                    }
+                    eventFns = events[type];
+                }
+                eventFns.push(fn);
+            });
+        },
+
+        off: jqLiteOff,
+
+        one: function(element, type, fn) {
+            element = jqLite(element);
+
+            //add the listener twice so that when it is called
+            //you can remove the original function and still be
+            //able to call element.off(ev, fn) normally
+            element.on(type, function onFn() {
+                element.off(type, fn);
+                element.off(type, onFn);
+            });
+            element.on(type, fn);
+        },
+
+        replaceWith: function(element, replaceNode) {
+            var index, parent = element.parentNode;
+            jqLiteDealoc(element);
+            forEach(new JQLite(replaceNode), function(node){
+                if (index) {
+                    parent.insertBefore(node, index.nextSibling);
+                } else {
+                    parent.replaceChild(node, element);
+                }
+                index = node;
+            });
+        },
+
+        children: function(element) {
+            var children = [];
+            forEach(element.childNodes, function(element){
+                if (element.nodeType === 1)
+                    children.push(element);
+            });
+            return children;
+        },
+
+        contents: function(element) {
+            return element.contentDocument || element.childNodes || [];
+        },
+
+        append: function(element, node) {
+            forEach(new JQLite(node), function(child){
+                if (element.nodeType === 1 || element.nodeType === 11) {
+                    element.appendChild(child);
+                }
+            });
+        },
+
+        prepend: function(element, node) {
+            if (element.nodeType === 1) {
+                var index = element.firstChild;
+                forEach(new JQLite(node), function(child){
+                    element.insertBefore(child, index);
+                });
+            }
+        },
+
+        wrap: function(element, wrapNode) {
+            wrapNode = jqLite(wrapNode)[0];
+            var parent = element.parentNode;
+            if (parent) {
+                parent.replaceChild(wrapNode, element);
+            }
+            wrapNode.appendChild(element);
+        },
+
+        remove: function(element) {
+            jqLiteDealoc(element);
+            var parent = element.parentNode;
+            if (parent) parent.removeChild(element);
+        },
+
+        after: function(element, newElement) {
+            var index = element, parent = element.parentNode;
+            forEach(new JQLite(newElement), function(node){
+                parent.insertBefore(node, index.nextSibling);
+                index = node;
+            });
+        },
+
+        addClass: jqLiteAddClass,
+        removeClass: jqLiteRemoveClass,
+
+        toggleClass: function(element, selector, condition) {
+            if (selector) {
+                forEach(selector.split(' '), function(className){
+                    var classCondition = condition;
+                    if (isUndefined(classCondition)) {
+                        classCondition = !jqLiteHasClass(element, className);
+                    }
+                    (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
+                });
+            }
+        },
+
+        parent: function(element) {
+            var parent = element.parentNode;
+            return parent && parent.nodeType !== 11 ? parent : null;
+        },
+
+        next: function(element) {
+            if (element.nextElementSibling) {
+                return element.nextElementSibling;
+            }
+
+            // IE8 doesn't have nextElementSibling
+            var elm = element.nextSibling;
+            while (elm != null && elm.nodeType !== 1) {
+                elm = elm.nextSibling;
+            }
+            return elm;
+        },
+
+        find: function(element, selector) {
+            if (element.getElementsByTagName) {
+                return element.getElementsByTagName(selector);
+            } else {
+                return [];
+            }
+        },
+
+        clone: jqLiteClone,
+
+        triggerHandler: function(element, eventName, eventData) {
+            var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName];
+
+            eventData = eventData || [];
+
+            var event = [{
+                preventDefault: noop,
+                stopPropagation: noop
+            }];
+
+            forEach(eventFns, function(fn) {
+                fn.apply(element, event.concat(eventData));
+            });
+        }
+    }, function(fn, name){
+        /**
+         * chaining functions
+         */
+        JQLite.prototype[name] = function(arg1, arg2, arg3) {
+            var value;
+            for(var i=0; i < this.length; i++) {
+                if (isUndefined(value)) {
+                    value = fn(this[i], arg1, arg2, arg3);
+                    if (isDefined(value)) {
+                        // any function which returns a value needs to be wrapped
+                        value = jqLite(value);
+                    }
+                } else {
+                    jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
+                }
+            }
+            return isDefined(value) ? value : this;
+        };
+
+        // bind legacy bind/unbind to on/off
+        JQLite.prototype.bind = JQLite.prototype.on;
+        JQLite.prototype.unbind = JQLite.prototype.off;
+    });
+
+    /**
+     * Computes a hash of an 'obj'.
+     * Hash of a:
+     *  string is string
+     *  number is number as string
+     *  object is either result of calling $$hashKey function on the object or uniquely generated id,
+     *         that is also assigned to the $$hashKey property of the object.
+     *
+     * @param obj
+     * @returns {string} hash string such that the same input will have the same hash string.
+     *         The resulting string key is in 'type:hashKey' format.
+     */
+    function hashKey(obj) {
+        var objType = typeof obj,
+            key;
+
+        if (objType == 'object' && obj !== null) {
+            if (typeof (key = obj.$$hashKey) == 'function') {
+                // must invoke on object to keep the right this
+                key = obj.$$hashKey();
+            } else if (key === undefined) {
+                key = obj.$$hashKey = nextUid();
+            }
+        } else {
+            key = obj;
+        }
+
+        return objType + ':' + key;
+    }
+
+    /**
+     * HashMap which can use objects as keys
+     */
+    function HashMap(array){
+        forEach(array, this.put, this);
+    }
+    HashMap.prototype = {
+        /**
+         * Store key value pair
+         * @param key key to store can be any type
+         * @param value value to store can be any type
+         */
+        put: function(key, value) {
+            this[hashKey(key)] = value;
+        },
+
+        /**
+         * @param key
+         * @returns {Object} the value for the key
+         */
+        get: function(key) {
+            return this[hashKey(key)];
+        },
+
+        /**
+         * Remove the key/value pair
+         * @param key
+         */
+        remove: function(key) {
+            var value = this[key = hashKey(key)];
+            delete this[key];
+            return value;
+        }
+    };
+
+    /**
+     * @ngdoc function
+     * @module ng
+     * @name angular.injector
+     * @function
+     *
+     * @description
+     * Creates an injector function that can be used for retrieving services as well as for
+     * dependency injection (see {@link guide/di dependency injection}).
+     *
+
+     * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
+     *        {@link angular.module}. The `ng` module must be explicitly added.
+     * @returns {function()} Injector function. See {@link auto.$injector $injector}.
+     *
+     * @example
+     * Typical usage
+     * ```js
+     *   // create an injector
+     *   var $injector = angular.injector(['ng']);
+     *
+     *   // use the injector to kick off your application
+     *   // use the type inference to auto inject arguments, or use implicit injection
+     *   $injector.invoke(function($rootScope, $compile, $document){
+ *     $compile($document)($rootScope);
+ *     $rootScope.$digest();
+ *   });
+     * ```
+     *
+     * Sometimes you want to get access to the injector of a currently running Angular app
+     * from outside Angular. Perhaps, you want to inject and compile some markup after the
+     * application has been bootstrapped. You can do this using extra `injector()` added
+     * to JQuery/jqLite elements. See {@link angular.element}.
+     *
+     * *This is fairly rare but could be the case if a third party library is injecting the
+     * markup.*
+     *
+     * In the following example a new block of HTML containing a `ng-controller`
+     * directive is added to the end of the document body by JQuery. We then compile and link
+     * it into the current AngularJS scope.
+     *
+     * ```js
+     * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
+     * $(document.body).append($div);
+     *
+     * angular.element(document).injector().invoke(function($compile) {
+ *   var scope = angular.element($div).scope();
+ *   $compile($div)(scope);
+ * });
+     * ```
+     */
+
+
+    /**
+     * @ngdoc module
+     * @name auto
+     * @description
+     *
+     * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
+     */
+
+    var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
+    var FN_ARG_SPLIT = /,/;
+    var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
+    var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+    var $injectorMinErr = minErr('$injector');
+    function annotate(fn) {
+        var $inject,
+            fnText,
+            argDecl,
+            last;
+
+        if (typeof fn == 'function') {
+            if (!($inject = fn.$inject)) {
+                $inject = [];
+                if (fn.length) {
+                    fnText = fn.toString().replace(STRIP_COMMENTS, '');
+                    argDecl = fnText.match(FN_ARGS);
+                    forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
+                        arg.replace(FN_ARG, function(all, underscore, name){
+                            $inject.push(name);
+                        });
+                    });
+                }
+                fn.$inject = $inject;
+            }
+        } else if (isArray(fn)) {
+            last = fn.length - 1;
+            assertArgFn(fn[last], 'fn');
+            $inject = fn.slice(0, last);
+        } else {
+            assertArgFn(fn, 'fn', true);
+        }
+        return $inject;
+    }
+
+///////////////////////////////////////
+
+    /**
+     * @ngdoc service
+     * @name $injector
+     * @function
+     *
+     * @description
+     *
+     * `$injector` is used to retrieve object instances as defined by
+     * {@link auto.$provide provider}, instantiate types, invoke methods,
+     * and load modules.
+     *
+     * The following always holds true:
+     *
+     * ```js
+     *   var $injector = angular.injector();
+     *   expect($injector.get('$injector')).toBe($injector);
+     *   expect($injector.invoke(function($injector){
+ *     return $injector;
+ *   }).toBe($injector);
+     * ```
+     *
+     * # Injection Function Annotation
+     *
+     * JavaScript does not have annotations, and annotations are needed for dependency injection. The
+     * following are all valid ways of annotating function with injection arguments and are equivalent.
+     *
+     * ```js
+     *   // inferred (only works if code not minified/obfuscated)
+     *   $injector.invoke(function(serviceA){});
+     *
+     *   // annotated
+     *   function explicit(serviceA) {};
+     *   explicit.$inject = ['serviceA'];
+     *   $injector.invoke(explicit);
+     *
+     *   // inline
+     *   $injector.invoke(['serviceA', function(serviceA){}]);
+     * ```
+     *
+     * ## Inference
+     *
+     * In JavaScript calling `toString()` on a function returns the function definition. The definition
+     * can then be parsed and the function arguments can be extracted. *NOTE:* This does not work with
+     * minification, and obfuscation tools since these tools change the argument names.
+     *
+     * ## `$inject` Annotation
+     * By adding a `$inject` property onto a function the injection parameters can be specified.
+     *
+     * ## Inline
+     * As an array of injection names, where the last item in the array is the function to call.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $injector#get
+     *
+     * @description
+     * Return an instance of the service.
+     *
+     * @param {string} name The name of the instance to retrieve.
+     * @return {*} The instance.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $injector#invoke
+     *
+     * @description
+     * Invoke the method and supply the method arguments from the `$injector`.
+     *
+     * @param {!Function} fn The function to invoke. Function parameters are injected according to the
+     *   {@link guide/di $inject Annotation} rules.
+     * @param {Object=} self The `this` for the invoked method.
+     * @param {Object=} locals Optional object. If preset then any argument names are read from this
+     *                         object first, before the `$injector` is consulted.
+     * @returns {*} the value returned by the invoked `fn` function.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $injector#has
+     *
+     * @description
+     * Allows the user to query if the particular service exist.
+     *
+     * @param {string} Name of the service to query.
+     * @returns {boolean} returns true if injector has given service.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $injector#instantiate
+     * @description
+     * Create a new instance of JS type. The method takes a constructor function invokes the new
+     * operator and supplies all of the arguments to the constructor function as specified by the
+     * constructor annotation.
+     *
+     * @param {Function} Type Annotated constructor function.
+     * @param {Object=} locals Optional object. If preset then any argument names are read from this
+     * object first, before the `$injector` is consulted.
+     * @returns {Object} new instance of `Type`.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $injector#annotate
+     *
+     * @description
+     * Returns an array of service names which the function is requesting for injection. This API is
+     * used by the injector to determine which services need to be injected into the function when the
+     * function is invoked. There are three ways in which the function can be annotated with the needed
+     * dependencies.
+     *
+     * # Argument names
+     *
+     * The simplest form is to extract the dependencies from the arguments of the function. This is done
+     * by converting the function into a string using `toString()` method and extracting the argument
+     * names.
+     * ```js
+     *   // Given
+     *   function MyController($scope, $route) {
+ *     // ...
+ *   }
+     *
+     *   // Then
+     *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+     * ```
+     *
+     * This method does not work with code minification / obfuscation. For this reason the following
+     * annotation strategies are supported.
+     *
+     * # The `$inject` property
+     *
+     * If a function has an `$inject` property and its value is an array of strings, then the strings
+     * represent names of services to be injected into the function.
+     * ```js
+     *   // Given
+     *   var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ *     // ...
+ *   }
+     *   // Define function dependencies
+     *   MyController['$inject'] = ['$scope', '$route'];
+     *
+     *   // Then
+     *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+     * ```
+     *
+     * # The array notation
+     *
+     * It is often desirable to inline Injected functions and that's when setting the `$inject` property
+     * is very inconvenient. In these situations using the array notation to specify the dependencies in
+     * a way that survives minification is a better choice:
+     *
+     * ```js
+     *   // We wish to write this (not minification / obfuscation safe)
+     *   injector.invoke(function($compile, $rootScope) {
+ *     // ...
+ *   });
+     *
+     *   // We are forced to write break inlining
+     *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ *     // ...
+ *   };
+     *   tmpFn.$inject = ['$compile', '$rootScope'];
+     *   injector.invoke(tmpFn);
+     *
+     *   // To better support inline function the inline annotation is supported
+     *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ *     // ...
+ *   }]);
+     *
+     *   // Therefore
+     *   expect(injector.annotate(
+     *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+     *    ).toEqual(['$compile', '$rootScope']);
+     * ```
+     *
+     * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
+     * be retrieved as described above.
+     *
+     * @returns {Array.<string>} The names of the services which the function requires.
+     */
+
+
+
+
+    /**
+     * @ngdoc object
+     * @name $provide
+     *
+     * @description
+     *
+     * The {@link auto.$provide $provide} service has a number of methods for registering components
+     * with the {@link auto.$injector $injector}. Many of these functions are also exposed on
+     * {@link angular.Module}.
+     *
+     * An Angular **service** is a singleton object created by a **service factory**.  These **service
+     * factories** are functions which, in turn, are created by a **service provider**.
+     * The **service providers** are constructor functions. When instantiated they must contain a
+     * property called `$get`, which holds the **service factory** function.
+     *
+     * When you request a service, the {@link auto.$injector $injector} is responsible for finding the
+     * correct **service provider**, instantiating it and then calling its `$get` **service factory**
+     * function to get the instance of the **service**.
+     *
+     * Often services have no configuration options and there is no need to add methods to the service
+     * provider.  The provider will be no more than a constructor function with a `$get` property. For
+     * these cases the {@link auto.$provide $provide} service has additional helper methods to register
+     * services without specifying a provider.
+     *
+     * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the
+     *     {@link auto.$injector $injector}
+     * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by
+     *     providers and services.
+     * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by
+     *     services, not providers.
+     * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,
+     *     that will be wrapped in a **service provider** object, whose `$get` property will contain the
+     *     given factory function.
+     * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
+     *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate
+     *      a new object using the given constructor function.
+     *
+     * See the individual methods for more information and examples.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $provide#provider
+     * @description
+     *
+     * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
+     * are constructor functions, whose instances are responsible for "providing" a factory for a
+     * service.
+     *
+     * Service provider names start with the name of the service they provide followed by `Provider`.
+     * For example, the {@link ng.$log $log} service has a provider called
+     * {@link ng.$logProvider $logProvider}.
+     *
+     * Service provider objects can have additional methods which allow configuration of the provider
+     * and its service. Importantly, you can configure what kind of service is created by the `$get`
+     * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
+     * method {@link ng.$logProvider#debugEnabled debugEnabled}
+     * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
+     * console or not.
+     *
+     * @param {string} name The name of the instance. NOTE: the provider will be available under `name +
+     'Provider'` key.
+     * @param {(Object|function())} provider If the provider is:
+     *
+     *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
+     *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
+     *   - `Constructor`: a new instance of the provider will be created using
+     *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
+     *
+     * @returns {Object} registered provider instance
+
+     * @example
+     *
+     * The following example shows how to create a simple event tracking service and register it using
+     * {@link auto.$provide#provider $provide.provider()}.
+     *
+     * ```js
+     *  // Define the eventTracker provider
+     *  function EventTrackerProvider() {
+ *    var trackingUrl = '/track';
+ *
+ *    // A provider method for configuring where the tracked events should been saved
+ *    this.setTrackingUrl = function(url) {
+ *      trackingUrl = url;
+ *    };
+ *
+ *    // The service factory function
+ *    this.$get = ['$http', function($http) {
+ *      var trackedEvents = {};
+ *      return {
+ *        // Call this to track an event
+ *        event: function(event) {
+ *          var count = trackedEvents[event] || 0;
+ *          count += 1;
+ *          trackedEvents[event] = count;
+ *          return count;
+ *        },
+ *        // Call this to save the tracked events to the trackingUrl
+ *        save: function() {
+ *          $http.post(trackingUrl, trackedEvents);
+ *        }
+ *      };
+ *    }];
+ *  }
+     *
+     *  describe('eventTracker', function() {
+ *    var postSpy;
+ *
+ *    beforeEach(module(function($provide) {
+ *      // Register the eventTracker provider
+ *      $provide.provider('eventTracker', EventTrackerProvider);
+ *    }));
+ *
+ *    beforeEach(module(function(eventTrackerProvider) {
+ *      // Configure eventTracker provider
+ *      eventTrackerProvider.setTrackingUrl('/custom-track');
+ *    }));
+ *
+ *    it('tracks events', inject(function(eventTracker) {
+ *      expect(eventTracker.event('login')).toEqual(1);
+ *      expect(eventTracker.event('login')).toEqual(2);
+ *    }));
+ *
+ *    it('saves to the tracking url', inject(function(eventTracker, $http) {
+ *      postSpy = spyOn($http, 'post');
+ *      eventTracker.event('login');
+ *      eventTracker.save();
+ *      expect(postSpy).toHaveBeenCalled();
+ *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ *    }));
+ *  });
+     * ```
+     */
+
+    /**
+     * @ngdoc method
+     * @name $provide#factory
+     * @description
+     *
+     * Register a **service factory**, which will be called to return the service instance.
+     * This is short for registering a service where its provider consists of only a `$get` property,
+     * which is the given service factory function.
+     * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
+     * configure your service in a provider.
+     *
+     * @param {string} name The name of the instance.
+     * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand
+     *                            for `$provide.provider(name, {$get: $getFn})`.
+     * @returns {Object} registered provider instance
+     *
+     * @example
+     * Here is an example of registering a service
+     * ```js
+     *   $provide.factory('ping', ['$http', function($http) {
+ *     return function ping() {
+ *       return $http.send('/ping');
+ *     };
+ *   }]);
+     * ```
+     * You would then inject and use this service like this:
+     * ```js
+     *   someModule.controller('Ctrl', ['ping', function(ping) {
+ *     ping();
+ *   }]);
+     * ```
+     */
+
+
+    /**
+     * @ngdoc method
+     * @name $provide#service
+     * @description
+     *
+     * Register a **service constructor**, which will be invoked with `new` to create the service
+     * instance.
+     * This is short for registering a service where its provider's `$get` property is the service
+     * constructor function that will be used to instantiate the service instance.
+     *
+     * You should use {@link auto.$provide#service $provide.service(class)} if you define your service
+     * as a type/class.
+     *
+     * @param {string} name The name of the instance.
+     * @param {Function} constructor A class (constructor function) that will be instantiated.
+     * @returns {Object} registered provider instance
+     *
+     * @example
+     * Here is an example of registering a service using
+     * {@link auto.$provide#service $provide.service(class)}.
+     * ```js
+     *   var Ping = function($http) {
+ *     this.$http = $http;
+ *   };
+     *
+     *   Ping.$inject = ['$http'];
+     *
+     *   Ping.prototype.send = function() {
+ *     return this.$http.get('/ping');
+ *   };
+     *   $provide.service('ping', Ping);
+     * ```
+     * You would then inject and use this service like this:
+     * ```js
+     *   someModule.controller('Ctrl', ['ping', function(ping) {
+ *     ping.send();
+ *   }]);
+     * ```
+     */
+
+
+    /**
+     * @ngdoc method
+     * @name $provide#value
+     * @description
+     *
+     * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
+     * number, an array, an object or a function.  This is short for registering a service where its
+     * provider's `$get` property is a factory function that takes no arguments and returns the **value
+     * service**.
+     *
+     * Value services are similar to constant services, except that they cannot be injected into a
+     * module configuration function (see {@link angular.Module#config}) but they can be overridden by
+     * an Angular
+     * {@link auto.$provide#decorator decorator}.
+     *
+     * @param {string} name The name of the instance.
+     * @param {*} value The value.
+     * @returns {Object} registered provider instance
+     *
+     * @example
+     * Here are some examples of creating value services.
+     * ```js
+     *   $provide.value('ADMIN_USER', 'admin');
+     *
+     *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+     *
+     *   $provide.value('halfOf', function(value) {
+ *     return value / 2;
+ *   });
+     * ```
+     */
+
+
+    /**
+     * @ngdoc method
+     * @name $provide#constant
+     * @description
+     *
+     * Register a **constant service**, such as a string, a number, an array, an object or a function,
+     * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be
+     * injected into a module configuration function (see {@link angular.Module#config}) and it cannot
+     * be overridden by an Angular {@link auto.$provide#decorator decorator}.
+     *
+     * @param {string} name The name of the constant.
+     * @param {*} value The constant value.
+     * @returns {Object} registered instance
+     *
+     * @example
+     * Here a some examples of creating constants:
+     * ```js
+     *   $provide.constant('SHARD_HEIGHT', 306);
+     *
+     *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+     *
+     *   $provide.constant('double', function(value) {
+ *     return value * 2;
+ *   });
+     * ```
+     */
+
+
+    /**
+     * @ngdoc method
+     * @name $provide#decorator
+     * @description
+     *
+     * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
+     * intercepts the creation of a service, allowing it to override or modify the behaviour of the
+     * service. The object returned by the decorator may be the original service, or a new service
+     * object which replaces or wraps and delegates to the original service.
+     *
+     * @param {string} name The name of the service to decorate.
+     * @param {function()} decorator This function will be invoked when the service needs to be
+     *    instantiated and should return the decorated service instance. The function is called using
+     *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
+     *    Local injection arguments:
+     *
+     *    * `$delegate` - The original service instance, which can be monkey patched, configured,
+     *      decorated or delegated to.
+     *
+     * @example
+     * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
+     * calls to {@link ng.$log#error $log.warn()}.
+     * ```js
+     *   $provide.decorator('$log', ['$delegate', function($delegate) {
+ *     $delegate.warn = $delegate.error;
+ *     return $delegate;
+ *   }]);
+     * ```
+     */
+
+
+    function createInjector(modulesToLoad) {
+        var INSTANTIATING = {},
+            providerSuffix = 'Provider',
+            path = [],
+            loadedModules = new HashMap(),
+            providerCache = {
+                $provide: {
+                    provider: supportObject(provider),
+                    factory: supportObject(factory),
+                    service: supportObject(service),
+                    value: supportObject(value),
+                    constant: supportObject(constant),
+                    decorator: decorator
+                }
+            },
+            providerInjector = (providerCache.$injector =
+                createInternalInjector(providerCache, function() {
+                    throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
+                })),
+            instanceCache = {},
+            instanceInjector = (instanceCache.$injector =
+                createInternalInjector(instanceCache, function(servicename) {
+                    var provider = providerInjector.get(servicename + providerSuffix);
+                    return instanceInjector.invoke(provider.$get, provider);
+                }));
+
+
+        forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); });
+
+        return instanceInjector;
+
+        ////////////////////////////////////
+        // $provider
+        ////////////////////////////////////
+
+        function supportObject(delegate) {
+            return function(key, value) {
+                if (isObject(key)) {
+                    forEach(key, reverseParams(delegate));
+                } else {
+                    return delegate(key, value);
+                }
+            };
+        }
+
+        function provider(name, provider_) {
+            assertNotHasOwnProperty(name, 'service');
+            if (isFunction(provider_) || isArray(provider_)) {
+                provider_ = providerInjector.instantiate(provider_);
+            }
+            if (!provider_.$get) {
+                throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
+            }
+            return providerCache[name + providerSuffix] = provider_;
+        }
+
+        function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); }
+
+        function service(name, constructor) {
+            return factory(name, ['$injector', function($injector) {
+                return $injector.instantiate(constructor);
+            }]);
+        }
+
+        function value(name, val) { return factory(name, valueFn(val)); }
+
+        function constant(name, value) {
+            assertNotHasOwnProperty(name, 'constant');
+            providerCache[name] = value;
+            instanceCache[name] = value;
+        }
+
+        function decorator(serviceName, decorFn) {
+            var origProvider = providerInjector.get(serviceName + providerSuffix),
+                orig$get = origProvider.$get;
+
+            origProvider.$get = function() {
+                var origInstance = instanceInjector.invoke(orig$get, origProvider);
+                return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
+            };
+        }
+
+        ////////////////////////////////////
+        // Module Loading
+        ////////////////////////////////////
+        function loadModules(modulesToLoad){
+            var runBlocks = [], moduleFn, invokeQueue, i, ii;
+            forEach(modulesToLoad, function(module) {
+                if (loadedModules.get(module)) return;
+                loadedModules.put(module, true);
+
+                try {
+                    if (isString(module)) {
+                        moduleFn = angularModule(module);
+                        runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
+
+                        for(invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) {
+                            var invokeArgs = invokeQueue[i],
+                                provider = providerInjector.get(invokeArgs[0]);
+
+                            provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
+                        }
+                    } else if (isFunction(module)) {
+                        runBlocks.push(providerInjector.invoke(module));
+                    } else if (isArray(module)) {
+                        runBlocks.push(providerInjector.invoke(module));
+                    } else {
+                        assertArgFn(module, 'module');
+                    }
+                } catch (e) {
+                    if (isArray(module)) {
+                        module = module[module.length - 1];
+                    }
+                    if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
+                        // Safari & FF's stack traces don't contain error.message content
+                        // unlike those of Chrome and IE
+                        // So if stack doesn't contain message, we create a new string that contains both.
+                        // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
+                        /* jshint -W022 */
+                        e = e.message + '\n' + e.stack;
+                    }
+                    throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
+                        module, e.stack || e.message || e);
+                }
+            });
+            return runBlocks;
+        }
+
+        ////////////////////////////////////
+        // internal Injector
+        ////////////////////////////////////
+
+        function createInternalInjector(cache, factory) {
+
+            function getService(serviceName) {
+                if (cache.hasOwnProperty(serviceName)) {
+                    if (cache[serviceName] === INSTANTIATING) {
+                        throw $injectorMinErr('cdep', 'Circular dependency found: {0}', path.join(' <- '));
+                    }
+                    return cache[serviceName];
+                } else {
+                    try {
+                        path.unshift(serviceName);
+                        cache[serviceName] = INSTANTIATING;
+                        return cache[serviceName] = factory(serviceName);
+                    } catch (err) {
+                        if (cache[serviceName] === INSTANTIATING) {
+                            delete cache[serviceName];
+                        }
+                        throw err;
+                    } finally {
+                        path.shift();
+                    }
+                }
+            }
+
+            function invoke(fn, self, locals){
+                var args = [],
+                    $inject = annotate(fn),
+                    length, i,
+                    key;
+
+                for(i = 0, length = $inject.length; i < length; i++) {
+                    key = $inject[i];
+                    if (typeof key !== 'string') {
+                        throw $injectorMinErr('itkn',
+                            'Incorrect injection token! Expected service name as string, got {0}', key);
+                    }
+                    args.push(
+                        locals && locals.hasOwnProperty(key)
+                            ? locals[key]
+                            : getService(key)
+                    );
+                }
+                if (!fn.$inject) {
+                    // this means that we must be an array.
+                    fn = fn[length];
+                }
+
+                // http://jsperf.com/angularjs-invoke-apply-vs-switch
+                // #5388
+                return fn.apply(self, args);
+            }
+
+            function instantiate(Type, locals) {
+                var Constructor = function() {},
+                    instance, returnedValue;
+
+                // Check if Type is annotated and use just the given function at n-1 as parameter
+                // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
+                Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
+                instance = new Constructor();
+                returnedValue = invoke(Type, instance, locals);
+
+                return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;
+            }
+
+            return {
+                invoke: invoke,
+                instantiate: instantiate,
+                get: getService,
+                annotate: annotate,
+                has: function(name) {
+                    return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
+                }
+            };
+        }
+    }
+
+    /**
+     * @ngdoc service
+     * @name $anchorScroll
+     * @kind function
+     * @requires $window
+     * @requires $location
+     * @requires $rootScope
+     *
+     * @description
+     * When called, it checks current value of `$location.hash()` and scroll to related element,
+     * according to rules specified in
+     * [Html5 spec](http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document).
+     *
+     * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor.
+     * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <div id="scrollArea" ng-controller="ScrollCtrl">
+     <a ng-click="gotoBottom()">Go to bottom</a>
+     <a id="bottom"></a> You're at the bottom!
+     </div>
+     </file>
+     <file name="script.js">
+     function ScrollCtrl($scope, $location, $anchorScroll) {
+         $scope.gotoBottom = function (){
+           // set the location.hash to the id of
+           // the element you wish to scroll to.
+           $location.hash('bottom');
+
+           // call $anchorScroll()
+           $anchorScroll();
+         };
+       }
+     </file>
+     <file name="style.css">
+     #scrollArea {
+         height: 350px;
+         overflow: auto;
+       }
+
+     #bottom {
+         display: block;
+         margin-top: 2000px;
+       }
+     </file>
+     </example>
+     */
+    function $AnchorScrollProvider() {
+
+        var autoScrollingEnabled = true;
+
+        this.disableAutoScrolling = function() {
+            autoScrollingEnabled = false;
+        };
+
+        this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
+            var document = $window.document;
+
+            // helper function to get first anchor from a NodeList
+            // can't use filter.filter, as it accepts only instances of Array
+            // and IE can't convert NodeList to an array using [].slice
+            // TODO(vojta): use filter if we change it to accept lists as well
+            function getFirstAnchor(list) {
+                var result = null;
+                forEach(list, function(element) {
+                    if (!result && lowercase(element.nodeName) === 'a') result = element;
+                });
+                return result;
+            }
+
+            function scroll() {
+                var hash = $location.hash(), elm;
+
+                // empty hash, scroll to the top of the page
+                if (!hash) $window.scrollTo(0, 0);
+
+                // element with given id
+                else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
+
+                // first anchor with given name :-D
+                else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
+
+                // no element and hash == 'top', scroll to the top of the page
+                else if (hash === 'top') $window.scrollTo(0, 0);
+            }
+
+            // does not scroll when user clicks on anchor link that is currently on
+            // (no url change, no $location.hash() change), browser native does scroll
+            if (autoScrollingEnabled) {
+                $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
+                    function autoScrollWatchAction() {
+                        $rootScope.$evalAsync(scroll);
+                    });
+            }
+
+            return scroll;
+        }];
+    }
+
+    var $animateMinErr = minErr('$animate');
+
+    /**
+     * @ngdoc provider
+     * @name $animateProvider
+     *
+     * @description
+     * Default implementation of $animate that doesn't perform any animations, instead just
+     * synchronously performs DOM
+     * updates and calls done() callbacks.
+     *
+     * In order to enable animations the ngAnimate module has to be loaded.
+     *
+     * To see the functional implementation check out src/ngAnimate/animate.js
+     */
+    var $AnimateProvider = ['$provide', function($provide) {
+
+
+        this.$$selectors = {};
+
+
+        /**
+         * @ngdoc method
+         * @name $animateProvider#register
+         *
+         * @description
+         * Registers a new injectable animation factory function. The factory function produces the
+         * animation object which contains callback functions for each event that is expected to be
+         * animated.
+         *
+         *   * `eventFn`: `function(Element, doneFunction)` The element to animate, the `doneFunction`
+         *   must be called once the element animation is complete. If a function is returned then the
+         *   animation service will use this function to cancel the animation whenever a cancel event is
+         *   triggered.
+         *
+         *
+         * ```js
+         *   return {
+     *     eventFn : function(element, done) {
+     *       //code to run the animation
+     *       //once complete, then run done()
+     *       return function cancellationFunction() {
+     *         //code to cancel the animation
+     *       }
+     *     }
+     *   }
+         * ```
+         *
+         * @param {string} name The name of the animation.
+         * @param {Function} factory The factory function that will be executed to return the animation
+         *                           object.
+         */
+        this.register = function(name, factory) {
+            var key = name + '-animation';
+            if (name && name.charAt(0) != '.') throw $animateMinErr('notcsel',
+                "Expecting class selector starting with '.' got '{0}'.", name);
+            this.$$selectors[name.substr(1)] = key;
+            $provide.factory(key, factory);
+        };
+
+        /**
+         * @ngdoc method
+         * @name $animateProvider#classNameFilter
+         *
+         * @description
+         * Sets and/or returns the CSS class regular expression that is checked when performing
+         * an animation. Upon bootstrap the classNameFilter value is not set at all and will
+         * therefore enable $animate to attempt to perform an animation on any element.
+         * When setting the classNameFilter value, animations will only be performed on elements
+         * that successfully match the filter expression. This in turn can boost performance
+         * for low-powered devices as well as applications containing a lot of structural operations.
+         * @param {RegExp=} expression The className expression which will be checked against all animations
+         * @return {RegExp} The current CSS className expression value. If null then there is no expression value
+         */
+        this.classNameFilter = function(expression) {
+            if(arguments.length === 1) {
+                this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+            }
+            return this.$$classNameFilter;
+        };
+
+        this.$get = ['$timeout', '$$asyncCallback', function($timeout, $$asyncCallback) {
+
+            function async(fn) {
+                fn && $$asyncCallback(fn);
+            }
+
+            /**
+             *
+             * @ngdoc service
+             * @name $animate
+             * @description The $animate service provides rudimentary DOM manipulation functions to
+             * insert, remove and move elements within the DOM, as well as adding and removing classes.
+             * This service is the core service used by the ngAnimate $animator service which provides
+             * high-level animation hooks for CSS and JavaScript.
+             *
+             * $animate is available in the AngularJS core, however, the ngAnimate module must be included
+             * to enable full out animation support. Otherwise, $animate will only perform simple DOM
+             * manipulation operations.
+             *
+             * To learn more about enabling animation support, click here to visit the {@link ngAnimate
+     * ngAnimate module page} as well as the {@link ngAnimate.$animate ngAnimate $animate service
+     * page}.
+             */
+            return {
+
+                /**
+                 *
+                 * @ngdoc method
+                 * @name $animate#enter
+                 * @function
+                 * @description Inserts the element into the DOM either after the `after` element or within
+                 *   the `parent` element. Once complete, the done() callback will be fired (if provided).
+                 * @param {DOMElement} element the element which will be inserted into the DOM
+                 * @param {DOMElement} parent the parent element which will append the element as
+                 *   a child (if the after element is not present)
+                 * @param {DOMElement} after the sibling element which will append the element
+                 *   after itself
+                 * @param {Function=} done callback function that will be called after the element has been
+                 *   inserted into the DOM
+                 */
+                enter : function(element, parent, after, done) {
+                    if (after) {
+                        after.after(element);
+                    } else {
+                        if (!parent || !parent[0]) {
+                            parent = after.parent();
+                        }
+                        parent.append(element);
+                    }
+                    async(done);
+                },
+
+                /**
+                 *
+                 * @ngdoc method
+                 * @name $animate#leave
+                 * @function
+                 * @description Removes the element from the DOM. Once complete, the done() callback will be
+                 *   fired (if provided).
+                 * @param {DOMElement} element the element which will be removed from the DOM
+                 * @param {Function=} done callback function that will be called after the element has been
+                 *   removed from the DOM
+                 */
+                leave : function(element, done) {
+                    element.remove();
+                    async(done);
+                },
+
+                /**
+                 *
+                 * @ngdoc method
+                 * @name $animate#move
+                 * @function
+                 * @description Moves the position of the provided element within the DOM to be placed
+                 * either after the `after` element or inside of the `parent` element. Once complete, the
+                 * done() callback will be fired (if provided).
+                 *
+                 * @param {DOMElement} element the element which will be moved around within the
+                 *   DOM
+                 * @param {DOMElement} parent the parent element where the element will be
+                 *   inserted into (if the after element is not present)
+                 * @param {DOMElement} after the sibling element where the element will be
+                 *   positioned next to
+                 * @param {Function=} done the callback function (if provided) that will be fired after the
+                 *   element has been moved to its new position
+                 */
+                move : function(element, parent, after, done) {
+                    // Do not remove element before insert. Removing will cause data associated with the
+                    // element to be dropped. Insert will implicitly do the remove.
+                    this.enter(element, parent, after, done);
+                },
+
+                /**
+                 *
+                 * @ngdoc method
+                 * @name $animate#addClass
+                 * @function
+                 * @description Adds the provided className CSS class value to the provided element. Once
+                 * complete, the done() callback will be fired (if provided).
+                 * @param {DOMElement} element the element which will have the className value
+                 *   added to it
+                 * @param {string} className the CSS class which will be added to the element
+                 * @param {Function=} done the callback function (if provided) that will be fired after the
+                 *   className value has been added to the element
+                 */
+                addClass : function(element, className, done) {
+                    className = isString(className) ?
+                        className :
+                        isArray(className) ? className.join(' ') : '';
+                    forEach(element, function (element) {
+                        jqLiteAddClass(element, className);
+                    });
+                    async(done);
+                },
+
+                /**
+                 *
+                 * @ngdoc method
+                 * @name $animate#removeClass
+                 * @function
+                 * @description Removes the provided className CSS class value from the provided element.
+                 * Once complete, the done() callback will be fired (if provided).
+                 * @param {DOMElement} element the element which will have the className value
+                 *   removed from it
+                 * @param {string} className the CSS class which will be removed from the element
+                 * @param {Function=} done the callback function (if provided) that will be fired after the
+                 *   className value has been removed from the element
+                 */
+                removeClass : function(element, className, done) {
+                    className = isString(className) ?
+                        className :
+                        isArray(className) ? className.join(' ') : '';
+                    forEach(element, function (element) {
+                        jqLiteRemoveClass(element, className);
+                    });
+                    async(done);
+                },
+
+                /**
+                 *
+                 * @ngdoc method
+                 * @name $animate#setClass
+                 * @function
+                 * @description Adds and/or removes the given CSS classes to and from the element.
+                 * Once complete, the done() callback will be fired (if provided).
+                 * @param {DOMElement} element the element which will it's CSS classes changed
+                 *   removed from it
+                 * @param {string} add the CSS classes which will be added to the element
+                 * @param {string} remove the CSS class which will be removed from the element
+                 * @param {Function=} done the callback function (if provided) that will be fired after the
+                 *   CSS classes have been set on the element
+                 */
+                setClass : function(element, add, remove, done) {
+                    forEach(element, function (element) {
+                        jqLiteAddClass(element, add);
+                        jqLiteRemoveClass(element, remove);
+                    });
+                    async(done);
+                },
+
+                enabled : noop
+            };
+        }];
+    }];
+
+    function $$AsyncCallbackProvider(){
+        this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) {
+            return $$rAF.supported
+                ? function(fn) { return $$rAF(fn); }
+                : function(fn) {
+                return $timeout(fn, 0, false);
+            };
+        }];
+    }
+
+    /**
+     * ! This is a private undocumented service !
+     *
+     * @name $browser
+     * @requires $log
+     * @description
+     * This object has two goals:
+     *
+     * - hide all the global state in the browser caused by the window object
+     * - abstract away all the browser specific features and inconsistencies
+     *
+     * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
+     * service, which can be used for convenient testing of the application without the interaction with
+     * the real browser apis.
+     */
+    /**
+     * @param {object} window The global window object.
+     * @param {object} document jQuery wrapped document.
+     * @param {function()} XHR XMLHttpRequest constructor.
+     * @param {object} $log console.log or an object with the same interface.
+     * @param {object} $sniffer $sniffer service
+     */
+    function Browser(window, document, $log, $sniffer) {
+        var self = this,
+            rawDocument = document[0],
+            location = window.location,
+            history = window.history,
+            setTimeout = window.setTimeout,
+            clearTimeout = window.clearTimeout,
+            pendingDeferIds = {};
+
+        self.isMock = false;
+
+        var outstandingRequestCount = 0;
+        var outstandingRequestCallbacks = [];
+
+        // TODO(vojta): remove this temporary api
+        self.$$completeOutstandingRequest = completeOutstandingRequest;
+        self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
+
+        /**
+         * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
+         * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
+         */
+        function completeOutstandingRequest(fn) {
+            try {
+                fn.apply(null, sliceArgs(arguments, 1));
+            } finally {
+                outstandingRequestCount--;
+                if (outstandingRequestCount === 0) {
+                    while(outstandingRequestCallbacks.length) {
+                        try {
+                            outstandingRequestCallbacks.pop()();
+                        } catch (e) {
+                            $log.error(e);
+                        }
+                    }
+                }
+            }
+        }
+
+        /**
+         * @private
+         * Note: this method is used only by scenario runner
+         * TODO(vojta): prefix this method with $$ ?
+         * @param {function()} callback Function that will be called when no outstanding request
+         */
+        self.notifyWhenNoOutstandingRequests = function(callback) {
+            // force browser to execute all pollFns - this is needed so that cookies and other pollers fire
+            // at some deterministic time in respect to the test runner's actions. Leaving things up to the
+            // regular poller would result in flaky tests.
+            forEach(pollFns, function(pollFn){ pollFn(); });
+
+            if (outstandingRequestCount === 0) {
+                callback();
+            } else {
+                outstandingRequestCallbacks.push(callback);
+            }
+        };
+
+        //////////////////////////////////////////////////////////////
+        // Poll Watcher API
+        //////////////////////////////////////////////////////////////
+        var pollFns = [],
+            pollTimeout;
+
+        /**
+         * @name $browser#addPollFn
+         *
+         * @param {function()} fn Poll function to add
+         *
+         * @description
+         * Adds a function to the list of functions that poller periodically executes,
+         * and starts polling if not started yet.
+         *
+         * @returns {function()} the added function
+         */
+        self.addPollFn = function(fn) {
+            if (isUndefined(pollTimeout)) startPoller(100, setTimeout);
+            pollFns.push(fn);
+            return fn;
+        };
+
+        /**
+         * @param {number} interval How often should browser call poll functions (ms)
+         * @param {function()} setTimeout Reference to a real or fake `setTimeout` function.
+         *
+         * @description
+         * Configures the poller to run in the specified intervals, using the specified
+         * setTimeout fn and kicks it off.
+         */
+        function startPoller(interval, setTimeout) {
+            (function check() {
+                forEach(pollFns, function(pollFn){ pollFn(); });
+                pollTimeout = setTimeout(check, interval);
+            })();
+        }
+
+        //////////////////////////////////////////////////////////////
+        // URL API
+        //////////////////////////////////////////////////////////////
+
+        var lastBrowserUrl = location.href,
+            baseElement = document.find('base'),
+            newLocation = null;
+
+        /**
+         * @name $browser#url
+         *
+         * @description
+         * GETTER:
+         * Without any argument, this method just returns current value of location.href.
+         *
+         * SETTER:
+         * With at least one argument, this method sets url to new value.
+         * If html5 history api supported, pushState/replaceState is used, otherwise
+         * location.href/location.replace is used.
+         * Returns its own instance to allow chaining
+         *
+         * NOTE: this api is intended for use only by the $location service. Please use the
+         * {@link ng.$location $location service} to change url.
+         *
+         * @param {string} url New url (when used as setter)
+         * @param {boolean=} replace Should new url replace current history record ?
+         */
+        self.url = function(url, replace) {
+            // Android Browser BFCache causes location, history reference to become stale.
+            if (location !== window.location) location = window.location;
+            if (history !== window.history) history = window.history;
+
+            // setter
+            if (url) {
+                if (lastBrowserUrl == url) return;
+                lastBrowserUrl = url;
+                if ($sniffer.history) {
+                    if (replace) history.replaceState(null, '', url);
+                    else {
+                        history.pushState(null, '', url);
+                        // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462
+                        baseElement.attr('href', baseElement.attr('href'));
+                    }
+                } else {
+                    newLocation = url;
+                    if (replace) {
+                        location.replace(url);
+                    } else {
+                        location.href = url;
+                    }
+                }
+                return self;
+                // getter
+            } else {
+                // - newLocation is a workaround for an IE7-9 issue with location.replace and location.href
+                //   methods not updating location.href synchronously.
+                // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
+                return newLocation || location.href.replace(/%27/g,"'");
+            }
+        };
+
+        var urlChangeListeners = [],
+            urlChangeInit = false;
+
+        function fireUrlChange() {
+            newLocation = null;
+            if (lastBrowserUrl == self.url()) return;
+
+            lastBrowserUrl = self.url();
+            forEach(urlChangeListeners, function(listener) {
+                listener(self.url());
+            });
+        }
+
+        /**
+         * @name $browser#onUrlChange
+         *
+         * @description
+         * Register callback function that will be called, when url changes.
+         *
+         * It's only called when the url is changed from outside of angular:
+         * - user types different url into address bar
+         * - user clicks on history (forward/back) button
+         * - user clicks on a link
+         *
+         * It's not called when url is changed by $browser.url() method
+         *
+         * The listener gets called with new url as parameter.
+         *
+         * NOTE: this api is intended for use only by the $location service. Please use the
+         * {@link ng.$location $location service} to monitor url changes in angular apps.
+         *
+         * @param {function(string)} listener Listener function to be called when url changes.
+         * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
+         */
+        self.onUrlChange = function(callback) {
+            // TODO(vojta): refactor to use node's syntax for events
+            if (!urlChangeInit) {
+                // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+                // don't fire popstate when user change the address bar and don't fire hashchange when url
+                // changed by push/replaceState
+
+                // html5 history api - popstate event
+                if ($sniffer.history) jqLite(window).on('popstate', fireUrlChange);
+                // hashchange event
+                if ($sniffer.hashchange) jqLite(window).on('hashchange', fireUrlChange);
+                // polling
+                else self.addPollFn(fireUrlChange);
+
+                urlChangeInit = true;
+            }
+
+            urlChangeListeners.push(callback);
+            return callback;
+        };
+
+        //////////////////////////////////////////////////////////////
+        // Misc API
+        //////////////////////////////////////////////////////////////
+
+        /**
+         * @name $browser#baseHref
+         *
+         * @description
+         * Returns current <base href>
+         * (always relative - without domain)
+         *
+         * @returns {string} The current base href
+         */
+        self.baseHref = function() {
+            var href = baseElement.attr('href');
+            return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
+        };
+
+        //////////////////////////////////////////////////////////////
+        // Cookies API
+        //////////////////////////////////////////////////////////////
+        var lastCookies = {};
+        var lastCookieString = '';
+        var cookiePath = self.baseHref();
+
+        /**
+         * @name $browser#cookies
+         *
+         * @param {string=} name Cookie name
+         * @param {string=} value Cookie value
+         *
+         * @description
+         * The cookies method provides a 'private' low level access to browser cookies.
+         * It is not meant to be used directly, use the $cookie service instead.
+         *
+         * The return values vary depending on the arguments that the method was called with as follows:
+         *
+         * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify
+         *   it
+         * - cookies(name, value) -> set name to value, if value is undefined delete the cookie
+         * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that
+         *   way)
+         *
+         * @returns {Object} Hash of all cookies (if called without any parameter)
+         */
+        self.cookies = function(name, value) {
+            /* global escape: false, unescape: false */
+            var cookieLength, cookieArray, cookie, i, index;
+
+            if (name) {
+                if (value === undefined) {
+                    rawDocument.cookie = escape(name) + "=;path=" + cookiePath +
+                    ";expires=Thu, 01 Jan 1970 00:00:00 GMT";
+                } else {
+                    if (isString(value)) {
+                        cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) +
+                        ';path=' + cookiePath).length + 1;
+
+                        // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
+                        // - 300 cookies
+                        // - 20 cookies per unique domain
+                        // - 4096 bytes per cookie
+                        if (cookieLength > 4096) {
+                            $log.warn("Cookie '"+ name +
+                            "' possibly not set or overflowed because it was too large ("+
+                            cookieLength + " > 4096 bytes)!");
+                        }
+                    }
+                }
+            } else {
+                if (rawDocument.cookie !== lastCookieString) {
+                    lastCookieString = rawDocument.cookie;
+                    cookieArray = lastCookieString.split("; ");
+                    lastCookies = {};
+
+                    for (i = 0; i < cookieArray.length; i++) {
+                        cookie = cookieArray[i];
+                        index = cookie.indexOf('=');
+                        if (index > 0) { //ignore nameless cookies
+                            name = unescape(cookie.substring(0, index));
+                            // the first value that is seen for a cookie is the most
+                            // specific one.  values for the same cookie name that
+                            // follow are for less specific paths.
+                            if (lastCookies[name] === undefined) {
+                                lastCookies[name] = unescape(cookie.substring(index + 1));
+                            }
+                        }
+                    }
+                }
+                return lastCookies;
+            }
+        };
+
+
+        /**
+         * @name $browser#defer
+         * @param {function()} fn A function, who's execution should be deferred.
+         * @param {number=} [delay=0] of milliseconds to defer the function execution.
+         * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
+         *
+         * @description
+         * Executes a fn asynchronously via `setTimeout(fn, delay)`.
+         *
+         * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
+         * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
+         * via `$browser.defer.flush()`.
+         *
+         */
+        self.defer = function(fn, delay) {
+            var timeoutId;
+            outstandingRequestCount++;
+            timeoutId = setTimeout(function() {
+                delete pendingDeferIds[timeoutId];
+                completeOutstandingRequest(fn);
+            }, delay || 0);
+            pendingDeferIds[timeoutId] = true;
+            return timeoutId;
+        };
+
+
+        /**
+         * @name $browser#defer.cancel
+         *
+         * @description
+         * Cancels a deferred task identified with `deferId`.
+         *
+         * @param {*} deferId Token returned by the `$browser.defer` function.
+         * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+         *                    canceled.
+         */
+        self.defer.cancel = function(deferId) {
+            if (pendingDeferIds[deferId]) {
+                delete pendingDeferIds[deferId];
+                clearTimeout(deferId);
+                completeOutstandingRequest(noop);
+                return true;
+            }
+            return false;
+        };
+
+    }
+
+    function $BrowserProvider(){
+        this.$get = ['$window', '$log', '$sniffer', '$document',
+            function( $window,   $log,   $sniffer,   $document){
+                return new Browser($window, $document, $log, $sniffer);
+            }];
+    }
+
+    /**
+     * @ngdoc service
+     * @name $cacheFactory
+     *
+     * @description
+     * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
+     * them.
+     *
+     * ```js
+     *
+     *  var cache = $cacheFactory('cacheId');
+     *  expect($cacheFactory.get('cacheId')).toBe(cache);
+     *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+     *
+     *  cache.put("key", "value");
+     *  cache.put("another key", "another value");
+     *
+     *  // We've specified no options on creation
+     *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});
+     *
+     * ```
+     *
+     *
+     * @param {string} cacheId Name or id of the newly created cache.
+     * @param {object=} options Options object that specifies the cache behavior. Properties:
+     *
+     *   - `{number=}` `capacity` — turns the cache into LRU cache.
+     *
+     * @returns {object} Newly created cache object with the following set of methods:
+     *
+     * - `{object}` `info()` — Returns id, size, and options of cache.
+     * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns
+     *   it.
+     * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
+     * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
+     * - `{void}` `removeAll()` — Removes all cached values.
+     * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
+     *
+     * @example
+     <example module="cacheExampleApp">
+     <file name="index.html">
+     <div ng-controller="CacheController">
+     <input ng-model="newCacheKey" placeholder="Key">
+     <input ng-model="newCacheValue" placeholder="Value">
+     <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
+
+     <p ng-if="keys.length">Cached Values</p>
+     <div ng-repeat="key in keys">
+     <span ng-bind="key"></span>
+     <span>: </span>
+     <b ng-bind="cache.get(key)"></b>
+     </div>
+
+     <p>Cache Info</p>
+     <div ng-repeat="(key, value) in cache.info()">
+     <span ng-bind="key"></span>
+     <span>: </span>
+     <b ng-bind="value"></b>
+     </div>
+     </div>
+     </file>
+     <file name="script.js">
+     angular.module('cacheExampleApp', []).
+     controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
+           $scope.keys = [];
+           $scope.cache = $cacheFactory('cacheId');
+           $scope.put = function(key, value) {
+             $scope.cache.put(key, value);
+             $scope.keys.push(key);
+           };
+         }]);
+     </file>
+     <file name="style.css">
+     p {
+         margin: 10px 0 3px;
+       }
+     </file>
+     </example>
+     */
+    function $CacheFactoryProvider() {
+
+        this.$get = function() {
+            var caches = {};
+
+            function cacheFactory(cacheId, options) {
+                if (cacheId in caches) {
+                    throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
+                }
+
+                var size = 0,
+                    stats = extend({}, options, {id: cacheId}),
+                    data = {},
+                    capacity = (options && options.capacity) || Number.MAX_VALUE,
+                    lruHash = {},
+                    freshEnd = null,
+                    staleEnd = null;
+
+                /**
+                 * @ngdoc type
+                 * @name $cacheFactory.Cache
+                 *
+                 * @description
+                 * A cache object used to store and retrieve data, primarily used by
+                 * {@link $http $http} and the {@link ng.directive:script script} directive to cache
+                 * templates and other data.
+                 *
+                 * ```js
+                 *  angular.module('superCache')
+                 *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {
+       *      return $cacheFactory('super-cache');
+       *    }]);
+                 * ```
+                 *
+                 * Example test:
+                 *
+                 * ```js
+                 *  it('should behave like a cache', inject(function(superCache) {
+       *    superCache.put('key', 'value');
+       *    superCache.put('another key', 'another value');
+       *
+       *    expect(superCache.info()).toEqual({
+       *      id: 'super-cache',
+       *      size: 2
+       *    });
+       *
+       *    superCache.remove('another key');
+       *    expect(superCache.get('another key')).toBeUndefined();
+       *
+       *    superCache.removeAll();
+       *    expect(superCache.info()).toEqual({
+       *      id: 'super-cache',
+       *      size: 0
+       *    });
+       *  }));
+                 * ```
+                 */
+                return caches[cacheId] = {
+
+                    /**
+                     * @ngdoc method
+                     * @name $cacheFactory.Cache#put
+                     * @function
+                     *
+                     * @description
+                     * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
+                     * retrieved later, and incrementing the size of the cache if the key was not already
+                     * present in the cache. If behaving like an LRU cache, it will also remove stale
+                     * entries from the set.
+                     *
+                     * It will not insert undefined values into the cache.
+                     *
+                     * @param {string} key the key under which the cached data is stored.
+                     * @param {*} value the value to store alongside the key. If it is undefined, the key
+                     *    will not be stored.
+                     * @returns {*} the value stored.
+                     */
+                    put: function(key, value) {
+                        if (capacity < Number.MAX_VALUE) {
+                            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
+
+                            refresh(lruEntry);
+                        }
+
+                        if (isUndefined(value)) return;
+                        if (!(key in data)) size++;
+                        data[key] = value;
+
+                        if (size > capacity) {
+                            this.remove(staleEnd.key);
+                        }
+
+                        return value;
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $cacheFactory.Cache#get
+                     * @function
+                     *
+                     * @description
+                     * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
+                     *
+                     * @param {string} key the key of the data to be retrieved
+                     * @returns {*} the value stored.
+                     */
+                    get: function(key) {
+                        if (capacity < Number.MAX_VALUE) {
+                            var lruEntry = lruHash[key];
+
+                            if (!lruEntry) return;
+
+                            refresh(lruEntry);
+                        }
+
+                        return data[key];
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $cacheFactory.Cache#remove
+                     * @function
+                     *
+                     * @description
+                     * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
+                     *
+                     * @param {string} key the key of the entry to be removed
+                     */
+                    remove: function(key) {
+                        if (capacity < Number.MAX_VALUE) {
+                            var lruEntry = lruHash[key];
+
+                            if (!lruEntry) return;
+
+                            if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+                            if (lruEntry == staleEnd) staleEnd = lruEntry.n;
+                            link(lruEntry.n,lruEntry.p);
+
+                            delete lruHash[key];
+                        }
+
+                        delete data[key];
+                        size--;
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $cacheFactory.Cache#removeAll
+                     * @function
+                     *
+                     * @description
+                     * Clears the cache object of any entries.
+                     */
+                    removeAll: function() {
+                        data = {};
+                        size = 0;
+                        lruHash = {};
+                        freshEnd = staleEnd = null;
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $cacheFactory.Cache#destroy
+                     * @function
+                     *
+                     * @description
+                     * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
+                     * removing it from the {@link $cacheFactory $cacheFactory} set.
+                     */
+                    destroy: function() {
+                        data = null;
+                        stats = null;
+                        lruHash = null;
+                        delete caches[cacheId];
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $cacheFactory.Cache#info
+                     * @function
+                     *
+                     * @description
+                     * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
+                     *
+                     * @returns {object} an object with the following properties:
+                     *   <ul>
+                     *     <li>**id**: the id of the cache instance</li>
+                     *     <li>**size**: the number of entries kept in the cache instance</li>
+                     *     <li>**...**: any additional properties from the options object when creating the
+                     *       cache.</li>
+                     *   </ul>
+                     */
+                    info: function() {
+                        return extend({}, stats, {size: size});
+                    }
+                };
+
+
+                /**
+                 * makes the `entry` the freshEnd of the LRU linked list
+                 */
+                function refresh(entry) {
+                    if (entry != freshEnd) {
+                        if (!staleEnd) {
+                            staleEnd = entry;
+                        } else if (staleEnd == entry) {
+                            staleEnd = entry.n;
+                        }
+
+                        link(entry.n, entry.p);
+                        link(entry, freshEnd);
+                        freshEnd = entry;
+                        freshEnd.n = null;
+                    }
+                }
+
+
+                /**
+                 * bidirectionally links two entries of the LRU linked list
+                 */
+                function link(nextEntry, prevEntry) {
+                    if (nextEntry != prevEntry) {
+                        if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
+                        if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
+                    }
+                }
+            }
+
+
+            /**
+             * @ngdoc method
+             * @name $cacheFactory#info
+             *
+             * @description
+             * Get information about all the of the caches that have been created
+             *
+             * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
+             */
+            cacheFactory.info = function() {
+                var info = {};
+                forEach(caches, function(cache, cacheId) {
+                    info[cacheId] = cache.info();
+                });
+                return info;
+            };
+
+
+            /**
+             * @ngdoc method
+             * @name $cacheFactory#get
+             *
+             * @description
+             * Get access to a cache object by the `cacheId` used when it was created.
+             *
+             * @param {string} cacheId Name or id of a cache to access.
+             * @returns {object} Cache object identified by the cacheId or undefined if no such cache.
+             */
+            cacheFactory.get = function(cacheId) {
+                return caches[cacheId];
+            };
+
+
+            return cacheFactory;
+        };
+    }
+
+    /**
+     * @ngdoc service
+     * @name $templateCache
+     *
+     * @description
+     * The first time a template is used, it is loaded in the template cache for quick retrieval. You
+     * can load templates directly into the cache in a `script` tag, or by consuming the
+     * `$templateCache` service directly.
+     *
+     * Adding via the `script` tag:
+     *
+     * ```html
+     *   <script type="text/ng-template" id="templateId.html">
+     *     <p>This is the content of the template</p>
+     *   </script>
+     * ```
+     *
+     * **Note:** the `script` tag containing the template does not need to be included in the `head` of
+     * the document, but it must be below the `ng-app` definition.
+     *
+     * Adding via the $templateCache service:
+     *
+     * ```js
+     * var myApp = angular.module('myApp', []);
+     * myApp.run(function($templateCache) {
+ *   $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+     * ```
+     *
+     * To retrieve the template later, simply use it in your HTML:
+     * ```html
+     * <div ng-include=" 'templateId.html' "></div>
+     * ```
+     *
+     * or get it via Javascript:
+     * ```js
+     * $templateCache.get('templateId.html')
+     * ```
+     *
+     * See {@link ng.$cacheFactory $cacheFactory}.
+     *
+     */
+    function $TemplateCacheProvider() {
+        this.$get = ['$cacheFactory', function($cacheFactory) {
+            return $cacheFactory('templates');
+        }];
+    }
+
+    /* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
+     *
+     * DOM-related variables:
+     *
+     * - "node" - DOM Node
+     * - "element" - DOM Element or Node
+     * - "$node" or "$element" - jqLite-wrapped node or element
+     *
+     *
+     * Compiler related stuff:
+     *
+     * - "linkFn" - linking fn of a single directive
+     * - "nodeLinkFn" - function that aggregates all linking fns for a particular node
+     * - "childLinkFn" -  function that aggregates all linking fns for child nodes of a particular node
+     * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
+     */
+
+
+    /**
+     * @ngdoc service
+     * @name $compile
+     * @function
+     *
+     * @description
+     * Compiles an HTML string or DOM into a template and produces a template function, which
+     * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
+     *
+     * The compilation is a process of walking the DOM tree and matching DOM elements to
+     * {@link ng.$compileProvider#directive directives}.
+     *
+     * <div class="alert alert-warning">
+     * **Note:** This document is an in-depth reference of all directive options.
+     * For a gentle introduction to directives with examples of common use cases,
+     * see the {@link guide/directive directive guide}.
+     * </div>
+     *
+     * ## Comprehensive Directive API
+     *
+     * There are many different options for a directive.
+     *
+     * The difference resides in the return value of the factory function.
+     * You can either return a "Directive Definition Object" (see below) that defines the directive properties,
+     * or just the `postLink` function (all other properties will have the default values).
+     *
+     * <div class="alert alert-success">
+     * **Best Practice:** It's recommended to use the "directive definition object" form.
+     * </div>
+     *
+     * Here's an example directive declared with a Directive Definition Object:
+     *
+     * ```js
+     *   var myModule = angular.module(...);
+     *
+     *   myModule.directive('directiveName', function factory(injectables) {
+ *     var directiveDefinitionObject = {
+ *       priority: 0,
+ *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ *       // or
+ *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ *       replace: false,
+ *       transclude: false,
+ *       restrict: 'A',
+ *       scope: false,
+ *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ *       controllerAs: 'stringAlias',
+ *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ *       compile: function compile(tElement, tAttrs, transclude) {
+ *         return {
+ *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ *           post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ *         }
+ *         // or
+ *         // return function postLink( ... ) { ... }
+ *       },
+ *       // or
+ *       // link: {
+ *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ *       // }
+ *       // or
+ *       // link: function postLink( ... ) { ... }
+ *     };
+ *     return directiveDefinitionObject;
+ *   });
+     * ```
+     *
+     * <div class="alert alert-warning">
+     * **Note:** Any unspecified options will use the default value. You can see the default values below.
+     * </div>
+     *
+     * Therefore the above can be simplified as:
+     *
+     * ```js
+     *   var myModule = angular.module(...);
+     *
+     *   myModule.directive('directiveName', function factory(injectables) {
+ *     var directiveDefinitionObject = {
+ *       link: function postLink(scope, iElement, iAttrs) { ... }
+ *     };
+ *     return directiveDefinitionObject;
+ *     // or
+ *     // return function postLink(scope, iElement, iAttrs) { ... }
+ *   });
+     * ```
+     *
+     *
+     *
+     * ### Directive Definition Object
+     *
+     * The directive definition object provides instructions to the {@link ng.$compile
+ * compiler}. The attributes are:
+     *
+     * #### `priority`
+     * When there are multiple directives defined on a single DOM element, sometimes it
+     * is necessary to specify the order in which the directives are applied. The `priority` is used
+     * to sort the directives before their `compile` functions get called. Priority is defined as a
+     * number. Directives with greater numerical `priority` are compiled first. Pre-link functions
+     * are also run in priority order, but post-link functions are run in reverse order. The order
+     * of directives with the same priority is undefined. The default priority is `0`.
+     *
+     * #### `terminal`
+     * If set to true then the current `priority` will be the last set of directives
+     * which will execute (any directives at the current priority will still execute
+     * as the order of execution on same `priority` is undefined).
+     *
+     * #### `scope`
+     * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the
+     * same element request a new scope, only one new scope is created. The new scope rule does not
+     * apply for the root of the template since the root of the template always gets a new scope.
+     *
+     * **If set to `{}` (object hash),** then a new "isolate" scope is created. The 'isolate' scope differs from
+     * normal scope in that it does not prototypically inherit from the parent scope. This is useful
+     * when creating reusable components, which should not accidentally read or modify data in the
+     * parent scope.
+     *
+     * The 'isolate' scope takes an object hash which defines a set of local scope properties
+     * derived from the parent scope. These local properties are useful for aliasing values for
+     * templates. Locals definition is a hash of local scope property to its source:
+     *
+     * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is
+     *   always a string since DOM attributes are strings. If no `attr` name is specified  then the
+     *   attribute name is assumed to be the same as the local name.
+     *   Given `<widget my-attr="hello {{name}}">` and widget definition
+     *   of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect
+     *   the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the
+     *   `localName` property on the widget scope. The `name` is read from the parent scope (not
+     *   component scope).
+     *
+     * * `=` or `=attr` - set up bi-directional binding between a local scope property and the
+     *   parent scope property of name defined via the value of the `attr` attribute. If no `attr`
+     *   name is specified then the attribute name is assumed to be the same as the local name.
+     *   Given `<widget my-attr="parentModel">` and widget definition of
+     *   `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the
+     *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected
+     *   in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent
+     *   scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You
+     *   can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional.
+     *
+     * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope.
+     *   If no `attr` name is specified then the attribute name is assumed to be the same as the
+     *   local name. Given `<widget my-attr="count = count + value">` and widget definition of
+     *   `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to
+     *   a function wrapper for the `count = count + value` expression. Often it's desirable to
+     *   pass data from the isolated scope via an expression and to the parent scope, this can be
+     *   done by passing a map of local variable names and values into the expression wrapper fn.
+     *   For example, if the expression is `increment(amount)` then we can specify the amount value
+     *   by calling the `localFn` as `localFn({amount: 22})`.
+     *
+     *
+     *
+     * #### `controller`
+     * Controller constructor function. The controller is instantiated before the
+     * pre-linking phase and it is shared with other directives (see
+     * `require` attribute). This allows the directives to communicate with each other and augment
+     * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
+     *
+     * * `$scope` - Current scope associated with the element
+     * * `$element` - Current element
+     * * `$attrs` - Current attributes object for the element
+     * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope.
+     *    The scope can be overridden by an optional first argument.
+     *   `function([scope], cloneLinkingFn)`.
+     *
+     *
+     * #### `require`
+     * Require another directive and inject its controller as the fourth argument to the linking function. The
+     * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the
+     * injected argument will be an array in corresponding order. If no such directive can be
+     * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with:
+     *
+     * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
+     * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
+     * * `^` - Locate the required controller by searching the element's parents. Throw an error if not found.
+     * * `?^` - Attempt to locate the required controller by searching the element's parents or pass `null` to the
+     *   `link` fn if not found.
+     *
+     *
+     * #### `controllerAs`
+     * Controller alias at the directive scope. An alias for the controller so it
+     * can be referenced at the directive template. The directive needs to define a scope for this
+     * configuration to be used. Useful in the case when directive is used as component.
+     *
+     *
+     * #### `restrict`
+     * String of subset of `EACM` which restricts the directive to a specific directive
+     * declaration style. If omitted, the default (attributes only) is used.
+     *
+     * * `E` - Element name: `<my-directive></my-directive>`
+     * * `A` - Attribute (default): `<div my-directive="exp"></div>`
+     * * `C` - Class: `<div class="my-directive: exp;"></div>`
+     * * `M` - Comment: `<!-- directive: my-directive exp -->`
+     *
+     *
+     * #### `template`
+     * replace the current element with the contents of the HTML. The replacement process
+     * migrates all of the attributes / classes from the old element to the new one. See the
+     * {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive
+ * Directives Guide} for an example.
+     *
+     * You can specify `template` as a string representing the template or as a function which takes
+     * two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and
+     * returns a string value representing the template.
+     *
+     *
+     * #### `templateUrl`
+     * Same as `template` but the template is loaded from the specified URL. Because
+     * the template loading is asynchronous the compilation/linking is suspended until the template
+     * is loaded.
+     *
+     * You can specify `templateUrl` as a string representing the URL or as a function which takes two
+     * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
+     * a string value representing the url.  In either case, the template URL is passed through {@link
+        * api/ng.$sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
+     *
+     *
+     * #### `replace`
+     * specify where the template should be inserted. Defaults to `false`.
+     *
+     * * `true` - the template will replace the current element.
+     * * `false` - the template will replace the contents of the current element.
+     *
+     *
+     * #### `transclude`
+     * compile the content of the element and make it available to the directive.
+     * Typically used with {@link ng.directive:ngTransclude
+ * ngTransclude}. The advantage of transclusion is that the linking function receives a
+     * transclusion function which is pre-bound to the correct scope. In a typical setup the widget
+     * creates an `isolate` scope, but the transclusion is not a child, but a sibling of the `isolate`
+     * scope. This makes it possible for the widget to have private state, and the transclusion to
+     * be bound to the parent (pre-`isolate`) scope.
+     *
+     * * `true` - transclude the content of the directive.
+     * * `'element'` - transclude the whole element including any directives defined at lower priority.
+     *
+     *
+     * #### `compile`
+     *
+     * ```js
+     *   function compile(tElement, tAttrs, transclude) { ... }
+     * ```
+     *
+     * The compile function deals with transforming the template DOM. Since most directives do not do
+     * template transformation, it is not used often. Examples that require compile functions are
+     * directives that transform template DOM, such as {@link
+        * api/ng.directive:ngRepeat ngRepeat}, or load the contents
+     * asynchronously, such as {@link ngRoute.directive:ngView ngView}. The
+     * compile function takes the following arguments.
+     *
+     *   * `tElement` - template element - The element where the directive has been declared. It is
+     *     safe to do template transformation on the element and child elements only.
+     *
+     *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
+     *     between all directive compile functions.
+     *
+     *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
+     *
+     * <div class="alert alert-warning">
+     * **Note:** The template instance and the link instance may be different objects if the template has
+     * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that
+     * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
+     * should be done in a linking function rather than in a compile function.
+     * </div>
+
+     * <div class="alert alert-warning">
+     * **Note:** The compile function cannot handle directives that recursively use themselves in their
+     * own templates or compile functions. Compiling these directives results in an infinite loop and a
+     * stack overflow errors.
+     *
+     * This can be avoided by manually using $compile in the postLink function to imperatively compile
+     * a directive's template instead of relying on automatic template compilation via `template` or
+     * `templateUrl` declaration or manual compilation inside the compile function.
+     * </div>
+     *
+     * <div class="alert alert-error">
+     * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
+     *   e.g. does not know about the right outer scope. Please use the transclude function that is passed
+     *   to the link function instead.
+     * </div>
+
+     * A compile function can have a return value which can be either a function or an object.
+     *
+     * * returning a (post-link) function - is equivalent to registering the linking function via the
+     *   `link` property of the config object when the compile function is empty.
+     *
+     * * returning an object with function(s) registered via `pre` and `post` properties - allows you to
+     *   control when a linking function should be called during the linking phase. See info about
+     *   pre-linking and post-linking functions below.
+     *
+     *
+     * #### `link`
+     * This property is used only if the `compile` property is not defined.
+     *
+     * ```js
+     *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
+     * ```
+     *
+     * The link function is responsible for registering DOM listeners as well as updating the DOM. It is
+     * executed after the template has been cloned. This is where most of the directive logic will be
+     * put.
+     *
+     *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the
+     *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.
+     *
+     *   * `iElement` - instance element - The element where the directive is to be used. It is safe to
+     *     manipulate the children of the element only in `postLink` function since the children have
+     *     already been linked.
+     *
+     *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
+     *     between all directive linking functions.
+     *
+     *   * `controller` - a controller instance - A controller instance if at least one directive on the
+     *     element defines a controller. The controller is shared among all the directives, which allows
+     *     the directives to use the controllers as a communication channel.
+     *
+     *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
+     *     The scope can be overridden by an optional first argument. This is the same as the `$transclude`
+     *     parameter of directive controllers.
+     *     `function([scope], cloneLinkingFn)`.
+     *
+     *
+     * #### Pre-linking function
+     *
+     * Executed before the child elements are linked. Not safe to do DOM transformation since the
+     * compiler linking function will fail to locate the correct elements for linking.
+     *
+     * #### Post-linking function
+     *
+     * Executed after the child elements are linked. It is safe to do DOM transformation in the post-linking function.
+     *
+     * <a name="Attributes"></a>
+     * ### Attributes
+     *
+     * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
+     * `link()` or `compile()` functions. It has a variety of uses.
+     *
+     * accessing *Normalized attribute names:*
+     * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'.
+     * the attributes object allows for normalized access to
+     *   the attributes.
+     *
+     * * *Directive inter-communication:* All directives share the same instance of the attributes
+     *   object which allows the directives to use the attributes object as inter directive
+     *   communication.
+     *
+     * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object
+     *   allowing other directives to read the interpolated value.
+     *
+     * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes
+     *   that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also
+     *   the only way to easily get the actual value because during the linking phase the interpolation
+     *   hasn't been evaluated yet and so the value is at this time set to `undefined`.
+     *
+     * ```js
+     * function linkingFn(scope, elm, attrs, ctrl) {
+ *   // get the attribute value
+ *   console.log(attrs.ngModel);
+ *
+ *   // change the attribute
+ *   attrs.$set('ngModel', 'new value');
+ *
+ *   // observe changes to interpolated attribute
+ *   attrs.$observe('ngModel', function(value) {
+ *     console.log('ngModel has changed value to ' + value);
+ *   });
+ * }
+     * ```
+     *
+     * Below is an example using `$compileProvider`.
+     *
+     * <div class="alert alert-warning">
+     * **Note**: Typically directives are registered with `module.directive`. The example below is
+     * to illustrate how `$compile` works.
+     * </div>
+     *
+     <example module="compile">
+     <file name="index.html">
+     <script>
+     angular.module('compile', [], function($compileProvider) {
+        // configure new 'compile' directive by passing a directive
+        // factory function. The factory function injects the '$compile'
+        $compileProvider.directive('compile', function($compile) {
+          // directive factory creates a link function
+          return function(scope, element, attrs) {
+            scope.$watch(
+              function(scope) {
+                 // watch the 'compile' expression for changes
+                return scope.$eval(attrs.compile);
+              },
+              function(value) {
+                // when the 'compile' expression changes
+                // assign it into the current DOM
+                element.html(value);
+
+                // compile the new DOM and link it to the current
+                // scope.
+                // NOTE: we only compile .childNodes so that
+                // we don't get into infinite loop compiling ourselves
+                $compile(element.contents())(scope);
+              }
+            );
+          };
+        })
+      });
+
+     function Ctrl($scope) {
+        $scope.name = 'Angular';
+        $scope.html = 'Hello {{name}}';
+      }
+     </script>
+     <div ng-controller="Ctrl">
+     <input ng-model="name"> <br>
+     <textarea ng-model="html"></textarea> <br>
+     <div compile="html"></div>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should auto compile', function() {
+       var textarea = $('textarea');
+       var output = $('div[compile]');
+       // The initial state reads 'Hello Angular'.
+       expect(output.getText()).toBe('Hello Angular');
+       textarea.clear();
+       textarea.sendKeys('{{name}}!');
+       expect(output.getText()).toBe('Angular!');
+     });
+     </file>
+     </example>
+
+     *
+     *
+     * @param {string|DOMElement} element Element or HTML string to compile into a template function.
+     * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives.
+     * @param {number} maxPriority only apply directives lower than given priority (Only effects the
+     *                 root element(s), not their children)
+     * @returns {function(scope, cloneAttachFn=)} a link function which is used to bind template
+     * (a DOM element/tree) to a scope. Where:
+     *
+     *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
+     *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
+     *  `template` and call the `cloneAttachFn` function allowing the caller to attach the
+     *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
+     *  called as: <br> `cloneAttachFn(clonedElement, scope)` where:
+     *
+     *      * `clonedElement` - is a clone of the original `element` passed into the compiler.
+     *      * `scope` - is the current scope with which the linking function is working with.
+     *
+     * Calling the linking function returns the element of the template. It is either the original
+     * element passed in, or the clone of the element if the `cloneAttachFn` is provided.
+     *
+     * After linking the view is not updated until after a call to $digest which typically is done by
+     * Angular automatically.
+     *
+     * If you need access to the bound view, there are two ways to do it:
+     *
+     * - If you are not asking the linking function to clone the template, create the DOM element(s)
+     *   before you send them to the compiler and keep this reference around.
+     *   ```js
+     *     var element = $compile('<p>{{total}}</p>')(scope);
+     *   ```
+     *
+     * - if on the other hand, you need the element to be cloned, the view reference from the original
+     *   example would not point to the clone, but rather to the original template that was cloned. In
+     *   this case, you can access the clone via the cloneAttachFn:
+     *   ```js
+     *     var templateElement = angular.element('<p>{{total}}</p>'),
+     *         scope = ....;
+     *
+     *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
+ *       //attach the clone to DOM document at the right place
+ *     });
+     *
+     *     //now we have reference to the cloned DOM via `clonedElement`
+     *   ```
+     *
+     *
+     * For information on how the compiler works, see the
+     * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
+     */
+
+    var $compileMinErr = minErr('$compile');
+
+    /**
+     * @ngdoc provider
+     * @name $compileProvider
+     * @function
+     *
+     * @description
+     */
+    $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
+    function $CompileProvider($provide, $$sanitizeUriProvider) {
+        var hasDirectives = {},
+            Suffix = 'Directive',
+            COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
+            CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/;
+
+        // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
+        // The assumption is that future DOM event attribute names will begin with
+        // 'on' and be composed of only English letters.
+        var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
+
+        /**
+         * @ngdoc method
+         * @name $compileProvider#directive
+         * @function
+         *
+         * @description
+         * Register a new directive with the compiler.
+         *
+         * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
+         *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the
+         *    names and the values are the factories.
+         * @param {Function|Array} directiveFactory An injectable directive factory function. See
+         *    {@link guide/directive} for more info.
+         * @returns {ng.$compileProvider} Self for chaining.
+         */
+        this.directive = function registerDirective(name, directiveFactory) {
+            assertNotHasOwnProperty(name, 'directive');
+            if (isString(name)) {
+                assertArg(directiveFactory, 'directiveFactory');
+                if (!hasDirectives.hasOwnProperty(name)) {
+                    hasDirectives[name] = [];
+                    $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
+                        function($injector, $exceptionHandler) {
+                            var directives = [];
+                            forEach(hasDirectives[name], function(directiveFactory, index) {
+                                try {
+                                    var directive = $injector.invoke(directiveFactory);
+                                    if (isFunction(directive)) {
+                                        directive = { compile: valueFn(directive) };
+                                    } else if (!directive.compile && directive.link) {
+                                        directive.compile = valueFn(directive.link);
+                                    }
+                                    directive.priority = directive.priority || 0;
+                                    directive.index = index;
+                                    directive.name = directive.name || name;
+                                    directive.require = directive.require || (directive.controller && directive.name);
+                                    directive.restrict = directive.restrict || 'A';
+                                    directives.push(directive);
+                                } catch (e) {
+                                    $exceptionHandler(e);
+                                }
+                            });
+                            return directives;
+                        }]);
+                }
+                hasDirectives[name].push(directiveFactory);
+            } else {
+                forEach(name, reverseParams(registerDirective));
+            }
+            return this;
+        };
+
+
+        /**
+         * @ngdoc method
+         * @name $compileProvider#aHrefSanitizationWhitelist
+         * @function
+         *
+         * @description
+         * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+         * urls during a[href] sanitization.
+         *
+         * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+         *
+         * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+         * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+         * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+         * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+         *
+         * @param {RegExp=} regexp New regexp to whitelist urls with.
+         * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+         *    chaining otherwise.
+         */
+        this.aHrefSanitizationWhitelist = function(regexp) {
+            if (isDefined(regexp)) {
+                $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
+                return this;
+            } else {
+                return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
+            }
+        };
+
+
+        /**
+         * @ngdoc method
+         * @name $compileProvider#imgSrcSanitizationWhitelist
+         * @function
+         *
+         * @description
+         * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+         * urls during img[src] sanitization.
+         *
+         * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+         *
+         * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+         * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+         * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+         * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+         *
+         * @param {RegExp=} regexp New regexp to whitelist urls with.
+         * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+         *    chaining otherwise.
+         */
+        this.imgSrcSanitizationWhitelist = function(regexp) {
+            if (isDefined(regexp)) {
+                $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
+                return this;
+            } else {
+                return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
+            }
+        };
+
+        this.$get = [
+            '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
+            '$controller', '$rootScope', '$document', '$sce', '$animate', '$$sanitizeUri',
+            function($injector,   $interpolate,   $exceptionHandler,   $http,   $templateCache,   $parse,
+                     $controller,   $rootScope,   $document,   $sce,   $animate,   $$sanitizeUri) {
+
+                var Attributes = function(element, attr) {
+                    this.$$element = element;
+                    this.$attr = attr || {};
+                };
+
+                Attributes.prototype = {
+                    $normalize: directiveNormalize,
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $compile.directive.Attributes#$addClass
+                     * @function
+                     *
+                     * @description
+                     * Adds the CSS class value specified by the classVal parameter to the element. If animations
+                     * are enabled then an animation will be triggered for the class addition.
+                     *
+                     * @param {string} classVal The className value that will be added to the element
+                     */
+                    $addClass : function(classVal) {
+                        if(classVal && classVal.length > 0) {
+                            $animate.addClass(this.$$element, classVal);
+                        }
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $compile.directive.Attributes#$removeClass
+                     * @function
+                     *
+                     * @description
+                     * Removes the CSS class value specified by the classVal parameter from the element. If
+                     * animations are enabled then an animation will be triggered for the class removal.
+                     *
+                     * @param {string} classVal The className value that will be removed from the element
+                     */
+                    $removeClass : function(classVal) {
+                        if(classVal && classVal.length > 0) {
+                            $animate.removeClass(this.$$element, classVal);
+                        }
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $compile.directive.Attributes#$updateClass
+                     * @function
+                     *
+                     * @description
+                     * Adds and removes the appropriate CSS class values to the element based on the difference
+                     * between the new and old CSS class values (specified as newClasses and oldClasses).
+                     *
+                     * @param {string} newClasses The current CSS className value
+                     * @param {string} oldClasses The former CSS className value
+                     */
+                    $updateClass : function(newClasses, oldClasses) {
+                        var toAdd = tokenDifference(newClasses, oldClasses);
+                        var toRemove = tokenDifference(oldClasses, newClasses);
+
+                        if(toAdd.length === 0) {
+                            $animate.removeClass(this.$$element, toRemove);
+                        } else if(toRemove.length === 0) {
+                            $animate.addClass(this.$$element, toAdd);
+                        } else {
+                            $animate.setClass(this.$$element, toAdd, toRemove);
+                        }
+                    },
+
+                    /**
+                     * Set a normalized attribute on the element in a way such that all directives
+                     * can share the attribute. This function properly handles boolean attributes.
+                     * @param {string} key Normalized key. (ie ngAttribute)
+                     * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
+                     * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
+                     *     Defaults to true.
+                     * @param {string=} attrName Optional none normalized name. Defaults to key.
+                     */
+                    $set: function(key, value, writeAttr, attrName) {
+                        // TODO: decide whether or not to throw an error if "class"
+                        //is set through this function since it may cause $updateClass to
+                        //become unstable.
+
+                        var booleanKey = getBooleanAttrName(this.$$element[0], key),
+                            normalizedVal,
+                            nodeName;
+
+                        if (booleanKey) {
+                            this.$$element.prop(key, value);
+                            attrName = booleanKey;
+                        }
+
+                        this[key] = value;
+
+                        // translate normalized key to actual key
+                        if (attrName) {
+                            this.$attr[key] = attrName;
+                        } else {
+                            attrName = this.$attr[key];
+                            if (!attrName) {
+                                this.$attr[key] = attrName = snake_case(key, '-');
+                            }
+                        }
+
+                        nodeName = nodeName_(this.$$element);
+
+                        // sanitize a[href] and img[src] values
+                        if ((nodeName === 'A' && key === 'href') ||
+                            (nodeName === 'IMG' && key === 'src')) {
+                            this[key] = value = $$sanitizeUri(value, key === 'src');
+                        }
+
+                        if (writeAttr !== false) {
+                            if (value === null || value === undefined) {
+                                this.$$element.removeAttr(attrName);
+                            } else {
+                                this.$$element.attr(attrName, value);
+                            }
+                        }
+
+                        // fire observers
+                        var $$observers = this.$$observers;
+                        $$observers && forEach($$observers[key], function(fn) {
+                            try {
+                                fn(value);
+                            } catch (e) {
+                                $exceptionHandler(e);
+                            }
+                        });
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $compile.directive.Attributes#$observe
+                     * @function
+                     *
+                     * @description
+                     * Observes an interpolated attribute.
+                     *
+                     * The observer function will be invoked once during the next `$digest` following
+                     * compilation. The observer is then invoked whenever the interpolated value
+                     * changes.
+                     *
+                     * @param {string} key Normalized key. (ie ngAttribute) .
+                     * @param {function(interpolatedValue)} fn Function that will be called whenever
+                     the interpolated value of the attribute changes.
+                     *        See the {@link guide/directive#Attributes Directives} guide for more info.
+                     * @returns {function()} the `fn` parameter.
+                     */
+                    $observe: function(key, fn) {
+                        var attrs = this,
+                            $$observers = (attrs.$$observers || (attrs.$$observers = {})),
+                            listeners = ($$observers[key] || ($$observers[key] = []));
+
+                        listeners.push(fn);
+                        $rootScope.$evalAsync(function() {
+                            if (!listeners.$$inter) {
+                                // no one registered attribute interpolation function, so lets call it manually
+                                fn(attrs[key]);
+                            }
+                        });
+                        return fn;
+                    }
+                };
+
+                var startSymbol = $interpolate.startSymbol(),
+                    endSymbol = $interpolate.endSymbol(),
+                    denormalizeTemplate = (startSymbol == '{{' || endSymbol  == '}}')
+                        ? identity
+                        : function denormalizeTemplate(template) {
+                        return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+                    },
+                    NG_ATTR_BINDING = /^ngAttr[A-Z]/;
+
+
+                return compile;
+
+                //================================
+
+                function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
+                                 previousCompileContext) {
+                    if (!($compileNodes instanceof jqLite)) {
+                        // jquery always rewraps, whereas we need to preserve the original selector so that we can
+                        // modify it.
+                        $compileNodes = jqLite($compileNodes);
+                    }
+                    // We can not compile top level text elements since text nodes can be merged and we will
+                    // not be able to attach scope data to them, so we will wrap them in <span>
+                    forEach($compileNodes, function(node, index){
+                        if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) {
+                            $compileNodes[index] = node = jqLite(node).wrap('<span></span>').parent()[0];
+                        }
+                    });
+                    var compositeLinkFn =
+                        compileNodes($compileNodes, transcludeFn, $compileNodes,
+                            maxPriority, ignoreDirective, previousCompileContext);
+                    safeAddClass($compileNodes, 'ng-scope');
+                    return function publicLinkFn(scope, cloneConnectFn, transcludeControllers){
+                        assertArg(scope, 'scope');
+                        // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
+                        // and sometimes changes the structure of the DOM.
+                        var $linkNode = cloneConnectFn
+                            ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
+                            : $compileNodes;
+
+                        forEach(transcludeControllers, function(instance, name) {
+                            $linkNode.data('$' + name + 'Controller', instance);
+                        });
+
+                        // Attach scope only to non-text nodes.
+                        for(var i = 0, ii = $linkNode.length; i<ii; i++) {
+                            var node = $linkNode[i],
+                                nodeType = node.nodeType;
+                            if (nodeType === 1 /* element */ || nodeType === 9 /* document */) {
+                                $linkNode.eq(i).data('$scope', scope);
+                            }
+                        }
+
+                        if (cloneConnectFn) cloneConnectFn($linkNode, scope);
+                        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
+                        return $linkNode;
+                    };
+                }
+
+                function safeAddClass($element, className) {
+                    try {
+                        $element.addClass(className);
+                    } catch(e) {
+                        // ignore, since it means that we are trying to set class on
+                        // SVG element, where class name is read-only.
+                    }
+                }
+
+                /**
+                 * Compile function matches each node in nodeList against the directives. Once all directives
+                 * for a particular node are collected their compile functions are executed. The compile
+                 * functions return values - the linking functions - are combined into a composite linking
+                 * function, which is the a linking function for the node.
+                 *
+                 * @param {NodeList} nodeList an array of nodes or NodeList to compile
+                 * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+                 *        scope argument is auto-generated to the new child of the transcluded parent scope.
+                 * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
+                 *        the rootElement must be set the jqLite collection of the compile root. This is
+                 *        needed so that the jqLite collection items can be replaced with widgets.
+                 * @param {number=} maxPriority Max directive priority.
+                 * @returns {Function} A composite linking function of all of the matched directives or null.
+                 */
+                function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
+                                      previousCompileContext) {
+                    var linkFns = [],
+                        attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound;
+
+                    for (var i = 0; i < nodeList.length; i++) {
+                        attrs = new Attributes();
+
+                        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+                        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
+                            ignoreDirective);
+
+                        nodeLinkFn = (directives.length)
+                            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
+                            null, [], [], previousCompileContext)
+                            : null;
+
+                        if (nodeLinkFn && nodeLinkFn.scope) {
+                            safeAddClass(jqLite(nodeList[i]), 'ng-scope');
+                        }
+
+                        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
+                        !(childNodes = nodeList[i].childNodes) ||
+                        !childNodes.length)
+                            ? null
+                            : compileNodes(childNodes,
+                            nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
+
+                        linkFns.push(nodeLinkFn, childLinkFn);
+                        linkFnFound = linkFnFound || nodeLinkFn || childLinkFn;
+                        //use the previous context only for the first element in the virtual group
+                        previousCompileContext = null;
+                    }
+
+                    // return a linking function if we have found anything, null otherwise
+                    return linkFnFound ? compositeLinkFn : null;
+
+                    function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {
+                        var nodeLinkFn, childLinkFn, node, $node, childScope, childTranscludeFn, i, ii, n;
+
+                        // copy nodeList so that linking doesn't break due to live list updates.
+                        var nodeListLength = nodeList.length,
+                            stableNodeList = new Array(nodeListLength);
+                        for (i = 0; i < nodeListLength; i++) {
+                            stableNodeList[i] = nodeList[i];
+                        }
+
+                        for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
+                            node = stableNodeList[n];
+                            nodeLinkFn = linkFns[i++];
+                            childLinkFn = linkFns[i++];
+                            $node = jqLite(node);
+
+                            if (nodeLinkFn) {
+                                if (nodeLinkFn.scope) {
+                                    childScope = scope.$new();
+                                    $node.data('$scope', childScope);
+                                } else {
+                                    childScope = scope;
+                                }
+                                childTranscludeFn = nodeLinkFn.transclude;
+                                if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
+                                    nodeLinkFn(childLinkFn, childScope, node, $rootElement,
+                                        createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn)
+                                    );
+                                } else {
+                                    nodeLinkFn(childLinkFn, childScope, node, $rootElement, boundTranscludeFn);
+                                }
+                            } else if (childLinkFn) {
+                                childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
+                            }
+                        }
+                    }
+                }
+
+                function createBoundTranscludeFn(scope, transcludeFn) {
+                    return function boundTranscludeFn(transcludedScope, cloneFn, controllers) {
+                        var scopeCreated = false;
+
+                        if (!transcludedScope) {
+                            transcludedScope = scope.$new();
+                            transcludedScope.$$transcluded = true;
+                            scopeCreated = true;
+                        }
+
+                        var clone = transcludeFn(transcludedScope, cloneFn, controllers);
+                        if (scopeCreated) {
+                            clone.on('$destroy', bind(transcludedScope, transcludedScope.$destroy));
+                        }
+                        return clone;
+                    };
+                }
+
+                /**
+                 * Looks for directives on the given node and adds them to the directive collection which is
+                 * sorted.
+                 *
+                 * @param node Node to search.
+                 * @param directives An array to which the directives are added to. This array is sorted before
+                 *        the function returns.
+                 * @param attrs The shared attrs object which is used to populate the normalized attributes.
+                 * @param {number=} maxPriority Max directive priority.
+                 */
+                function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+                    var nodeType = node.nodeType,
+                        attrsMap = attrs.$attr,
+                        match,
+                        className;
+
+                    switch(nodeType) {
+                        case 1: /* Element */
+                            // use the node name: <directive>
+                            addDirective(directives,
+                                directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority, ignoreDirective);
+
+                            // iterate over the attributes
+                            for (var attr, name, nName, ngAttrName, value, nAttrs = node.attributes,
+                                     j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
+                                var attrStartName = false;
+                                var attrEndName = false;
+
+                                attr = nAttrs[j];
+                                if (!msie || msie >= 8 || attr.specified) {
+                                    name = attr.name;
+                                    // support ngAttr attribute binding
+                                    ngAttrName = directiveNormalize(name);
+                                    if (NG_ATTR_BINDING.test(ngAttrName)) {
+                                        name = snake_case(ngAttrName.substr(6), '-');
+                                    }
+
+                                    var directiveNName = ngAttrName.replace(/(Start|End)$/, '');
+                                    if (ngAttrName === directiveNName + 'Start') {
+                                        attrStartName = name;
+                                        attrEndName = name.substr(0, name.length - 5) + 'end';
+                                        name = name.substr(0, name.length - 6);
+                                    }
+
+                                    nName = directiveNormalize(name.toLowerCase());
+                                    attrsMap[nName] = name;
+                                    attrs[nName] = value = trim(attr.value);
+                                    if (getBooleanAttrName(node, nName)) {
+                                        attrs[nName] = true; // presence means true
+                                    }
+                                    addAttrInterpolateDirective(node, directives, value, nName);
+                                    addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
+                                        attrEndName);
+                                }
+                            }
+
+                            // use class as directive
+                            className = node.className;
+                            if (isString(className) && className !== '') {
+                                while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
+                                    nName = directiveNormalize(match[2]);
+                                    if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
+                                        attrs[nName] = trim(match[3]);
+                                    }
+                                    className = className.substr(match.index + match[0].length);
+                                }
+                            }
+                            break;
+                        case 3: /* Text Node */
+                            addTextInterpolateDirective(directives, node.nodeValue);
+                            break;
+                        case 8: /* Comment */
+                            try {
+                                match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+                                if (match) {
+                                    nName = directiveNormalize(match[1]);
+                                    if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+                                        attrs[nName] = trim(match[2]);
+                                    }
+                                }
+                            } catch (e) {
+                                // turns out that under some circumstances IE9 throws errors when one attempts to read
+                                // comment's node value.
+                                // Just ignore it and continue. (Can't seem to reproduce in test case.)
+                            }
+                            break;
+                    }
+
+                    directives.sort(byPriority);
+                    return directives;
+                }
+
+                /**
+                 * Given a node with an directive-start it collects all of the siblings until it finds
+                 * directive-end.
+                 * @param node
+                 * @param attrStart
+                 * @param attrEnd
+                 * @returns {*}
+                 */
+                function groupScan(node, attrStart, attrEnd) {
+                    var nodes = [];
+                    var depth = 0;
+                    if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
+                        var startNode = node;
+                        do {
+                            if (!node) {
+                                throw $compileMinErr('uterdir',
+                                    "Unterminated attribute, found '{0}' but no matching '{1}' found.",
+                                    attrStart, attrEnd);
+                            }
+                            if (node.nodeType == 1 /** Element **/) {
+                                if (node.hasAttribute(attrStart)) depth++;
+                                if (node.hasAttribute(attrEnd)) depth--;
+                            }
+                            nodes.push(node);
+                            node = node.nextSibling;
+                        } while (depth > 0);
+                    } else {
+                        nodes.push(node);
+                    }
+
+                    return jqLite(nodes);
+                }
+
+                /**
+                 * Wrapper for linking function which converts normal linking function into a grouped
+                 * linking function.
+                 * @param linkFn
+                 * @param attrStart
+                 * @param attrEnd
+                 * @returns {Function}
+                 */
+                function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
+                    return function(scope, element, attrs, controllers, transcludeFn) {
+                        element = groupScan(element[0], attrStart, attrEnd);
+                        return linkFn(scope, element, attrs, controllers, transcludeFn);
+                    };
+                }
+
+                /**
+                 * Once the directives have been collected, their compile functions are executed. This method
+                 * is responsible for inlining directive templates as well as terminating the application
+                 * of the directives if the terminal directive has been reached.
+                 *
+                 * @param {Array} directives Array of collected directives to execute their compile function.
+                 *        this needs to be pre-sorted by priority order.
+                 * @param {Node} compileNode The raw DOM node to apply the compile functions to
+                 * @param {Object} templateAttrs The shared attribute function
+                 * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+                 *                                                  scope argument is auto-generated to the new
+                 *                                                  child of the transcluded parent scope.
+                 * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
+                 *                              argument has the root jqLite array so that we can replace nodes
+                 *                              on it.
+                 * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
+                 *                                           compiling the transclusion.
+                 * @param {Array.<Function>} preLinkFns
+                 * @param {Array.<Function>} postLinkFns
+                 * @param {Object} previousCompileContext Context used for previous compilation of the current
+                 *                                        node
+                 * @returns {Function} linkFn
+                 */
+                function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
+                                               jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
+                                               previousCompileContext) {
+                    previousCompileContext = previousCompileContext || {};
+
+                    var terminalPriority = -Number.MAX_VALUE,
+                        newScopeDirective,
+                        controllerDirectives = previousCompileContext.controllerDirectives,
+                        newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
+                        templateDirective = previousCompileContext.templateDirective,
+                        nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
+                        hasTranscludeDirective = false,
+                        hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
+                        $compileNode = templateAttrs.$$element = jqLite(compileNode),
+                        directive,
+                        directiveName,
+                        $template,
+                        replaceDirective = originalReplaceDirective,
+                        childTranscludeFn = transcludeFn,
+                        linkFn,
+                        directiveValue;
+
+                    // executes all directives on the current element
+                    for(var i = 0, ii = directives.length; i < ii; i++) {
+                        directive = directives[i];
+                        var attrStart = directive.$$start;
+                        var attrEnd = directive.$$end;
+
+                        // collect multiblock sections
+                        if (attrStart) {
+                            $compileNode = groupScan(compileNode, attrStart, attrEnd);
+                        }
+                        $template = undefined;
+
+                        if (terminalPriority > directive.priority) {
+                            break; // prevent further processing of directives
+                        }
+
+                        if (directiveValue = directive.scope) {
+                            newScopeDirective = newScopeDirective || directive;
+
+                            // skip the check for directives with async templates, we'll check the derived sync
+                            // directive when the template arrives
+                            if (!directive.templateUrl) {
+                                assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
+                                    $compileNode);
+                                if (isObject(directiveValue)) {
+                                    newIsolateScopeDirective = directive;
+                                }
+                            }
+                        }
+
+                        directiveName = directive.name;
+
+                        if (!directive.templateUrl && directive.controller) {
+                            directiveValue = directive.controller;
+                            controllerDirectives = controllerDirectives || {};
+                            assertNoDuplicate("'" + directiveName + "' controller",
+                                controllerDirectives[directiveName], directive, $compileNode);
+                            controllerDirectives[directiveName] = directive;
+                        }
+
+                        if (directiveValue = directive.transclude) {
+                            hasTranscludeDirective = true;
+
+                            // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
+                            // This option should only be used by directives that know how to safely handle element transclusion,
+                            // where the transcluded nodes are added or replaced after linking.
+                            if (!directive.$$tlb) {
+                                assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
+                                nonTlbTranscludeDirective = directive;
+                            }
+
+                            if (directiveValue == 'element') {
+                                hasElementTranscludeDirective = true;
+                                terminalPriority = directive.priority;
+                                $template = groupScan(compileNode, attrStart, attrEnd);
+                                $compileNode = templateAttrs.$$element =
+                                    jqLite(document.createComment(' ' + directiveName + ': ' +
+                                    templateAttrs[directiveName] + ' '));
+                                compileNode = $compileNode[0];
+                                replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode);
+
+                                childTranscludeFn = compile($template, transcludeFn, terminalPriority,
+                                    replaceDirective && replaceDirective.name, {
+                                        // Don't pass in:
+                                        // - controllerDirectives - otherwise we'll create duplicates controllers
+                                        // - newIsolateScopeDirective or templateDirective - combining templates with
+                                        //   element transclusion doesn't make sense.
+                                        //
+                                        // We need only nonTlbTranscludeDirective so that we prevent putting transclusion
+                                        // on the same element more than once.
+                                        nonTlbTranscludeDirective: nonTlbTranscludeDirective
+                                    });
+                            } else {
+                                $template = jqLite(jqLiteClone(compileNode)).contents();
+                                $compileNode.empty(); // clear contents
+                                childTranscludeFn = compile($template, transcludeFn);
+                            }
+                        }
+
+                        if (directive.template) {
+                            assertNoDuplicate('template', templateDirective, directive, $compileNode);
+                            templateDirective = directive;
+
+                            directiveValue = (isFunction(directive.template))
+                                ? directive.template($compileNode, templateAttrs)
+                                : directive.template;
+
+                            directiveValue = denormalizeTemplate(directiveValue);
+
+                            if (directive.replace) {
+                                replaceDirective = directive;
+                                if (jqLiteIsTextNode(directiveValue)) {
+                                    $template = [];
+                                } else {
+                                    $template = jqLite(directiveValue);
+                                }
+                                compileNode = $template[0];
+
+                                if ($template.length != 1 || compileNode.nodeType !== 1) {
+                                    throw $compileMinErr('tplrt',
+                                        "Template for directive '{0}' must have exactly one root element. {1}",
+                                        directiveName, '');
+                                }
+
+                                replaceWith(jqCollection, $compileNode, compileNode);
+
+                                var newTemplateAttrs = {$attr: {}};
+
+                                // combine directives from the original node and from the template:
+                                // - take the array of directives for this element
+                                // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)
+                                // - collect directives from the template and sort them by priority
+                                // - combine directives as: processed + template + unprocessed
+                                var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
+                                var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
+
+                                if (newIsolateScopeDirective) {
+                                    markDirectivesAsIsolate(templateDirectives);
+                                }
+                                directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
+                                mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
+
+                                ii = directives.length;
+                            } else {
+                                $compileNode.html(directiveValue);
+                            }
+                        }
+
+                        if (directive.templateUrl) {
+                            assertNoDuplicate('template', templateDirective, directive, $compileNode);
+                            templateDirective = directive;
+
+                            if (directive.replace) {
+                                replaceDirective = directive;
+                            }
+
+                            nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+                                templateAttrs, jqCollection, childTranscludeFn, preLinkFns, postLinkFns, {
+                                    controllerDirectives: controllerDirectives,
+                                    newIsolateScopeDirective: newIsolateScopeDirective,
+                                    templateDirective: templateDirective,
+                                    nonTlbTranscludeDirective: nonTlbTranscludeDirective
+                                });
+                            ii = directives.length;
+                        } else if (directive.compile) {
+                            try {
+                                linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
+                                if (isFunction(linkFn)) {
+                                    addLinkFns(null, linkFn, attrStart, attrEnd);
+                                } else if (linkFn) {
+                                    addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);
+                                }
+                            } catch (e) {
+                                $exceptionHandler(e, startingTag($compileNode));
+                            }
+                        }
+
+                        if (directive.terminal) {
+                            nodeLinkFn.terminal = true;
+                            terminalPriority = Math.max(terminalPriority, directive.priority);
+                        }
+
+                    }
+
+                    nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
+                    nodeLinkFn.transclude = hasTranscludeDirective && childTranscludeFn;
+                    previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
+
+                    // might be normal or delayed nodeLinkFn depending on if templateUrl is present
+                    return nodeLinkFn;
+
+                    ////////////////////
+
+                    function addLinkFns(pre, post, attrStart, attrEnd) {
+                        if (pre) {
+                            if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
+                            pre.require = directive.require;
+                            if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+                                pre = cloneAndAnnotateFn(pre, {isolateScope: true});
+                            }
+                            preLinkFns.push(pre);
+                        }
+                        if (post) {
+                            if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
+                            post.require = directive.require;
+                            if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+                                post = cloneAndAnnotateFn(post, {isolateScope: true});
+                            }
+                            postLinkFns.push(post);
+                        }
+                    }
+
+
+                    function getControllers(require, $element, elementControllers) {
+                        var value, retrievalMethod = 'data', optional = false;
+                        if (isString(require)) {
+                            while((value = require.charAt(0)) == '^' || value == '?') {
+                                require = require.substr(1);
+                                if (value == '^') {
+                                    retrievalMethod = 'inheritedData';
+                                }
+                                optional = optional || value == '?';
+                            }
+                            value = null;
+
+                            if (elementControllers && retrievalMethod === 'data') {
+                                value = elementControllers[require];
+                            }
+                            value = value || $element[retrievalMethod]('$' + require + 'Controller');
+
+                            if (!value && !optional) {
+                                throw $compileMinErr('ctreq',
+                                    "Controller '{0}', required by directive '{1}', can't be found!",
+                                    require, directiveName);
+                            }
+                            return value;
+                        } else if (isArray(require)) {
+                            value = [];
+                            forEach(require, function(require) {
+                                value.push(getControllers(require, $element, elementControllers));
+                            });
+                        }
+                        return value;
+                    }
+
+
+                    function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
+                        var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;
+
+                        if (compileNode === linkNode) {
+                            attrs = templateAttrs;
+                        } else {
+                            attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
+                        }
+                        $element = attrs.$$element;
+
+                        if (newIsolateScopeDirective) {
+                            var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
+                            var $linkNode = jqLite(linkNode);
+
+                            isolateScope = scope.$new(true);
+
+                            if (templateDirective && (templateDirective === newIsolateScopeDirective.$$originalDirective)) {
+                                $linkNode.data('$isolateScope', isolateScope) ;
+                            } else {
+                                $linkNode.data('$isolateScopeNoTemplate', isolateScope);
+                            }
+
+
+
+                            safeAddClass($linkNode, 'ng-isolate-scope');
+
+                            forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {
+                                var match = definition.match(LOCAL_REGEXP) || [],
+                                    attrName = match[3] || scopeName,
+                                    optional = (match[2] == '?'),
+                                    mode = match[1], // @, =, or &
+                                    lastValue,
+                                    parentGet, parentSet, compare;
+
+                                isolateScope.$$isolateBindings[scopeName] = mode + attrName;
+
+                                switch (mode) {
+
+                                    case '@':
+                                        attrs.$observe(attrName, function(value) {
+                                            isolateScope[scopeName] = value;
+                                        });
+                                        attrs.$$observers[attrName].$$scope = scope;
+                                        if( attrs[attrName] ) {
+                                            // If the attribute has been provided then we trigger an interpolation to ensure
+                                            // the value is there for use in the link fn
+                                            isolateScope[scopeName] = $interpolate(attrs[attrName])(scope);
+                                        }
+                                        break;
+
+                                    case '=':
+                                        if (optional && !attrs[attrName]) {
+                                            return;
+                                        }
+                                        parentGet = $parse(attrs[attrName]);
+                                        if (parentGet.literal) {
+                                            compare = equals;
+                                        } else {
+                                            compare = function(a,b) { return a === b; };
+                                        }
+                                        parentSet = parentGet.assign || function() {
+                                            // reset the change, or we will throw this exception on every $digest
+                                            lastValue = isolateScope[scopeName] = parentGet(scope);
+                                            throw $compileMinErr('nonassign',
+                                                "Expression '{0}' used with directive '{1}' is non-assignable!",
+                                                attrs[attrName], newIsolateScopeDirective.name);
+                                        };
+                                        lastValue = isolateScope[scopeName] = parentGet(scope);
+                                        isolateScope.$watch(function parentValueWatch() {
+                                            var parentValue = parentGet(scope);
+                                            if (!compare(parentValue, isolateScope[scopeName])) {
+                                                // we are out of sync and need to copy
+                                                if (!compare(parentValue, lastValue)) {
+                                                    // parent changed and it has precedence
+                                                    isolateScope[scopeName] = parentValue;
+                                                } else {
+                                                    // if the parent can be assigned then do so
+                                                    parentSet(scope, parentValue = isolateScope[scopeName]);
+                                                }
+                                            }
+                                            return lastValue = parentValue;
+                                        }, null, parentGet.literal);
+                                        break;
+
+                                    case '&':
+                                        parentGet = $parse(attrs[attrName]);
+                                        isolateScope[scopeName] = function(locals) {
+                                            return parentGet(scope, locals);
+                                        };
+                                        break;
+
+                                    default:
+                                        throw $compileMinErr('iscp',
+                                            "Invalid isolate scope definition for directive '{0}'." +
+                                            " Definition: {... {1}: '{2}' ...}",
+                                            newIsolateScopeDirective.name, scopeName, definition);
+                                }
+                            });
+                        }
+                        transcludeFn = boundTranscludeFn && controllersBoundTransclude;
+                        if (controllerDirectives) {
+                            forEach(controllerDirectives, function(directive) {
+                                var locals = {
+                                    $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
+                                    $element: $element,
+                                    $attrs: attrs,
+                                    $transclude: transcludeFn
+                                }, controllerInstance;
+
+                                controller = directive.controller;
+                                if (controller == '@') {
+                                    controller = attrs[directive.name];
+                                }
+
+                                controllerInstance = $controller(controller, locals);
+                                // For directives with element transclusion the element is a comment,
+                                // but jQuery .data doesn't support attaching data to comment nodes as it's hard to
+                                // clean up (http://bugs.jquery.com/ticket/8335).
+                                // Instead, we save the controllers for the element in a local hash and attach to .data
+                                // later, once we have the actual element.
+                                elementControllers[directive.name] = controllerInstance;
+                                if (!hasElementTranscludeDirective) {
+                                    $element.data('$' + directive.name + 'Controller', controllerInstance);
+                                }
+
+                                if (directive.controllerAs) {
+                                    locals.$scope[directive.controllerAs] = controllerInstance;
+                                }
+                            });
+                        }
+
+                        // PRELINKING
+                        for(i = 0, ii = preLinkFns.length; i < ii; i++) {
+                            try {
+                                linkFn = preLinkFns[i];
+                                linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,
+                                    linkFn.require && getControllers(linkFn.require, $element, elementControllers), transcludeFn);
+                            } catch (e) {
+                                $exceptionHandler(e, startingTag($element));
+                            }
+                        }
+
+                        // RECURSION
+                        // We only pass the isolate scope, if the isolate directive has a template,
+                        // otherwise the child elements do not belong to the isolate directive.
+                        var scopeToChild = scope;
+                        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
+                            scopeToChild = isolateScope;
+                        }
+                        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
+
+                        // POSTLINKING
+                        for(i = postLinkFns.length - 1; i >= 0; i--) {
+                            try {
+                                linkFn = postLinkFns[i];
+                                linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,
+                                    linkFn.require && getControllers(linkFn.require, $element, elementControllers), transcludeFn);
+                            } catch (e) {
+                                $exceptionHandler(e, startingTag($element));
+                            }
+                        }
+
+                        // This is the function that is injected as `$transclude`.
+                        function controllersBoundTransclude(scope, cloneAttachFn) {
+                            var transcludeControllers;
+
+                            // no scope passed
+                            if (arguments.length < 2) {
+                                cloneAttachFn = scope;
+                                scope = undefined;
+                            }
+
+                            if (hasElementTranscludeDirective) {
+                                transcludeControllers = elementControllers;
+                            }
+
+                            return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers);
+                        }
+                    }
+                }
+
+                function markDirectivesAsIsolate(directives) {
+                    // mark all directives as needing isolate scope.
+                    for (var j = 0, jj = directives.length; j < jj; j++) {
+                        directives[j] = inherit(directives[j], {$$isolateScope: true});
+                    }
+                }
+
+                /**
+                 * looks up the directive and decorates it with exception handling and proper parameters. We
+                 * call this the boundDirective.
+                 *
+                 * @param {string} name name of the directive to look up.
+                 * @param {string} location The directive must be found in specific format.
+                 *   String containing any of theses characters:
+                 *
+                 *   * `E`: element name
+                 *   * `A': attribute
+                 *   * `C`: class
+                 *   * `M`: comment
+                 * @returns {boolean} true if directive was added.
+                 */
+                function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
+                                      endAttrName) {
+                    if (name === ignoreDirective) return null;
+                    var match = null;
+                    if (hasDirectives.hasOwnProperty(name)) {
+                        for(var directive, directives = $injector.get(name + Suffix),
+                                i = 0, ii = directives.length; i<ii; i++) {
+                            try {
+                                directive = directives[i];
+                                if ( (maxPriority === undefined || maxPriority > directive.priority) &&
+                                    directive.restrict.indexOf(location) != -1) {
+                                    if (startAttrName) {
+                                        directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+                                    }
+                                    tDirectives.push(directive);
+                                    match = directive;
+                                }
+                            } catch(e) { $exceptionHandler(e); }
+                        }
+                    }
+                    return match;
+                }
+
+
+                /**
+                 * When the element is replaced with HTML template then the new attributes
+                 * on the template need to be merged with the existing attributes in the DOM.
+                 * The desired effect is to have both of the attributes present.
+                 *
+                 * @param {object} dst destination attributes (original DOM)
+                 * @param {object} src source attributes (from the directive template)
+                 */
+                function mergeTemplateAttributes(dst, src) {
+                    var srcAttr = src.$attr,
+                        dstAttr = dst.$attr,
+                        $element = dst.$$element;
+
+                    // reapply the old attributes to the new element
+                    forEach(dst, function(value, key) {
+                        if (key.charAt(0) != '$') {
+                            if (src[key]) {
+                                value += (key === 'style' ? ';' : ' ') + src[key];
+                            }
+                            dst.$set(key, value, true, srcAttr[key]);
+                        }
+                    });
+
+                    // copy the new attributes on the old attrs object
+                    forEach(src, function(value, key) {
+                        if (key == 'class') {
+                            safeAddClass($element, value);
+                            dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
+                        } else if (key == 'style') {
+                            $element.attr('style', $element.attr('style') + ';' + value);
+                            dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
+                            // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+                            // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+                            // have an attribute like "has-own-property" or "data-has-own-property", etc.
+                        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
+                            dst[key] = value;
+                            dstAttr[key] = srcAttr[key];
+                        }
+                    });
+                }
+
+
+                function compileTemplateUrl(directives, $compileNode, tAttrs,
+                                            $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
+                    var linkQueue = [],
+                        afterTemplateNodeLinkFn,
+                        afterTemplateChildLinkFn,
+                        beforeTemplateCompileNode = $compileNode[0],
+                        origAsyncDirective = directives.shift(),
+                    // The fact that we have to copy and patch the directive seems wrong!
+                        derivedSyncDirective = extend({}, origAsyncDirective, {
+                            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
+                        }),
+                        templateUrl = (isFunction(origAsyncDirective.templateUrl))
+                            ? origAsyncDirective.templateUrl($compileNode, tAttrs)
+                            : origAsyncDirective.templateUrl;
+
+                    $compileNode.empty();
+
+                    $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).
+                        success(function(content) {
+                            var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
+
+                            content = denormalizeTemplate(content);
+
+                            if (origAsyncDirective.replace) {
+                                if (jqLiteIsTextNode(content)) {
+                                    $template = [];
+                                } else {
+                                    $template = jqLite(content);
+                                }
+                                compileNode = $template[0];
+
+                                if ($template.length != 1 || compileNode.nodeType !== 1) {
+                                    throw $compileMinErr('tplrt',
+                                        "Template for directive '{0}' must have exactly one root element. {1}",
+                                        origAsyncDirective.name, templateUrl);
+                                }
+
+                                tempTemplateAttrs = {$attr: {}};
+                                replaceWith($rootElement, $compileNode, compileNode);
+                                var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
+
+                                if (isObject(origAsyncDirective.scope)) {
+                                    markDirectivesAsIsolate(templateDirectives);
+                                }
+                                directives = templateDirectives.concat(directives);
+                                mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
+                            } else {
+                                compileNode = beforeTemplateCompileNode;
+                                $compileNode.html(content);
+                            }
+
+                            directives.unshift(derivedSyncDirective);
+
+                            afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
+                                childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
+                                previousCompileContext);
+                            forEach($rootElement, function(node, i) {
+                                if (node == compileNode) {
+                                    $rootElement[i] = $compileNode[0];
+                                }
+                            });
+                            afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
+
+
+                            while(linkQueue.length) {
+                                var scope = linkQueue.shift(),
+                                    beforeTemplateLinkNode = linkQueue.shift(),
+                                    linkRootElement = linkQueue.shift(),
+                                    boundTranscludeFn = linkQueue.shift(),
+                                    linkNode = $compileNode[0];
+
+                                if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
+                                    var oldClasses = beforeTemplateLinkNode.className;
+
+                                    if (!(previousCompileContext.hasElementTranscludeDirective &&
+                                        origAsyncDirective.replace)) {
+                                        // it was cloned therefore we have to clone as well.
+                                        linkNode = jqLiteClone(compileNode);
+                                    }
+
+                                    replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
+
+                                    // Copy in CSS classes from original node
+                                    safeAddClass(jqLite(linkNode), oldClasses);
+                                }
+                                if (afterTemplateNodeLinkFn.transclude) {
+                                    childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude);
+                                } else {
+                                    childBoundTranscludeFn = boundTranscludeFn;
+                                }
+                                afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
+                                    childBoundTranscludeFn);
+                            }
+                            linkQueue = null;
+                        }).
+                        error(function(response, code, headers, config) {
+                            throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url);
+                        });
+
+                    return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
+                        if (linkQueue) {
+                            linkQueue.push(scope);
+                            linkQueue.push(node);
+                            linkQueue.push(rootElement);
+                            linkQueue.push(boundTranscludeFn);
+                        } else {
+                            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, boundTranscludeFn);
+                        }
+                    };
+                }
+
+
+                /**
+                 * Sorting function for bound directives.
+                 */
+                function byPriority(a, b) {
+                    var diff = b.priority - a.priority;
+                    if (diff !== 0) return diff;
+                    if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
+                    return a.index - b.index;
+                }
+
+
+                function assertNoDuplicate(what, previousDirective, directive, element) {
+                    if (previousDirective) {
+                        throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}',
+                            previousDirective.name, directive.name, what, startingTag(element));
+                    }
+                }
+
+
+                function addTextInterpolateDirective(directives, text) {
+                    var interpolateFn = $interpolate(text, true);
+                    if (interpolateFn) {
+                        directives.push({
+                            priority: 0,
+                            compile: valueFn(function textInterpolateLinkFn(scope, node) {
+                                var parent = node.parent(),
+                                    bindings = parent.data('$binding') || [];
+                                bindings.push(interpolateFn);
+                                safeAddClass(parent.data('$binding', bindings), 'ng-binding');
+                                scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
+                                    node[0].nodeValue = value;
+                                });
+                            })
+                        });
+                    }
+                }
+
+
+                function getTrustedContext(node, attrNormalizedName) {
+                    if (attrNormalizedName == "srcdoc") {
+                        return $sce.HTML;
+                    }
+                    var tag = nodeName_(node);
+                    // maction[xlink:href] can source SVG.  It's not limited to <maction>.
+                    if (attrNormalizedName == "xlinkHref" ||
+                        (tag == "FORM" && attrNormalizedName == "action") ||
+                        (tag != "IMG" && (attrNormalizedName == "src" ||
+                        attrNormalizedName == "ngSrc"))) {
+                        return $sce.RESOURCE_URL;
+                    }
+                }
+
+
+                function addAttrInterpolateDirective(node, directives, value, name) {
+                    var interpolateFn = $interpolate(value, true);
+
+                    // no interpolation found -> ignore
+                    if (!interpolateFn) return;
+
+
+                    if (name === "multiple" && nodeName_(node) === "SELECT") {
+                        throw $compileMinErr("selmulti",
+                            "Binding to the 'multiple' attribute is not supported. Element: {0}",
+                            startingTag(node));
+                    }
+
+                    directives.push({
+                        priority: 100,
+                        compile: function() {
+                            return {
+                                pre: function attrInterpolatePreLinkFn(scope, element, attr) {
+                                    var $$observers = (attr.$$observers || (attr.$$observers = {}));
+
+                                    if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+                                        throw $compileMinErr('nodomevents',
+                                            "Interpolations for HTML DOM event attributes are disallowed.  Please use the " +
+                                            "ng- versions (such as ng-click instead of onclick) instead.");
+                                    }
+
+                                    // we need to interpolate again, in case the attribute value has been updated
+                                    // (e.g. by another directive's compile function)
+                                    interpolateFn = $interpolate(attr[name], true, getTrustedContext(node, name));
+
+                                    // if attribute was updated so that there is no interpolation going on we don't want to
+                                    // register any observers
+                                    if (!interpolateFn) return;
+
+                                    // TODO(i): this should likely be attr.$set(name, iterpolateFn(scope) so that we reset the
+                                    // actual attr value
+                                    attr[name] = interpolateFn(scope);
+                                    ($$observers[name] || ($$observers[name] = [])).$$inter = true;
+                                    (attr.$$observers && attr.$$observers[name].$$scope || scope).
+                                        $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
+                                            //special case for class attribute addition + removal
+                                            //so that class changes can tap into the animation
+                                            //hooks provided by the $animate service. Be sure to
+                                            //skip animations when the first digest occurs (when
+                                            //both the new and the old values are the same) since
+                                            //the CSS classes are the non-interpolated values
+                                            if(name === 'class' && newValue != oldValue) {
+                                                attr.$updateClass(newValue, oldValue);
+                                            } else {
+                                                attr.$set(name, newValue);
+                                            }
+                                        });
+                                }
+                            };
+                        }
+                    });
+                }
+
+
+                /**
+                 * This is a special jqLite.replaceWith, which can replace items which
+                 * have no parents, provided that the containing jqLite collection is provided.
+                 *
+                 * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
+                 *                               in the root of the tree.
+                 * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep
+                 *                                  the shell, but replace its DOM node reference.
+                 * @param {Node} newNode The new DOM node.
+                 */
+                function replaceWith($rootElement, elementsToRemove, newNode) {
+                    var firstElementToRemove = elementsToRemove[0],
+                        removeCount = elementsToRemove.length,
+                        parent = firstElementToRemove.parentNode,
+                        i, ii;
+
+                    if ($rootElement) {
+                        for(i = 0, ii = $rootElement.length; i < ii; i++) {
+                            if ($rootElement[i] == firstElementToRemove) {
+                                $rootElement[i++] = newNode;
+                                for (var j = i, j2 = j + removeCount - 1,
+                                         jj = $rootElement.length;
+                                     j < jj; j++, j2++) {
+                                    if (j2 < jj) {
+                                        $rootElement[j] = $rootElement[j2];
+                                    } else {
+                                        delete $rootElement[j];
+                                    }
+                                }
+                                $rootElement.length -= removeCount - 1;
+                                break;
+                            }
+                        }
+                    }
+
+                    if (parent) {
+                        parent.replaceChild(newNode, firstElementToRemove);
+                    }
+                    var fragment = document.createDocumentFragment();
+                    fragment.appendChild(firstElementToRemove);
+                    newNode[jqLite.expando] = firstElementToRemove[jqLite.expando];
+                    for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {
+                        var element = elementsToRemove[k];
+                        jqLite(element).remove(); // must do this way to clean up expando
+                        fragment.appendChild(element);
+                        delete elementsToRemove[k];
+                    }
+
+                    elementsToRemove[0] = newNode;
+                    elementsToRemove.length = 1;
+                }
+
+
+                function cloneAndAnnotateFn(fn, annotation) {
+                    return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
+                }
+            }];
+    }
+
+    var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i;
+    /**
+     * Converts all accepted directives format into proper directive name.
+     * All of these will become 'myDirective':
+     *   my:Directive
+     *   my-directive
+     *   x-my-directive
+     *   data-my:directive
+     *
+     * Also there is special case for Moz prefix starting with upper case letter.
+     * @param name Name to normalize
+     */
+    function directiveNormalize(name) {
+        return camelCase(name.replace(PREFIX_REGEXP, ''));
+    }
+
+    /**
+     * @ngdoc type
+     * @name $compile.directive.Attributes
+     *
+     * @description
+     * A shared object between directive compile / linking functions which contains normalized DOM
+     * element attributes. The values reflect current binding state `{{ }}`. The normalization is
+     * needed since all of these are treated as equivalent in Angular:
+     *
+     *    <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
+     */
+
+    /**
+     * @ngdoc property
+     * @name $compile.directive.Attributes#$attr
+     * @returns {object} A map of DOM element attribute names to the normalized name. This is
+     *                   needed to do reverse lookup from normalized name back to actual name.
+     */
+
+
+    /**
+     * @ngdoc method
+     * @name $compile.directive.Attributes#$set
+     * @function
+     *
+     * @description
+     * Set DOM element attribute value.
+     *
+     *
+     * @param {string} name Normalized element attribute name of the property to modify. The name is
+     *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
+     *          property to the original name.
+     * @param {string} value Value to set the attribute to. The value can be an interpolated string.
+     */
+
+
+
+    /**
+     * Closure compiler type information
+     */
+
+    function nodesetLinkingFn(
+        /* angular.Scope */ scope,
+        /* NodeList */ nodeList,
+        /* Element */ rootElement,
+        /* function(Function) */ boundTranscludeFn
+        ){}
+
+    function directiveLinkingFn(
+        /* nodesetLinkingFn */ nodesetLinkingFn,
+        /* angular.Scope */ scope,
+        /* Node */ node,
+        /* Element */ rootElement,
+        /* function(Function) */ boundTranscludeFn
+        ){}
+
+    function tokenDifference(str1, str2) {
+        var values = '',
+            tokens1 = str1.split(/\s+/),
+            tokens2 = str2.split(/\s+/);
+
+        outer:
+            for(var i = 0; i < tokens1.length; i++) {
+                var token = tokens1[i];
+                for(var j = 0; j < tokens2.length; j++) {
+                    if(token == tokens2[j]) continue outer;
+                }
+                values += (values.length > 0 ? ' ' : '') + token;
+            }
+        return values;
+    }
+
+    /**
+     * @ngdoc provider
+     * @name $controllerProvider
+     * @description
+     * The {@link ng.$controller $controller service} is used by Angular to create new
+     * controllers.
+     *
+     * This provider allows controller registration via the
+     * {@link ng.$controllerProvider#register register} method.
+     */
+    function $ControllerProvider() {
+        var controllers = {},
+            CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/;
+
+
+        /**
+         * @ngdoc method
+         * @name $controllerProvider#register
+         * @param {string|Object} name Controller name, or an object map of controllers where the keys are
+         *    the names and the values are the constructors.
+         * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
+         *    annotations in the array notation).
+         */
+        this.register = function(name, constructor) {
+            assertNotHasOwnProperty(name, 'controller');
+            if (isObject(name)) {
+                extend(controllers, name);
+            } else {
+                controllers[name] = constructor;
+            }
+        };
+
+
+        this.$get = ['$injector', '$window', function($injector, $window) {
+
+            /**
+             * @ngdoc service
+             * @name $controller
+             * @requires $injector
+             *
+             * @param {Function|string} constructor If called with a function then it's considered to be the
+             *    controller constructor function. Otherwise it's considered to be a string which is used
+             *    to retrieve the controller constructor using the following steps:
+             *
+             *    * check if a controller with given name is registered via `$controllerProvider`
+             *    * check if evaluating the string on the current scope returns a constructor
+             *    * check `window[constructor]` on the global `window` object
+             *
+             * @param {Object} locals Injection locals for Controller.
+             * @return {Object} Instance of given controller.
+             *
+             * @description
+             * `$controller` service is responsible for instantiating controllers.
+             *
+             * It's just a simple call to {@link auto.$injector $injector}, but extracted into
+             * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
+             */
+            return function(expression, locals) {
+                var instance, match, constructor, identifier;
+
+                if(isString(expression)) {
+                    match = expression.match(CNTRL_REG),
+                        constructor = match[1],
+                        identifier = match[3];
+                    expression = controllers.hasOwnProperty(constructor)
+                        ? controllers[constructor]
+                        : getter(locals.$scope, constructor, true) || getter($window, constructor, true);
+
+                    assertArgFn(expression, constructor, true);
+                }
+
+                instance = $injector.instantiate(expression, locals);
+
+                if (identifier) {
+                    if (!(locals && typeof locals.$scope == 'object')) {
+                        throw minErr('$controller')('noscp',
+                            "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
+                            constructor || expression.name, identifier);
+                    }
+
+                    locals.$scope[identifier] = instance;
+                }
+
+                return instance;
+            };
+        }];
+    }
+
+    /**
+     * @ngdoc service
+     * @name $document
+     * @requires $window
+     *
+     * @description
+     * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <div ng-controller="MainCtrl">
+     <p>$document title: <b ng-bind="title"></b></p>
+     <p>window.document title: <b ng-bind="windowTitle"></b></p>
+     </div>
+     </file>
+     <file name="script.js">
+     function MainCtrl($scope, $document) {
+         $scope.title = $document[0].title;
+         $scope.windowTitle = angular.element(window.document)[0].title;
+       }
+     </file>
+     </example>
+     */
+    function $DocumentProvider(){
+        this.$get = ['$window', function(window){
+            return jqLite(window.document);
+        }];
+    }
+
+    /**
+     * @ngdoc service
+     * @name $exceptionHandler
+     * @requires ng.$log
+     *
+     * @description
+     * Any uncaught exception in angular expressions is delegated to this service.
+     * The default implementation simply delegates to `$log.error` which logs it into
+     * the browser console.
+     *
+     * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+     * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
+     *
+     * ## Example:
+     *
+     * ```js
+     *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
+ *     return function (exception, cause) {
+ *       exception.message += ' (caused by "' + cause + '")';
+ *       throw exception;
+ *     };
+ *   });
+     * ```
+     *
+     * This example will override the normal action of `$exceptionHandler`, to make angular
+     * exceptions fail hard when they happen, instead of just logging to the console.
+     *
+     * @param {Error} exception Exception associated with the error.
+     * @param {string=} cause optional information about the context in which
+     *       the error was thrown.
+     *
+     */
+    function $ExceptionHandlerProvider() {
+        this.$get = ['$log', function($log) {
+            return function(exception, cause) {
+                $log.error.apply($log, arguments);
+            };
+        }];
+    }
+
+    /**
+     * Parse headers into key value object
+     *
+     * @param {string} headers Raw headers as a string
+     * @returns {Object} Parsed headers as key value object
+     */
+    function parseHeaders(headers) {
+        var parsed = {}, key, val, i;
+
+        if (!headers) return parsed;
+
+        forEach(headers.split('\n'), function(line) {
+            i = line.indexOf(':');
+            key = lowercase(trim(line.substr(0, i)));
+            val = trim(line.substr(i + 1));
+
+            if (key) {
+                if (parsed[key]) {
+                    parsed[key] += ', ' + val;
+                } else {
+                    parsed[key] = val;
+                }
+            }
+        });
+
+        return parsed;
+    }
+
+
+    /**
+     * Returns a function that provides access to parsed headers.
+     *
+     * Headers are lazy parsed when first requested.
+     * @see parseHeaders
+     *
+     * @param {(string|Object)} headers Headers to provide access to.
+     * @returns {function(string=)} Returns a getter function which if called with:
+     *
+     *   - if called with single an argument returns a single header value or null
+     *   - if called with no arguments returns an object containing all headers.
+     */
+    function headersGetter(headers) {
+        var headersObj = isObject(headers) ? headers : undefined;
+
+        return function(name) {
+            if (!headersObj) headersObj =  parseHeaders(headers);
+
+            if (name) {
+                return headersObj[lowercase(name)] || null;
+            }
+
+            return headersObj;
+        };
+    }
+
+
+    /**
+     * Chain all given functions
+     *
+     * This function is used for both request and response transforming
+     *
+     * @param {*} data Data to transform.
+     * @param {function(string=)} headers Http headers getter fn.
+     * @param {(Function|Array.<Function>)} fns Function or an array of functions.
+     * @returns {*} Transformed data.
+     */
+    function transformData(data, headers, fns) {
+        if (isFunction(fns))
+            return fns(data, headers);
+
+        forEach(fns, function(fn) {
+            data = fn(data, headers);
+        });
+
+        return data;
+    }
+
+
+    function isSuccess(status) {
+        return 200 <= status && status < 300;
+    }
+
+
+    function $HttpProvider() {
+        var JSON_START = /^\s*(\[|\{[^\{])/,
+            JSON_END = /[\}\]]\s*$/,
+            PROTECTION_PREFIX = /^\)\]\}',?\n/,
+            CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};
+
+        var defaults = this.defaults = {
+            // transform incoming response data
+            transformResponse: [function(data) {
+                if (isString(data)) {
+                    // strip json vulnerability protection prefix
+                    data = data.replace(PROTECTION_PREFIX, '');
+                    if (JSON_START.test(data) && JSON_END.test(data))
+                        data = fromJson(data);
+                }
+                return data;
+            }],
+
+            // transform outgoing request data
+            transformRequest: [function(d) {
+                return isObject(d) && !isFile(d) && !isBlob(d) ? toJson(d) : d;
+            }],
+
+            // default headers
+            headers: {
+                common: {
+                    'Accept': 'application/json, text/plain, */*'
+                },
+                post:   copy(CONTENT_TYPE_APPLICATION_JSON),
+                put:    copy(CONTENT_TYPE_APPLICATION_JSON),
+                patch:  copy(CONTENT_TYPE_APPLICATION_JSON)
+            },
+
+            xsrfCookieName: 'XSRF-TOKEN',
+            xsrfHeaderName: 'X-XSRF-TOKEN'
+        };
+
+        /**
+         * Are ordered by request, i.e. they are applied in the same order as the
+         * array, on request, but reverse order, on response.
+         */
+        var interceptorFactories = this.interceptors = [];
+
+        /**
+         * For historical reasons, response interceptors are ordered by the order in which
+         * they are applied to the response. (This is the opposite of interceptorFactories)
+         */
+        var responseInterceptorFactories = this.responseInterceptors = [];
+
+        this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',
+            function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
+
+                var defaultCache = $cacheFactory('$http');
+
+                /**
+                 * Interceptors stored in reverse order. Inner interceptors before outer interceptors.
+                 * The reversal is needed so that we can build up the interception chain around the
+                 * server request.
+                 */
+                var reversedInterceptors = [];
+
+                forEach(interceptorFactories, function(interceptorFactory) {
+                    reversedInterceptors.unshift(isString(interceptorFactory)
+                        ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
+                });
+
+                forEach(responseInterceptorFactories, function(interceptorFactory, index) {
+                    var responseFn = isString(interceptorFactory)
+                        ? $injector.get(interceptorFactory)
+                        : $injector.invoke(interceptorFactory);
+
+                    /**
+                     * Response interceptors go before "around" interceptors (no real reason, just
+                     * had to pick one.) But they are already reversed, so we can't use unshift, hence
+                     * the splice.
+                     */
+                    reversedInterceptors.splice(index, 0, {
+                        response: function(response) {
+                            return responseFn($q.when(response));
+                        },
+                        responseError: function(response) {
+                            return responseFn($q.reject(response));
+                        }
+                    });
+                });
+
+
+                /**
+                 * @ngdoc service
+                 * @kind function
+                 * @name $http
+                 * @requires ng.$httpBackend
+                 * @requires $cacheFactory
+                 * @requires $rootScope
+                 * @requires $q
+                 * @requires $injector
+                 *
+                 * @description
+                 * The `$http` service is a core Angular service that facilitates communication with the remote
+                 * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)
+                 * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
+                 *
+                 * For unit testing applications that use `$http` service, see
+                 * {@link ngMock.$httpBackend $httpBackend mock}.
+                 *
+                 * For a higher level of abstraction, please check out the {@link ngResource.$resource
+     * $resource} service.
+                 *
+                 * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
+                 * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
+                 * it is important to familiarize yourself with these APIs and the guarantees they provide.
+                 *
+                 *
+                 * # General usage
+                 * The `$http` service is a function which takes a single argument — a configuration object —
+                 * that is used to generate an HTTP request and returns  a {@link ng.$q promise}
+                 * with two $http specific methods: `success` and `error`.
+                 *
+                 * ```js
+                 *   $http({method: 'GET', url: '/someUrl'}).
+                 *     success(function(data, status, headers, config) {
+     *       // this callback will be called asynchronously
+     *       // when the response is available
+     *     }).
+                 *     error(function(data, status, headers, config) {
+     *       // called asynchronously if an error occurs
+     *       // or server returns response with an error status.
+     *     });
+                 * ```
+                 *
+                 * Since the returned value of calling the $http function is a `promise`, you can also use
+                 * the `then` method to register callbacks, and these callbacks will receive a single argument –
+                 * an object representing the response. See the API signature and type info below for more
+                 * details.
+                 *
+                 * A response status code between 200 and 299 is considered a success status and
+                 * will result in the success callback being called. Note that if the response is a redirect,
+                 * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+                 * called for such responses.
+                 *
+                 * # Writing Unit Tests that use $http
+                 * When unit testing (using {@link ngMock ngMock}), it is necessary to call
+                 * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending
+                 * request using trained responses.
+                 *
+                 * ```
+                 * $httpBackend.expectGET(...);
+                 * $http.get(...);
+                 * $httpBackend.flush();
+                 * ```
+                 *
+                 * # Shortcut methods
+                 *
+                 * Shortcut methods are also available. All shortcut methods require passing in the URL, and
+                 * request data must be passed in for POST/PUT requests.
+                 *
+                 * ```js
+                 *   $http.get('/someUrl').success(successCallback);
+                 *   $http.post('/someUrl', data).success(successCallback);
+                 * ```
+                 *
+                 * Complete list of shortcut methods:
+                 *
+                 * - {@link ng.$http#get $http.get}
+                 * - {@link ng.$http#head $http.head}
+                 * - {@link ng.$http#post $http.post}
+                 * - {@link ng.$http#put $http.put}
+                 * - {@link ng.$http#delete $http.delete}
+                 * - {@link ng.$http#jsonp $http.jsonp}
+                 *
+                 *
+                 * # Setting HTTP Headers
+                 *
+                 * The $http service will automatically add certain HTTP headers to all requests. These defaults
+                 * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
+                 * object, which currently contains this default configuration:
+                 *
+                 * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+                 *   - `Accept: application/json, text/plain, * / *`
+                 * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+                 *   - `Content-Type: application/json`
+                 * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+                 *   - `Content-Type: application/json`
+                 *
+                 * To add or overwrite these defaults, simply add or remove a property from these configuration
+                 * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
+                 * with the lowercased HTTP method name as the key, e.g.
+                 * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.
+                 *
+                 * The defaults can also be set at runtime via the `$http.defaults` object in the same
+                 * fashion. For example:
+                 *
+                 * ```
+                 * module.run(function($http) {
+     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'
+     * });
+                 * ```
+                 *
+                 * In addition, you can supply a `headers` property in the config object passed when
+                 * calling `$http(config)`, which overrides the defaults without changing them globally.
+                 *
+                 *
+                 * # Transforming Requests and Responses
+                 *
+                 * Both requests and responses can be transformed using transform functions. By default, Angular
+                 * applies these transformations:
+                 *
+                 * Request transformations:
+                 *
+                 * - If the `data` property of the request configuration object contains an object, serialize it
+                 *   into JSON format.
+                 *
+                 * Response transformations:
+                 *
+                 *  - If XSRF prefix is detected, strip it (see Security Considerations section below).
+                 *  - If JSON response is detected, deserialize it using a JSON parser.
+                 *
+                 * To globally augment or override the default transforms, modify the
+                 * `$httpProvider.defaults.transformRequest` and `$httpProvider.defaults.transformResponse`
+                 * properties. These properties are by default an array of transform functions, which allows you
+                 * to `push` or `unshift` a new transformation function into the transformation chain. You can
+                 * also decide to completely override any default transformations by assigning your
+                 * transformation functions to these properties directly without the array wrapper.  These defaults
+                 * are again available on the $http factory at run-time, which may be useful if you have run-time
+                 * services you wish to be involved in your transformations.
+                 *
+                 * Similarly, to locally override the request/response transforms, augment the
+                 * `transformRequest` and/or `transformResponse` properties of the configuration object passed
+                 * into `$http`.
+                 *
+                 *
+                 * # Caching
+                 *
+                 * To enable caching, set the request configuration `cache` property to `true` (to use default
+                 * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
+                 * When the cache is enabled, `$http` stores the response from the server in the specified
+                 * cache. The next time the same request is made, the response is served from the cache without
+                 * sending a request to the server.
+                 *
+                 * Note that even if the response is served from cache, delivery of the data is asynchronous in
+                 * the same way that real requests are.
+                 *
+                 * If there are multiple GET requests for the same URL that should be cached using the same
+                 * cache, but the cache is not populated yet, only one request to the server will be made and
+                 * the remaining requests will be fulfilled using the response from the first request.
+                 *
+                 * You can change the default cache to a new object (built with
+                 * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
+                 * {@link ng.$http#properties_defaults `$http.defaults.cache`} property. All requests who set
+                 * their `cache` property to `true` will now use this cache object.
+                 *
+                 * If you set the default cache to `false` then only requests that specify their own custom
+                 * cache object will be cached.
+                 *
+                 * # Interceptors
+                 *
+                 * Before you start creating interceptors, be sure to understand the
+                 * {@link ng.$q $q and deferred/promise APIs}.
+                 *
+                 * For purposes of global error handling, authentication, or any kind of synchronous or
+                 * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
+                 * able to intercept requests before they are handed to the server and
+                 * responses before they are handed over to the application code that
+                 * initiated these requests. The interceptors leverage the {@link ng.$q
+     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.
+                 *
+                 * The interceptors are service factories that are registered with the `$httpProvider` by
+                 * adding them to the `$httpProvider.interceptors` array. The factory is called and
+                 * injected with dependencies (if specified) and returns the interceptor.
+                 *
+                 * There are two kinds of interceptors (and two kinds of rejection interceptors):
+                 *
+                 *   * `request`: interceptors get called with http `config` object. The function is free to
+                 *     modify the `config` or create a new one. The function needs to return the `config`
+                 *     directly or as a promise.
+                 *   * `requestError`: interceptor gets called when a previous interceptor threw an error or
+                 *     resolved with a rejection.
+                 *   * `response`: interceptors get called with http `response` object. The function is free to
+                 *     modify the `response` or create a new one. The function needs to return the `response`
+                 *     directly or as a promise.
+                 *   * `responseError`: interceptor gets called when a previous interceptor threw an error or
+                 *     resolved with a rejection.
+                 *
+                 *
+                 * ```js
+                 *   // register the interceptor as a service
+                 *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+     *     return {
+     *       // optional method
+     *       'request': function(config) {
+     *         // do something on success
+     *         return config || $q.when(config);
+     *       },
+     *
+     *       // optional method
+     *      'requestError': function(rejection) {
+     *         // do something on error
+     *         if (canRecover(rejection)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(rejection);
+     *       },
+     *
+     *
+     *
+     *       // optional method
+     *       'response': function(response) {
+     *         // do something on success
+     *         return response || $q.when(response);
+     *       },
+     *
+     *       // optional method
+     *      'responseError': function(rejection) {
+     *         // do something on error
+     *         if (canRecover(rejection)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(rejection);
+     *       }
+     *     };
+     *   });
+                 *
+                 *   $httpProvider.interceptors.push('myHttpInterceptor');
+                 *
+                 *
+                 *   // alternatively, register the interceptor via an anonymous factory
+                 *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+     *     return {
+     *      'request': function(config) {
+     *          // same as above
+     *       },
+     *
+     *       'response': function(response) {
+     *          // same as above
+     *       }
+     *     };
+     *   });
+                 * ```
+                 *
+                 * # Response interceptors (DEPRECATED)
+                 *
+                 * Before you start creating interceptors, be sure to understand the
+                 * {@link ng.$q $q and deferred/promise APIs}.
+                 *
+                 * For purposes of global error handling, authentication or any kind of synchronous or
+                 * asynchronous preprocessing of received responses, it is desirable to be able to intercept
+                 * responses for http requests before they are handed over to the application code that
+                 * initiated these requests. The response interceptors leverage the {@link ng.$q
+     * promise apis} to fulfil this need for both synchronous and asynchronous preprocessing.
+                 *
+                 * The interceptors are service factories that are registered with the $httpProvider by
+                 * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and
+                 * injected with dependencies (if specified) and returns the interceptor  — a function that
+                 * takes a {@link ng.$q promise} and returns the original or a new promise.
+                 *
+                 * ```js
+                 *   // register the interceptor as a service
+                 *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+     *     return function(promise) {
+     *       return promise.then(function(response) {
+     *         // do something on success
+     *         return response;
+     *       }, function(response) {
+     *         // do something on error
+     *         if (canRecover(response)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(response);
+     *       });
+     *     }
+     *   });
+                 *
+                 *   $httpProvider.responseInterceptors.push('myHttpInterceptor');
+                 *
+                 *
+                 *   // register the interceptor via an anonymous factory
+                 *   $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) {
+     *     return function(promise) {
+     *       // same as above
+     *     }
+     *   });
+                 * ```
+                 *
+                 *
+                 * # Security Considerations
+                 *
+                 * When designing web applications, consider security threats from:
+                 *
+                 * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+                 * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
+                 *
+                 * Both server and the client must cooperate in order to eliminate these threats. Angular comes
+                 * pre-configured with strategies that address these issues, but for this to work backend server
+                 * cooperation is required.
+                 *
+                 * ## JSON Vulnerability Protection
+                 *
+                 * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+                 * allows third party website to turn your JSON resource URL into
+                 * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To
+                 * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
+                 * Angular will automatically strip the prefix before processing it as JSON.
+                 *
+                 * For example if your server needs to return:
+                 * ```js
+                 * ['one','two']
+                 * ```
+                 *
+                 * which is vulnerable to attack, your server can return:
+                 * ```js
+                 * )]}',
+                 * ['one','two']
+                 * ```
+                 *
+                 * Angular will strip the prefix, before processing the JSON.
+                 *
+                 *
+                 * ## Cross Site Request Forgery (XSRF) Protection
+                 *
+                 * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is a technique by which
+                 * an unauthorized site can gain your user's private data. Angular provides a mechanism
+                 * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
+                 * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only
+                 * JavaScript that runs on your domain could read the cookie, your server can be assured that
+                 * the XHR came from JavaScript running on your domain. The header will not be set for
+                 * cross-domain requests.
+                 *
+                 * To take advantage of this, your server needs to set a token in a JavaScript readable session
+                 * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
+                 * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
+                 * that only JavaScript running on your domain could have sent the request. The token must be
+                 * unique for each user and must be verifiable by the server (to prevent the JavaScript from
+                 * making up its own tokens). We recommend that the token is a digest of your site's
+                 * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography))
+                 * for added security.
+                 *
+                 * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
+                 * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+                 * or the per-request config object.
+                 *
+                 *
+                 * @param {object} config Object describing the request to be made and how it should be
+                 *    processed. The object has following properties:
+                 *
+                 *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+                 *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+                 *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned
+                 *      to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be
+                 *      JSONified.
+                 *    - **data** – `{string|Object}` – Data to be sent as the request message data.
+                 *    - **headers** – `{Object}` – Map of strings or functions which return strings representing
+                 *      HTTP headers to send to the server. If the return value of a function is null, the
+                 *      header will not be sent.
+                 *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
+                 *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
+                 *    - **transformRequest** –
+                 *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+                 *      transform function or an array of such functions. The transform function takes the http
+                 *      request body and headers and returns its transformed (typically serialized) version.
+                 *    - **transformResponse** –
+                 *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+                 *      transform function or an array of such functions. The transform function takes the http
+                 *      response body and headers and returns its transformed (typically deserialized) version.
+                 *    - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+                 *      GET request, otherwise if a cache instance built with
+                 *      {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
+                 *      caching.
+                 *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
+                 *      that should abort the request when resolved.
+                 *    - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the
+                 *      XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5
+                 *      for more information.
+                 *    - **responseType** - `{string}` - see
+                 *      [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
+                 *
+                 * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the
+                 *   standard `then` method and two http specific methods: `success` and `error`. The `then`
+                 *   method takes two arguments a success and an error callback which will be called with a
+                 *   response object. The `success` and `error` methods take a single argument - a function that
+                 *   will be called when the request succeeds or fails respectively. The arguments passed into
+                 *   these functions are destructured representation of the response object passed into the
+                 *   `then` method. The response object has these properties:
+                 *
+                 *   - **data** – `{string|Object}` – The response body transformed with the transform
+                 *     functions.
+                 *   - **status** – `{number}` – HTTP status code of the response.
+                 *   - **headers** – `{function([headerName])}` – Header getter function.
+                 *   - **config** – `{Object}` – The configuration object that was used to generate the request.
+                 *   - **statusText** – `{string}` – HTTP status text of the response.
+                 *
+                 * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
+                 *   requests. This is primarily meant to be used for debugging purposes.
+                 *
+                 *
+                 * @example
+                 <example>
+                 <file name="index.html">
+                 <div ng-controller="FetchCtrl">
+                 <select ng-model="method">
+                 <option>GET</option>
+                 <option>JSONP</option>
+                 </select>
+                 <input type="text" ng-model="url" size="80"/>
+                 <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
+                 <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
+                 <button id="samplejsonpbtn"
+                 ng-click="updateModel('JSONP',
+                 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
+                 Sample JSONP
+                 </button>
+                 <button id="invalidjsonpbtn"
+                 ng-click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
+                 Invalid JSONP
+                 </button>
+                 <pre>http status code: {{status}}</pre>
+                 <pre>http response data: {{data}}</pre>
+                 </div>
+                 </file>
+                 <file name="script.js">
+                 function FetchCtrl($scope, $http, $templateCache) {
+    $scope.method = 'GET';
+    $scope.url = 'http-hello.html';
+
+    $scope.fetch = function() {
+      $scope.code = null;
+      $scope.response = null;
+
+      $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
+        success(function(data, status) {
+          $scope.status = status;
+          $scope.data = data;
+        }).
+        error(function(data, status) {
+          $scope.data = data || "Request failed";
+          $scope.status = status;
+      });
+    };
+
+    $scope.updateModel = function(method, url) {
+      $scope.method = method;
+      $scope.url = url;
+    };
+  }
+                 </file>
+                 <file name="http-hello.html">
+                 Hello, $http!
+                 </file>
+                 <file name="protractor.js" type="protractor">
+                 var status = element(by.binding('status'));
+                 var data = element(by.binding('data'));
+                 var fetchBtn = element(by.id('fetchbtn'));
+                 var sampleGetBtn = element(by.id('samplegetbtn'));
+                 var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
+                 var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
+
+                 it('should make an xhr GET request', function() {
+    sampleGetBtn.click();
+    fetchBtn.click();
+    expect(status.getText()).toMatch('200');
+    expect(data.getText()).toMatch(/Hello, \$http!/);
+  });
+
+                 it('should make a JSONP request to angularjs.org', function() {
+    sampleJsonpBtn.click();
+    fetchBtn.click();
+    expect(status.getText()).toMatch('200');
+    expect(data.getText()).toMatch(/Super Hero!/);
+  });
+
+                 it('should make JSONP request to invalid URL and invoke the error handler',
+                 function() {
+    invalidJsonpBtn.click();
+    fetchBtn.click();
+    expect(status.getText()).toMatch('0');
+    expect(data.getText()).toMatch('Request failed');
+  });
+                 </file>
+                 </example>
+                 */
+                function $http(requestConfig) {
+                    var config = {
+                        method: 'get',
+                        transformRequest: defaults.transformRequest,
+                        transformResponse: defaults.transformResponse
+                    };
+                    var headers = mergeHeaders(requestConfig);
+
+                    extend(config, requestConfig);
+                    config.headers = headers;
+                    config.method = uppercase(config.method);
+
+                    var xsrfValue = urlIsSameOrigin(config.url)
+                        ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName]
+                        : undefined;
+                    if (xsrfValue) {
+                        headers[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
+                    }
+
+
+                    var serverRequest = function(config) {
+                        headers = config.headers;
+                        var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);
+
+                        // strip content-type if data is undefined
+                        if (isUndefined(config.data)) {
+                            forEach(headers, function(value, header) {
+                                if (lowercase(header) === 'content-type') {
+                                    delete headers[header];
+                                }
+                            });
+                        }
+
+                        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+                            config.withCredentials = defaults.withCredentials;
+                        }
+
+                        // send request
+                        return sendReq(config, reqData, headers).then(transformResponse, transformResponse);
+                    };
+
+                    var chain = [serverRequest, undefined];
+                    var promise = $q.when(config);
+
+                    // apply interceptors
+                    forEach(reversedInterceptors, function(interceptor) {
+                        if (interceptor.request || interceptor.requestError) {
+                            chain.unshift(interceptor.request, interceptor.requestError);
+                        }
+                        if (interceptor.response || interceptor.responseError) {
+                            chain.push(interceptor.response, interceptor.responseError);
+                        }
+                    });
+
+                    while(chain.length) {
+                        var thenFn = chain.shift();
+                        var rejectFn = chain.shift();
+
+                        promise = promise.then(thenFn, rejectFn);
+                    }
+
+                    promise.success = function(fn) {
+                        promise.then(function(response) {
+                            fn(response.data, response.status, response.headers, config);
+                        });
+                        return promise;
+                    };
+
+                    promise.error = function(fn) {
+                        promise.then(null, function(response) {
+                            fn(response.data, response.status, response.headers, config);
+                        });
+                        return promise;
+                    };
+
+                    return promise;
+
+                    function transformResponse(response) {
+                        // make a copy since the response must be cacheable
+                        var resp = extend({}, response, {
+                            data: transformData(response.data, response.headers, config.transformResponse)
+                        });
+                        return (isSuccess(response.status))
+                            ? resp
+                            : $q.reject(resp);
+                    }
+
+                    function mergeHeaders(config) {
+                        var defHeaders = defaults.headers,
+                            reqHeaders = extend({}, config.headers),
+                            defHeaderName, lowercaseDefHeaderName, reqHeaderName;
+
+                        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
+
+                        // execute if header value is function
+                        execHeaders(defHeaders);
+                        execHeaders(reqHeaders);
+
+                        // using for-in instead of forEach to avoid unecessary iteration after header has been found
+                        defaultHeadersIteration:
+                            for (defHeaderName in defHeaders) {
+                                lowercaseDefHeaderName = lowercase(defHeaderName);
+
+                                for (reqHeaderName in reqHeaders) {
+                                    if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
+                                        continue defaultHeadersIteration;
+                                    }
+                                }
+
+                                reqHeaders[defHeaderName] = defHeaders[defHeaderName];
+                            }
+
+                        return reqHeaders;
+
+                        function execHeaders(headers) {
+                            var headerContent;
+
+                            forEach(headers, function(headerFn, header) {
+                                if (isFunction(headerFn)) {
+                                    headerContent = headerFn();
+                                    if (headerContent != null) {
+                                        headers[header] = headerContent;
+                                    } else {
+                                        delete headers[header];
+                                    }
+                                }
+                            });
+                        }
+                    }
+                }
+
+                $http.pendingRequests = [];
+
+                /**
+                 * @ngdoc method
+                 * @name $http#get
+                 *
+                 * @description
+                 * Shortcut method to perform `GET` request.
+                 *
+                 * @param {string} url Relative or absolute URL specifying the destination of the request
+                 * @param {Object=} config Optional configuration object
+                 * @returns {HttpPromise} Future object
+                 */
+
+                /**
+                 * @ngdoc method
+                 * @name $http#delete
+                 *
+                 * @description
+                 * Shortcut method to perform `DELETE` request.
+                 *
+                 * @param {string} url Relative or absolute URL specifying the destination of the request
+                 * @param {Object=} config Optional configuration object
+                 * @returns {HttpPromise} Future object
+                 */
+
+                /**
+                 * @ngdoc method
+                 * @name $http#head
+                 *
+                 * @description
+                 * Shortcut method to perform `HEAD` request.
+                 *
+                 * @param {string} url Relative or absolute URL specifying the destination of the request
+                 * @param {Object=} config Optional configuration object
+                 * @returns {HttpPromise} Future object
+                 */
+
+                /**
+                 * @ngdoc method
+                 * @name $http#jsonp
+                 *
+                 * @description
+                 * Shortcut method to perform `JSONP` request.
+                 *
+                 * @param {string} url Relative or absolute URL specifying the destination of the request.
+                 *                     Should contain `JSON_CALLBACK` string.
+                 * @param {Object=} config Optional configuration object
+                 * @returns {HttpPromise} Future object
+                 */
+                createShortMethods('get', 'delete', 'head', 'jsonp');
+
+                /**
+                 * @ngdoc method
+                 * @name $http#post
+                 *
+                 * @description
+                 * Shortcut method to perform `POST` request.
+                 *
+                 * @param {string} url Relative or absolute URL specifying the destination of the request
+                 * @param {*} data Request content
+                 * @param {Object=} config Optional configuration object
+                 * @returns {HttpPromise} Future object
+                 */
+
+                /**
+                 * @ngdoc method
+                 * @name $http#put
+                 *
+                 * @description
+                 * Shortcut method to perform `PUT` request.
+                 *
+                 * @param {string} url Relative or absolute URL specifying the destination of the request
+                 * @param {*} data Request content
+                 * @param {Object=} config Optional configuration object
+                 * @returns {HttpPromise} Future object
+                 */
+                createShortMethodsWithData('post', 'put');
+
+                /**
+                 * @ngdoc property
+                 * @name $http#defaults
+                 *
+                 * @description
+                 * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
+                 * default headers, withCredentials as well as request and response transformations.
+                 *
+                 * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
+                 */
+                $http.defaults = defaults;
+
+
+                return $http;
+
+
+                function createShortMethods(names) {
+                    forEach(arguments, function(name) {
+                        $http[name] = function(url, config) {
+                            return $http(extend(config || {}, {
+                                method: name,
+                                url: url
+                            }));
+                        };
+                    });
+                }
+
+
+                function createShortMethodsWithData(name) {
+                    forEach(arguments, function(name) {
+                        $http[name] = function(url, data, config) {
+                            return $http(extend(config || {}, {
+                                method: name,
+                                url: url,
+                                data: data
+                            }));
+                        };
+                    });
+                }
+
+
+                /**
+                 * Makes the request.
+                 *
+                 * !!! ACCESSES CLOSURE VARS:
+                 * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
+                 */
+                function sendReq(config, reqData, reqHeaders) {
+                    var deferred = $q.defer(),
+                        promise = deferred.promise,
+                        cache,
+                        cachedResp,
+                        url = buildUrl(config.url, config.params);
+
+                    $http.pendingRequests.push(config);
+                    promise.then(removePendingReq, removePendingReq);
+
+
+                    if ((config.cache || defaults.cache) && config.cache !== false && config.method == 'GET') {
+                        cache = isObject(config.cache) ? config.cache
+                            : isObject(defaults.cache) ? defaults.cache
+                            : defaultCache;
+                    }
+
+                    if (cache) {
+                        cachedResp = cache.get(url);
+                        if (isDefined(cachedResp)) {
+                            if (cachedResp.then) {
+                                // cached request has already been sent, but there is no response yet
+                                cachedResp.then(removePendingReq, removePendingReq);
+                                return cachedResp;
+                            } else {
+                                // serving from cache
+                                if (isArray(cachedResp)) {
+                                    resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2]), cachedResp[3]);
+                                } else {
+                                    resolvePromise(cachedResp, 200, {}, 'OK');
+                                }
+                            }
+                        } else {
+                            // put the promise for the non-transformed response into cache as a placeholder
+                            cache.put(url, promise);
+                        }
+                    }
+
+                    // if we won't have the response in cache, send the request to the backend
+                    if (isUndefined(cachedResp)) {
+                        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
+                            config.withCredentials, config.responseType);
+                    }
+
+                    return promise;
+
+
+                    /**
+                     * Callback registered to $httpBackend():
+                     *  - caches the response if desired
+                     *  - resolves the raw $http promise
+                     *  - calls $apply
+                     */
+                    function done(status, response, headersString, statusText) {
+                        if (cache) {
+                            if (isSuccess(status)) {
+                                cache.put(url, [status, response, parseHeaders(headersString), statusText]);
+                            } else {
+                                // remove promise from the cache
+                                cache.remove(url);
+                            }
+                        }
+
+                        resolvePromise(response, status, headersString, statusText);
+                        if (!$rootScope.$$phase) $rootScope.$apply();
+                    }
+
+
+                    /**
+                     * Resolves the raw $http promise.
+                     */
+                    function resolvePromise(response, status, headers, statusText) {
+                        // normalize internal statuses to 0
+                        status = Math.max(status, 0);
+
+                        (isSuccess(status) ? deferred.resolve : deferred.reject)({
+                            data: response,
+                            status: status,
+                            headers: headersGetter(headers),
+                            config: config,
+                            statusText : statusText
+                        });
+                    }
+
+
+                    function removePendingReq() {
+                        var idx = indexOf($http.pendingRequests, config);
+                        if (idx !== -1) $http.pendingRequests.splice(idx, 1);
+                    }
+                }
+
+
+                function buildUrl(url, params) {
+                    if (!params) return url;
+                    var parts = [];
+                    forEachSorted(params, function(value, key) {
+                        if (value === null || isUndefined(value)) return;
+                        if (!isArray(value)) value = [value];
+
+                        forEach(value, function(v) {
+                            if (isObject(v)) {
+                                v = toJson(v);
+                            }
+                            parts.push(encodeUriQuery(key) + '=' +
+                            encodeUriQuery(v));
+                        });
+                    });
+                    if(parts.length > 0) {
+                        url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
+                    }
+                    return url;
+                }
+
+
+            }];
+    }
+
+    function createXhr(method) {
+        //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
+        //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
+        //if it is available
+        if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
+            !window.XMLHttpRequest)) {
+            return new window.ActiveXObject("Microsoft.XMLHTTP");
+        } else if (window.XMLHttpRequest) {
+            return new window.XMLHttpRequest();
+        }
+
+        throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
+    }
+
+    /**
+     * @ngdoc service
+     * @name $httpBackend
+     * @requires $window
+     * @requires $document
+     *
+     * @description
+     * HTTP backend used by the {@link ng.$http service} that delegates to
+     * XMLHttpRequest object or JSONP and deals with browser incompatibilities.
+     *
+     * You should never need to use this service directly, instead use the higher-level abstractions:
+     * {@link ng.$http $http} or {@link ngResource.$resource $resource}.
+     *
+     * During testing this implementation is swapped with {@link ngMock.$httpBackend mock
+ * $httpBackend} which can be trained with responses.
+     */
+    function $HttpBackendProvider() {
+        this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {
+            return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]);
+        }];
+    }
+
+    function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
+        var ABORTED = -1;
+
+        // TODO(vojta): fix the signature
+        return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
+            var status;
+            $browser.$$incOutstandingRequestCount();
+            url = url || $browser.url();
+
+            if (lowercase(method) == 'jsonp') {
+                var callbackId = '_' + (callbacks.counter++).toString(36);
+                callbacks[callbackId] = function(data) {
+                    callbacks[callbackId].data = data;
+                };
+
+                var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
+                    function() {
+                        if (callbacks[callbackId].data) {
+                            completeRequest(callback, 200, callbacks[callbackId].data);
+                        } else {
+                            completeRequest(callback, status || -2);
+                        }
+                        callbacks[callbackId] = angular.noop;
+                    });
+            } else {
+
+                var xhr = createXhr(method);
+
+                xhr.open(method, url, true);
+                forEach(headers, function(value, key) {
+                    if (isDefined(value)) {
+                        xhr.setRequestHeader(key, value);
+                    }
+                });
+
+                // In IE6 and 7, this might be called synchronously when xhr.send below is called and the
+                // response is in the cache. the promise api will ensure that to the app code the api is
+                // always async
+                xhr.onreadystatechange = function() {
+                    // onreadystatechange might get called multiple times with readyState === 4 on mobile webkit caused by
+                    // xhrs that are resolved while the app is in the background (see #5426).
+                    // since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before
+                    // continuing
+                    //
+                    // we can't set xhr.onreadystatechange to undefined or delete it because that breaks IE8 (method=PATCH) and
+                    // Safari respectively.
+                    if (xhr && xhr.readyState == 4) {
+                        var responseHeaders = null,
+                            response = null;
+
+                        if(status !== ABORTED) {
+                            responseHeaders = xhr.getAllResponseHeaders();
+
+                            // responseText is the old-school way of retrieving response (supported by IE8 & 9)
+                            // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
+                            response = ('response' in xhr) ? xhr.response : xhr.responseText;
+                        }
+
+                        completeRequest(callback,
+                            status || xhr.status,
+                            response,
+                            responseHeaders,
+                            xhr.statusText || '');
+                    }
+                };
+
+                if (withCredentials) {
+                    xhr.withCredentials = true;
+                }
+
+                if (responseType) {
+                    try {
+                        xhr.responseType = responseType;
+                    } catch (e) {
+                        // WebKit added support for the json responseType value on 09/03/2013
+                        // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+                        // known to throw when setting the value "json" as the response type. Other older
+                        // browsers implementing the responseType
+                        //
+                        // The json response type can be ignored if not supported, because JSON payloads are
+                        // parsed on the client-side regardless.
+                        if (responseType !== 'json') {
+                            throw e;
+                        }
+                    }
+                }
+
+                xhr.send(post || null);
+            }
+
+            if (timeout > 0) {
+                var timeoutId = $browserDefer(timeoutRequest, timeout);
+            } else if (timeout && timeout.then) {
+                timeout.then(timeoutRequest);
+            }
+
+
+            function timeoutRequest() {
+                status = ABORTED;
+                jsonpDone && jsonpDone();
+                xhr && xhr.abort();
+            }
+
+            function completeRequest(callback, status, response, headersString, statusText) {
+                // cancel timeout and subsequent timeout promise resolution
+                timeoutId && $browserDefer.cancel(timeoutId);
+                jsonpDone = xhr = null;
+
+                // fix status code when it is 0 (0 status is undocumented).
+                // Occurs when accessing file resources or on Android 4.1 stock browser
+                // while retrieving files from application cache.
+                if (status === 0) {
+                    status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
+                }
+
+                // normalize IE bug (http://bugs.jquery.com/ticket/1450)
+                status = status === 1223 ? 204 : status;
+                statusText = statusText || '';
+
+                callback(status, response, headersString, statusText);
+                $browser.$$completeOutstandingRequest(noop);
+            }
+        };
+
+        function jsonpReq(url, done) {
+            // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
+            // - fetches local scripts via XHR and evals them
+            // - adds and immediately removes script elements from the document
+            var script = rawDocument.createElement('script'),
+                doneWrapper = function() {
+                    script.onreadystatechange = script.onload = script.onerror = null;
+                    rawDocument.body.removeChild(script);
+                    if (done) done();
+                };
+
+            script.type = 'text/javascript';
+            script.src = url;
+
+            if (msie && msie <= 8) {
+                script.onreadystatechange = function() {
+                    if (/loaded|complete/.test(script.readyState)) {
+                        doneWrapper();
+                    }
+                };
+            } else {
+                script.onload = script.onerror = function() {
+                    doneWrapper();
+                };
+            }
+
+            rawDocument.body.appendChild(script);
+            return doneWrapper;
+        }
+    }
+
+    var $interpolateMinErr = minErr('$interpolate');
+
+    /**
+     * @ngdoc provider
+     * @name $interpolateProvider
+     * @function
+     *
+     * @description
+     *
+     * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
+     *
+     * @example
+     <example module="customInterpolationApp">
+     <file name="index.html">
+     <script>
+     var customInterpolationApp = angular.module('customInterpolationApp', []);
+
+     customInterpolationApp.config(function($interpolateProvider) {
+    $interpolateProvider.startSymbol('//');
+    $interpolateProvider.endSymbol('//');
+  });
+
+
+     customInterpolationApp.controller('DemoController', function DemoController() {
+      this.label = "This binding is brought you by // interpolation symbols.";
+  });
+     </script>
+     <div ng-app="App" ng-controller="DemoController as demo">
+     //demo.label//
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should interpolate binding with custom symbols', function() {
+    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
+  });
+     </file>
+     </example>
+     */
+    function $InterpolateProvider() {
+        var startSymbol = '{{';
+        var endSymbol = '}}';
+
+        /**
+         * @ngdoc method
+         * @name $interpolateProvider#startSymbol
+         * @description
+         * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
+   *
+   * @param {string=} value new value to set the starting symbol to.
+         * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+         */
+        this.startSymbol = function(value){
+            if (value) {
+                startSymbol = value;
+                return this;
+            } else {
+                return startSymbol;
+            }
+        };
+
+        /**
+         * @ngdoc method
+         * @name $interpolateProvider#endSymbol
+         * @description
+         * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+         *
+         * @param {string=} value new value to set the ending symbol to.
+         * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+         */
+        this.endSymbol = function(value){
+            if (value) {
+                endSymbol = value;
+                return this;
+            } else {
+                return endSymbol;
+            }
+        };
+
+
+        this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
+            var startSymbolLength = startSymbol.length,
+                endSymbolLength = endSymbol.length;
+
+            /**
+             * @ngdoc service
+             * @name $interpolate
+             * @function
+             *
+             * @requires $parse
+             * @requires $sce
+             *
+             * @description
+             *
+             * Compiles a string with markup into an interpolation function. This service is used by the
+             * HTML {@link ng.$compile $compile} service for data binding. See
+             * {@link ng.$interpolateProvider $interpolateProvider} for configuring the
+             * interpolation markup.
+             *
+             *
+             * ```js
+             *   var $interpolate = ...; // injected
+             *   var exp = $interpolate('Hello {{name | uppercase}}!');
+             *   expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');
+             * ```
+             *
+             *
+             * @param {string} text The text with markup to interpolate.
+             * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
+             *    embedded expression in order to return an interpolation function. Strings with no
+             *    embedded expression will return null for the interpolation function.
+             * @param {string=} trustedContext when provided, the returned function passes the interpolated
+             *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,
+     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that
+             *    provides Strict Contextual Escaping for details.
+             * @returns {function(context)} an interpolation function which is used to compute the
+             *    interpolated string. The function has these parameters:
+             *
+             *    * `context`: an object against which any expressions embedded in the strings are evaluated
+             *      against.
+             *
+             */
+            function $interpolate(text, mustHaveExpression, trustedContext) {
+                var startIndex,
+                    endIndex,
+                    index = 0,
+                    parts = [],
+                    length = text.length,
+                    hasInterpolation = false,
+                    fn,
+                    exp,
+                    concat = [];
+
+                while(index < length) {
+                    if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+                        ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) {
+                        (index != startIndex) && parts.push(text.substring(index, startIndex));
+                        parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex)));
+                        fn.exp = exp;
+                        index = endIndex + endSymbolLength;
+                        hasInterpolation = true;
+                    } else {
+                        // we did not find anything, so we have to add the remainder to the parts array
+                        (index != length) && parts.push(text.substring(index));
+                        index = length;
+                    }
+                }
+
+                if (!(length = parts.length)) {
+                    // we added, nothing, must have been an empty string.
+                    parts.push('');
+                    length = 1;
+                }
+
+                // Concatenating expressions makes it hard to reason about whether some combination of
+                // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a
+                // single expression be used for iframe[src], object[src], etc., we ensure that the value
+                // that's used is assigned or constructed by some JS code somewhere that is more testable or
+                // make it obvious that you bound the value to some user controlled value.  This helps reduce
+                // the load when auditing for XSS issues.
+                if (trustedContext && parts.length > 1) {
+                    throw $interpolateMinErr('noconcat',
+                        "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+                        "interpolations that concatenate multiple expressions when a trusted value is " +
+                        "required.  See http://docs.angularjs.org/api/ng.$sce", text);
+                }
+
+                if (!mustHaveExpression  || hasInterpolation) {
+                    concat.length = length;
+                    fn = function(context) {
+                        try {
+                            for(var i = 0, ii = length, part; i<ii; i++) {
+                                if (typeof (part = parts[i]) == 'function') {
+                                    part = part(context);
+                                    if (trustedContext) {
+                                        part = $sce.getTrusted(trustedContext, part);
+                                    } else {
+                                        part = $sce.valueOf(part);
+                                    }
+                                    if (part === null || isUndefined(part)) {
+                                        part = '';
+                                    } else if (typeof part != 'string') {
+                                        part = toJson(part);
+                                    }
+                                }
+                                concat[i] = part;
+                            }
+                            return concat.join('');
+                        }
+                        catch(err) {
+                            var newErr = $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text,
+                                err.toString());
+                            $exceptionHandler(newErr);
+                        }
+                    };
+                    fn.exp = text;
+                    fn.parts = parts;
+                    return fn;
+                }
+            }
+
+
+            /**
+             * @ngdoc method
+             * @name $interpolate#startSymbol
+             * @description
+             * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
+     *
+     * Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change
+             * the symbol.
+             *
+             * @returns {string} start symbol.
+             */
+            $interpolate.startSymbol = function() {
+                return startSymbol;
+            };
+
+
+            /**
+             * @ngdoc method
+             * @name $interpolate#endSymbol
+             * @description
+             * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+             *
+             * Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change
+             * the symbol.
+             *
+             * @returns {string} end symbol.
+             */
+            $interpolate.endSymbol = function() {
+                return endSymbol;
+            };
+
+            return $interpolate;
+        }];
+    }
+
+    function $IntervalProvider() {
+        this.$get = ['$rootScope', '$window', '$q',
+            function($rootScope,   $window,   $q) {
+                var intervals = {};
+
+
+                /**
+                 * @ngdoc service
+                 * @name $interval
+                 *
+                 * @description
+                 * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`
+                 * milliseconds.
+                 *
+                 * The return value of registering an interval function is a promise. This promise will be
+                 * notified upon each tick of the interval, and will be resolved after `count` iterations, or
+                 * run indefinitely if `count` is not defined. The value of the notification will be the
+                 * number of iterations that have run.
+                 * To cancel an interval, call `$interval.cancel(promise)`.
+                 *
+                 * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+                 * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+                 * time.
+                 *
+                 * <div class="alert alert-warning">
+                 * **Note**: Intervals created by this service must be explicitly destroyed when you are finished
+                 * with them.  In particular they are not automatically destroyed when a controller's scope or a
+                 * directive's element are destroyed.
+                 * You should take this into consideration and make sure to always cancel the interval at the
+                 * appropriate moment.  See the example below for more details on how and when to do this.
+                 * </div>
+                 *
+                 * @param {function()} fn A function that should be called repeatedly.
+                 * @param {number} delay Number of milliseconds between each function call.
+                 * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+                 *   indefinitely.
+                 * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+                 *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+                 * @returns {promise} A promise which will be notified on each iteration.
+                 *
+                 * @example
+                 * <example module="time">
+                 *   <file name="index.html">
+                 *     <script>
+                 *       function Ctrl2($scope,$interval) {
+      *         $scope.format = 'M/d/yy h:mm:ss a';
+      *         $scope.blood_1 = 100;
+      *         $scope.blood_2 = 120;
+      *
+      *         var stop;
+      *         $scope.fight = function() {
+      *           // Don't start a new fight if we are already fighting
+      *           if ( angular.isDefined(stop) ) return;
+      *
+      *           stop = $interval(function() {
+      *             if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
+      *                 $scope.blood_1 = $scope.blood_1 - 3;
+      *                 $scope.blood_2 = $scope.blood_2 - 4;
+      *             } else {
+      *                 $scope.stopFight();
+      *             }
+      *           }, 100);
+      *         };
+      *
+      *         $scope.stopFight = function() {
+      *           if (angular.isDefined(stop)) {
+      *             $interval.cancel(stop);
+      *             stop = undefined;
+      *           }
+      *         };
+      *
+      *         $scope.resetFight = function() {
+      *           $scope.blood_1 = 100;
+      *           $scope.blood_2 = 120;
+      *         }
+      *
+      *         $scope.$on('$destroy', function() {
+      *           // Make sure that the interval is destroyed too
+      *           $scope.stopFight();
+      *         });
+      *       }
+                 *
+                 *       angular.module('time', [])
+                 *         // Register the 'myCurrentTime' directive factory method.
+                 *         // We inject $interval and dateFilter service since the factory method is DI.
+                 *         .directive('myCurrentTime', function($interval, dateFilter) {
+      *           // return the directive link function. (compile function not needed)
+      *           return function(scope, element, attrs) {
+      *             var format,  // date format
+      *             stopTime; // so that we can cancel the time updates
+      *
+      *             // used to update the UI
+      *             function updateTime() {
+      *               element.text(dateFilter(new Date(), format));
+      *             }
+      *
+      *             // watch the expression, and update the UI on change.
+      *             scope.$watch(attrs.myCurrentTime, function(value) {
+      *               format = value;
+      *               updateTime();
+      *             });
+      *
+      *             stopTime = $interval(updateTime, 1000);
+      *
+      *             // listen on DOM destroy (removal) event, and cancel the next UI update
+      *             // to prevent updating time ofter the DOM element was removed.
+      *             element.bind('$destroy', function() {
+      *               $interval.cancel(stopTime);
+      *             });
+      *           }
+      *         });
+                 *     </script>
+                 *
+                 *     <div>
+                 *       <div ng-controller="Ctrl2">
+                 *         Date format: <input ng-model="format"> <hr/>
+                 *         Current time is: <span my-current-time="format"></span>
+                 *         <hr/>
+                 *         Blood 1 : <font color='red'>{{blood_1}}</font>
+                 *         Blood 2 : <font color='red'>{{blood_2}}</font>
+                 *         <button type="button" data-ng-click="fight()">Fight</button>
+                 *         <button type="button" data-ng-click="stopFight()">StopFight</button>
+                 *         <button type="button" data-ng-click="resetFight()">resetFight</button>
+                 *       </div>
+                 *     </div>
+                 *
+                 *   </file>
+                 * </example>
+                 */
+                function interval(fn, delay, count, invokeApply) {
+                    var setInterval = $window.setInterval,
+                        clearInterval = $window.clearInterval,
+                        deferred = $q.defer(),
+                        promise = deferred.promise,
+                        iteration = 0,
+                        skipApply = (isDefined(invokeApply) && !invokeApply);
+
+                    count = isDefined(count) ? count : 0;
+
+                    promise.then(null, null, fn);
+
+                    promise.$$intervalId = setInterval(function tick() {
+                        deferred.notify(iteration++);
+
+                        if (count > 0 && iteration >= count) {
+                            deferred.resolve(iteration);
+                            clearInterval(promise.$$intervalId);
+                            delete intervals[promise.$$intervalId];
+                        }
+
+                        if (!skipApply) $rootScope.$apply();
+
+                    }, delay);
+
+                    intervals[promise.$$intervalId] = deferred;
+
+                    return promise;
+                }
+
+
+                /**
+                 * @ngdoc method
+                 * @name $interval#cancel
+                 *
+                 * @description
+                 * Cancels a task associated with the `promise`.
+                 *
+                 * @param {promise} promise returned by the `$interval` function.
+                 * @returns {boolean} Returns `true` if the task was successfully canceled.
+                 */
+                interval.cancel = function(promise) {
+                    if (promise && promise.$$intervalId in intervals) {
+                        intervals[promise.$$intervalId].reject('canceled');
+                        clearInterval(promise.$$intervalId);
+                        delete intervals[promise.$$intervalId];
+                        return true;
+                    }
+                    return false;
+                };
+
+                return interval;
+            }];
+    }
+
+    /**
+     * @ngdoc service
+     * @name $locale
+     *
+     * @description
+     * $locale service provides localization rules for various Angular components. As of right now the
+     * only public api is:
+     *
+     * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+     */
+    function $LocaleProvider(){
+        this.$get = function() {
+            return {
+                id: 'en-us',
+
+                NUMBER_FORMATS: {
+                    DECIMAL_SEP: '.',
+                    GROUP_SEP: ',',
+                    PATTERNS: [
+                        { // Decimal Pattern
+                            minInt: 1,
+                            minFrac: 0,
+                            maxFrac: 3,
+                            posPre: '',
+                            posSuf: '',
+                            negPre: '-',
+                            negSuf: '',
+                            gSize: 3,
+                            lgSize: 3
+                        },{ //Currency Pattern
+                            minInt: 1,
+                            minFrac: 2,
+                            maxFrac: 2,
+                            posPre: '\u00A4',
+                            posSuf: '',
+                            negPre: '(\u00A4',
+                            negSuf: ')',
+                            gSize: 3,
+                            lgSize: 3
+                        }
+                    ],
+                    CURRENCY_SYM: '$'
+                },
+
+                DATETIME_FORMATS: {
+                    MONTH:
+                        'January,February,March,April,May,June,July,August,September,October,November,December'
+                            .split(','),
+                    SHORTMONTH:  'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
+                    DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
+                    SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
+                    AMPMS: ['AM','PM'],
+                    medium: 'MMM d, y h:mm:ss a',
+                    short: 'M/d/yy h:mm a',
+                    fullDate: 'EEEE, MMMM d, y',
+                    longDate: 'MMMM d, y',
+                    mediumDate: 'MMM d, y',
+                    shortDate: 'M/d/yy',
+                    mediumTime: 'h:mm:ss a',
+                    shortTime: 'h:mm a'
+                },
+
+                pluralCat: function(num) {
+                    if (num === 1) {
+                        return 'one';
+                    }
+                    return 'other';
+                }
+            };
+        };
+    }
+
+    var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
+        DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
+    var $locationMinErr = minErr('$location');
+
+
+    /**
+     * Encode path using encodeUriSegment, ignoring forward slashes
+     *
+     * @param {string} path Path to encode
+     * @returns {string}
+     */
+    function encodePath(path) {
+        var segments = path.split('/'),
+            i = segments.length;
+
+        while (i--) {
+            segments[i] = encodeUriSegment(segments[i]);
+        }
+
+        return segments.join('/');
+    }
+
+    function parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {
+        var parsedUrl = urlResolve(absoluteUrl, appBase);
+
+        locationObj.$$protocol = parsedUrl.protocol;
+        locationObj.$$host = parsedUrl.hostname;
+        locationObj.$$port = int(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
+    }
+
+
+    function parseAppUrl(relativeUrl, locationObj, appBase) {
+        var prefixed = (relativeUrl.charAt(0) !== '/');
+        if (prefixed) {
+            relativeUrl = '/' + relativeUrl;
+        }
+        var match = urlResolve(relativeUrl, appBase);
+        locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
+            match.pathname.substring(1) : match.pathname);
+        locationObj.$$search = parseKeyValue(match.search);
+        locationObj.$$hash = decodeURIComponent(match.hash);
+
+        // make sure path starts with '/';
+        if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
+            locationObj.$$path = '/' + locationObj.$$path;
+        }
+    }
+
+
+    /**
+     *
+     * @param {string} begin
+     * @param {string} whole
+     * @returns {string} returns text from whole after begin or undefined if it does not begin with
+     *                   expected string.
+     */
+    function beginsWith(begin, whole) {
+        if (whole.indexOf(begin) === 0) {
+            return whole.substr(begin.length);
+        }
+    }
+
+
+    function stripHash(url) {
+        var index = url.indexOf('#');
+        return index == -1 ? url : url.substr(0, index);
+    }
+
+
+    function stripFile(url) {
+        return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
+    }
+
+    /* return the server only (scheme://host:port) */
+    function serverBase(url) {
+        return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
+    }
+
+
+    /**
+     * LocationHtml5Url represents an url
+     * This object is exposed as $location service when HTML5 mode is enabled and supported
+     *
+     * @constructor
+     * @param {string} appBase application base URL
+     * @param {string} basePrefix url path prefix
+     */
+    function LocationHtml5Url(appBase, basePrefix) {
+        this.$$html5 = true;
+        basePrefix = basePrefix || '';
+        var appBaseNoFile = stripFile(appBase);
+        parseAbsoluteUrl(appBase, this, appBase);
+
+
+        /**
+         * Parse given html5 (regular) url string into properties
+         * @param {string} newAbsoluteUrl HTML5 url
+         * @private
+         */
+        this.$$parse = function(url) {
+            var pathUrl = beginsWith(appBaseNoFile, url);
+            if (!isString(pathUrl)) {
+                throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
+                    appBaseNoFile);
+            }
+
+            parseAppUrl(pathUrl, this, appBase);
+
+            if (!this.$$path) {
+                this.$$path = '/';
+            }
+
+            this.$$compose();
+        };
+
+        /**
+         * Compose url and update `absUrl` property
+         * @private
+         */
+        this.$$compose = function() {
+            var search = toKeyValue(this.$$search),
+                hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+            this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+            this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
+        };
+
+        this.$$rewrite = function(url) {
+            var appUrl, prevAppUrl;
+
+            if ( (appUrl = beginsWith(appBase, url)) !== undefined ) {
+                prevAppUrl = appUrl;
+                if ( (appUrl = beginsWith(basePrefix, appUrl)) !== undefined ) {
+                    return appBaseNoFile + (beginsWith('/', appUrl) || appUrl);
+                } else {
+                    return appBase + prevAppUrl;
+                }
+            } else if ( (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ) {
+                return appBaseNoFile + appUrl;
+            } else if (appBaseNoFile == url + '/') {
+                return appBaseNoFile;
+            }
+        };
+    }
+
+
+    /**
+     * LocationHashbangUrl represents url
+     * This object is exposed as $location service when developer doesn't opt into html5 mode.
+     * It also serves as the base class for html5 mode fallback on legacy browsers.
+     *
+     * @constructor
+     * @param {string} appBase application base URL
+     * @param {string} hashPrefix hashbang prefix
+     */
+    function LocationHashbangUrl(appBase, hashPrefix) {
+        var appBaseNoFile = stripFile(appBase);
+
+        parseAbsoluteUrl(appBase, this, appBase);
+
+
+        /**
+         * Parse given hashbang url into properties
+         * @param {string} url Hashbang url
+         * @private
+         */
+        this.$$parse = function(url) {
+            var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
+            var withoutHashUrl = withoutBaseUrl.charAt(0) == '#'
+                ? beginsWith(hashPrefix, withoutBaseUrl)
+                : (this.$$html5)
+                ? withoutBaseUrl
+                : '';
+
+            if (!isString(withoutHashUrl)) {
+                throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url,
+                    hashPrefix);
+            }
+            parseAppUrl(withoutHashUrl, this, appBase);
+
+            this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
+
+            this.$$compose();
+
+            /*
+             * In Windows, on an anchor node on documents loaded from
+             * the filesystem, the browser will return a pathname
+             * prefixed with the drive name ('/C:/path') when a
+             * pathname without a drive is set:
+             *  * a.setAttribute('href', '/foo')
+             *   * a.pathname === '/C:/foo' //true
+             *
+             * Inside of Angular, we're always using pathnames that
+             * do not include drive names for routing.
+             */
+            function removeWindowsDriveName (path, url, base) {
+                /*
+                 Matches paths for file protocol on windows,
+                 such as /C:/foo/bar, and captures only /foo/bar.
+                 */
+                var windowsFilePathExp = /^\/?.*?:(\/.*)/;
+
+                var firstPathSegmentMatch;
+
+                //Get the relative path from the input URL.
+                if (url.indexOf(base) === 0) {
+                    url = url.replace(base, '');
+                }
+
+                /*
+                 * The input URL intentionally contains a
+                 * first path segment that ends with a colon.
+                 */
+                if (windowsFilePathExp.exec(url)) {
+                    return path;
+                }
+
+                firstPathSegmentMatch = windowsFilePathExp.exec(path);
+                return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
+            }
+        };
+
+        /**
+         * Compose hashbang url and update `absUrl` property
+         * @private
+         */
+        this.$$compose = function() {
+            var search = toKeyValue(this.$$search),
+                hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+            this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+            this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+        };
+
+        this.$$rewrite = function(url) {
+            if(stripHash(appBase) == stripHash(url)) {
+                return url;
+            }
+        };
+    }
+
+
+    /**
+     * LocationHashbangUrl represents url
+     * This object is exposed as $location service when html5 history api is enabled but the browser
+     * does not support it.
+     *
+     * @constructor
+     * @param {string} appBase application base URL
+     * @param {string} hashPrefix hashbang prefix
+     */
+    function LocationHashbangInHtml5Url(appBase, hashPrefix) {
+        this.$$html5 = true;
+        LocationHashbangUrl.apply(this, arguments);
+
+        var appBaseNoFile = stripFile(appBase);
+
+        this.$$rewrite = function(url) {
+            var appUrl;
+
+            if ( appBase == stripHash(url) ) {
+                return url;
+            } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) {
+                return appBase + hashPrefix + appUrl;
+            } else if ( appBaseNoFile === url + '/') {
+                return appBaseNoFile;
+            }
+        };
+    }
+
+
+    LocationHashbangInHtml5Url.prototype =
+        LocationHashbangUrl.prototype =
+            LocationHtml5Url.prototype = {
+
+                /**
+                 * Are we in html5 mode?
+                 * @private
+                 */
+                $$html5: false,
+
+                /**
+                 * Has any change been replacing ?
+                 * @private
+                 */
+                $$replace: false,
+
+                /**
+                 * @ngdoc method
+                 * @name $location#absUrl
+                 *
+                 * @description
+                 * This method is getter only.
+                 *
+                 * Return full url representation with all segments encoded according to rules specified in
+                 * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
+                 *
+                 * @return {string} full url
+                 */
+                absUrl: locationGetter('$$absUrl'),
+
+                /**
+                 * @ngdoc method
+                 * @name $location#url
+                 *
+                 * @description
+                 * This method is getter / setter.
+                 *
+                 * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
+                 *
+                 * Change path, search and hash, when called with parameter and return `$location`.
+                 *
+                 * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
+                 * @param {string=} replace The path that will be changed
+                 * @return {string} url
+                 */
+                url: function(url, replace) {
+                    if (isUndefined(url))
+                        return this.$$url;
+
+                    var match = PATH_MATCH.exec(url);
+                    if (match[1]) this.path(decodeURIComponent(match[1]));
+                    if (match[2] || match[1]) this.search(match[3] || '');
+                    this.hash(match[5] || '', replace);
+
+                    return this;
+                },
+
+                /**
+                 * @ngdoc method
+                 * @name $location#protocol
+                 *
+                 * @description
+                 * This method is getter only.
+                 *
+                 * Return protocol of current url.
+                 *
+                 * @return {string} protocol of current url
+                 */
+                protocol: locationGetter('$$protocol'),
+
+                /**
+                 * @ngdoc method
+                 * @name $location#host
+                 *
+                 * @description
+                 * This method is getter only.
+                 *
+                 * Return host of current url.
+                 *
+                 * @return {string} host of current url.
+                 */
+                host: locationGetter('$$host'),
+
+                /**
+                 * @ngdoc method
+                 * @name $location#port
+                 *
+                 * @description
+                 * This method is getter only.
+                 *
+                 * Return port of current url.
+                 *
+                 * @return {Number} port
+                 */
+                port: locationGetter('$$port'),
+
+                /**
+                 * @ngdoc method
+                 * @name $location#path
+                 *
+                 * @description
+                 * This method is getter / setter.
+                 *
+                 * Return path of current url when called without any parameter.
+                 *
+                 * Change path when called with parameter and return `$location`.
+                 *
+                 * Note: Path should always begin with forward slash (/), this method will add the forward slash
+                 * if it is missing.
+                 *
+                 * @param {string=} path New path
+                 * @return {string} path
+                 */
+                path: locationGetterSetter('$$path', function(path) {
+                    return path.charAt(0) == '/' ? path : '/' + path;
+                }),
+
+                /**
+                 * @ngdoc method
+                 * @name $location#search
+                 *
+                 * @description
+                 * This method is getter / setter.
+                 *
+                 * Return search part (as object) of current url when called without any parameter.
+                 *
+                 * Change search part when called with parameter and return `$location`.
+                 *
+                 * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
+                 * hash object. Hash object may contain an array of values, which will be decoded as duplicates in
+                 * the url.
+                 *
+                 * @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will override only a
+                 * single search parameter. If `paramValue` is an array, it will set the parameter as a
+                 * comma-separated value. If `paramValue` is `null`, the parameter will be deleted.
+                 *
+                 * @return {string} search
+                 */
+                search: function(search, paramValue) {
+                    switch (arguments.length) {
+                        case 0:
+                            return this.$$search;
+                        case 1:
+                            if (isString(search)) {
+                                this.$$search = parseKeyValue(search);
+                            } else if (isObject(search)) {
+                                this.$$search = search;
+                            } else {
+                                throw $locationMinErr('isrcharg',
+                                    'The first argument of the `$location#search()` call must be a string or an object.');
+                            }
+                            break;
+                        default:
+                            if (isUndefined(paramValue) || paramValue === null) {
+                                delete this.$$search[search];
+                            } else {
+                                this.$$search[search] = paramValue;
+                            }
+                    }
+
+                    this.$$compose();
+                    return this;
+                },
+
+                /**
+                 * @ngdoc method
+                 * @name $location#hash
+                 *
+                 * @description
+                 * This method is getter / setter.
+                 *
+                 * Return hash fragment when called without any parameter.
+                 *
+                 * Change hash fragment when called with parameter and return `$location`.
+                 *
+                 * @param {string=} hash New hash fragment
+                 * @return {string} hash
+                 */
+                hash: locationGetterSetter('$$hash', identity),
+
+                /**
+                 * @ngdoc method
+                 * @name $location#replace
+                 *
+                 * @description
+                 * If called, all changes to $location during current `$digest` will be replacing current history
+                 * record, instead of adding new one.
+                 */
+                replace: function() {
+                    this.$$replace = true;
+                    return this;
+                }
+            };
+
+    function locationGetter(property) {
+        return function() {
+            return this[property];
+        };
+    }
+
+
+    function locationGetterSetter(property, preprocess) {
+        return function(value) {
+            if (isUndefined(value))
+                return this[property];
+
+            this[property] = preprocess(value);
+            this.$$compose();
+
+            return this;
+        };
+    }
+
+
+    /**
+     * @ngdoc service
+     * @name $location
+     *
+     * @requires $rootElement
+     *
+     * @description
+     * The $location service parses the URL in the browser address bar (based on the
+     * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
+     * available to your application. Changes to the URL in the address bar are reflected into
+     * $location service and changes to $location are reflected into the browser address bar.
+     *
+     * **The $location service:**
+     *
+     * - Exposes the current URL in the browser address bar, so you can
+     *   - Watch and observe the URL.
+     *   - Change the URL.
+     * - Synchronizes the URL with the browser when the user
+     *   - Changes the address bar.
+     *   - Clicks the back or forward button (or clicks a History link).
+     *   - Clicks on a link.
+     * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
+     *
+     * For more information see {@link guide/$location Developer Guide: Using $location}
+     */
+
+    /**
+     * @ngdoc provider
+     * @name $locationProvider
+     * @description
+     * Use the `$locationProvider` to configure how the application deep linking paths are stored.
+     */
+    function $LocationProvider(){
+        var hashPrefix = '',
+            html5Mode = false;
+
+        /**
+         * @ngdoc property
+         * @name $locationProvider#hashPrefix
+         * @description
+         * @param {string=} prefix Prefix for hash part (containing path and search)
+         * @returns {*} current value if used as getter or itself (chaining) if used as setter
+         */
+        this.hashPrefix = function(prefix) {
+            if (isDefined(prefix)) {
+                hashPrefix = prefix;
+                return this;
+            } else {
+                return hashPrefix;
+            }
+        };
+
+        /**
+         * @ngdoc property
+         * @name $locationProvider#html5Mode
+         * @description
+         * @param {boolean=} mode Use HTML5 strategy if available.
+         * @returns {*} current value if used as getter or itself (chaining) if used as setter
+         */
+        this.html5Mode = function(mode) {
+            if (isDefined(mode)) {
+                html5Mode = mode;
+                return this;
+            } else {
+                return html5Mode;
+            }
+        };
+
+        /**
+         * @ngdoc event
+         * @name $location#$locationChangeStart
+         * @eventType broadcast on root scope
+         * @description
+         * Broadcasted before a URL will change. This change can be prevented by calling
+         * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
+         * details about event object. Upon successful change
+         * {@link ng.$location#events_$locationChangeSuccess $locationChangeSuccess} is fired.
+         *
+         * @param {Object} angularEvent Synthetic event object.
+         * @param {string} newUrl New URL
+         * @param {string=} oldUrl URL that was before it was changed.
+         */
+
+        /**
+         * @ngdoc event
+         * @name $location#$locationChangeSuccess
+         * @eventType broadcast on root scope
+         * @description
+         * Broadcasted after a URL was changed.
+         *
+         * @param {Object} angularEvent Synthetic event object.
+         * @param {string} newUrl New URL
+         * @param {string=} oldUrl URL that was before it was changed.
+         */
+
+        this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement',
+            function( $rootScope,   $browser,   $sniffer,   $rootElement) {
+                var $location,
+                    LocationMode,
+                    baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''
+                    initialUrl = $browser.url(),
+                    appBase;
+
+                if (html5Mode) {
+                    appBase = serverBase(initialUrl) + (baseHref || '/');
+                    LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
+                } else {
+                    appBase = stripHash(initialUrl);
+                    LocationMode = LocationHashbangUrl;
+                }
+                $location = new LocationMode(appBase, '#' + hashPrefix);
+                $location.$$parse($location.$$rewrite(initialUrl));
+
+                $rootElement.on('click', function(event) {
+                    // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
+                    // currently we open nice url link and redirect then
+
+                    if (event.ctrlKey || event.metaKey || event.which == 2) return;
+
+                    var elm = jqLite(event.target);
+
+                    // traverse the DOM up to find first A tag
+                    while (lowercase(elm[0].nodeName) !== 'a') {
+                        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)
+                        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
+                    }
+
+                    var absHref = elm.prop('href');
+
+                    if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+                        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+                        // an animation.
+                        absHref = urlResolve(absHref.animVal).href;
+                    }
+
+                    var rewrittenUrl = $location.$$rewrite(absHref);
+
+                    if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) {
+                        event.preventDefault();
+                        if (rewrittenUrl != $browser.url()) {
+                            // update location manually
+                            $location.$$parse(rewrittenUrl);
+                            $rootScope.$apply();
+                            // hack to work around FF6 bug 684208 when scenario runner clicks on links
+                            window.angular['ff-684208-preventDefault'] = true;
+                        }
+                    }
+                });
+
+
+                // rewrite hashbang url <> html5 url
+                if ($location.absUrl() != initialUrl) {
+                    $browser.url($location.absUrl(), true);
+                }
+
+                // update $location when $browser url changes
+                $browser.onUrlChange(function(newUrl) {
+                    if ($location.absUrl() != newUrl) {
+                        $rootScope.$evalAsync(function() {
+                            var oldUrl = $location.absUrl();
+
+                            $location.$$parse(newUrl);
+                            if ($rootScope.$broadcast('$locationChangeStart', newUrl,
+                                    oldUrl).defaultPrevented) {
+                                $location.$$parse(oldUrl);
+                                $browser.url(oldUrl);
+                            } else {
+                                afterLocationChange(oldUrl);
+                            }
+                        });
+                        if (!$rootScope.$$phase) $rootScope.$digest();
+                    }
+                });
+
+                // update browser
+                var changeCounter = 0;
+                $rootScope.$watch(function $locationWatch() {
+                    var oldUrl = $browser.url();
+                    var currentReplace = $location.$$replace;
+
+                    if (!changeCounter || oldUrl != $location.absUrl()) {
+                        changeCounter++;
+                        $rootScope.$evalAsync(function() {
+                            if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl).
+                                    defaultPrevented) {
+                                $location.$$parse(oldUrl);
+                            } else {
+                                $browser.url($location.absUrl(), currentReplace);
+                                afterLocationChange(oldUrl);
+                            }
+                        });
+                    }
+                    $location.$$replace = false;
+
+                    return changeCounter;
+                });
+
+                return $location;
+
+                function afterLocationChange(oldUrl) {
+                    $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl);
+                }
+            }];
+    }
+
+    /**
+     * @ngdoc service
+     * @name $log
+     * @requires $window
+     *
+     * @description
+     * Simple service for logging. Default implementation safely writes the message
+     * into the browser's console (if present).
+     *
+     * The main purpose of this service is to simplify debugging and troubleshooting.
+     *
+     * The default is to log `debug` messages. You can use
+     * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
+     *
+     * @example
+     <example>
+     <file name="script.js">
+     function LogCtrl($scope, $log) {
+         $scope.$log = $log;
+         $scope.message = 'Hello World!';
+       }
+     </file>
+     <file name="index.html">
+     <div ng-controller="LogCtrl">
+     <p>Reload this page with open console, enter text and hit the log button...</p>
+     Message:
+     <input type="text" ng-model="message"/>
+     <button ng-click="$log.log(message)">log</button>
+     <button ng-click="$log.warn(message)">warn</button>
+     <button ng-click="$log.info(message)">info</button>
+     <button ng-click="$log.error(message)">error</button>
+     </div>
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc provider
+     * @name $logProvider
+     * @description
+     * Use the `$logProvider` to configure how the application logs messages
+     */
+    function $LogProvider(){
+        var debug = true,
+            self = this;
+
+        /**
+         * @ngdoc property
+         * @name $logProvider#debugEnabled
+         * @description
+         * @param {boolean=} flag enable or disable debug level messages
+         * @returns {*} current value if used as getter or itself (chaining) if used as setter
+         */
+        this.debugEnabled = function(flag) {
+            if (isDefined(flag)) {
+                debug = flag;
+                return this;
+            } else {
+                return debug;
+            }
+        };
+
+        this.$get = ['$window', function($window){
+            return {
+                /**
+                 * @ngdoc method
+                 * @name $log#log
+                 *
+                 * @description
+                 * Write a log message
+                 */
+                log: consoleLog('log'),
+
+                /**
+                 * @ngdoc method
+                 * @name $log#info
+                 *
+                 * @description
+                 * Write an information message
+                 */
+                info: consoleLog('info'),
+
+                /**
+                 * @ngdoc method
+                 * @name $log#warn
+                 *
+                 * @description
+                 * Write a warning message
+                 */
+                warn: consoleLog('warn'),
+
+                /**
+                 * @ngdoc method
+                 * @name $log#error
+                 *
+                 * @description
+                 * Write an error message
+                 */
+                error: consoleLog('error'),
+
+                /**
+                 * @ngdoc method
+                 * @name $log#debug
+                 *
+                 * @description
+                 * Write a debug message
+                 */
+                debug: (function () {
+                    var fn = consoleLog('debug');
+
+                    return function() {
+                        if (debug) {
+                            fn.apply(self, arguments);
+                        }
+                    };
+                }())
+            };
+
+            function formatError(arg) {
+                if (arg instanceof Error) {
+                    if (arg.stack) {
+                        arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
+                            ? 'Error: ' + arg.message + '\n' + arg.stack
+                            : arg.stack;
+                    } else if (arg.sourceURL) {
+                        arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
+                    }
+                }
+                return arg;
+            }
+
+            function consoleLog(type) {
+                var console = $window.console || {},
+                    logFn = console[type] || console.log || noop,
+                    hasApply = false;
+
+                // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
+                // The reason behind this is that console.log has type "object" in IE8...
+                try {
+                    hasApply = !!logFn.apply;
+                } catch (e) {}
+
+                if (hasApply) {
+                    return function() {
+                        var args = [];
+                        forEach(arguments, function(arg) {
+                            args.push(formatError(arg));
+                        });
+                        return logFn.apply(console, args);
+                    };
+                }
+
+                // we are IE which either doesn't have window.console => this is noop and we do nothing,
+                // or we are IE where console.log doesn't have apply so we log at least first 2 args
+                return function(arg1, arg2) {
+                    logFn(arg1, arg2 == null ? '' : arg2);
+                };
+            }
+        }];
+    }
+
+    var $parseMinErr = minErr('$parse');
+    var promiseWarningCache = {};
+    var promiseWarning;
+
+// Sandboxing Angular Expressions
+// ------------------------------
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to $scope and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
+//
+// As an example, consider the following Angular expression:
+//
+//   {}.toString.constructor(alert("evil JS code"))
+//
+// We want to prevent this type of access. For the sake of performance, during the lexing phase we
+// disallow any "dotted" access to any member named "constructor".
+//
+// For reflective calls (a[b]) we check that the value of the lookup is not the Function constructor
+// while evaluating the expression, which is a stronger but more expensive test. Since reflective
+// calls are expensive anyway, this is not such a big deal compared to static dereferencing.
+//
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser apis on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// A developer could foil the name check by aliasing the Function constructor under a different
+// name on the scope.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+
+    function ensureSafeMemberName(name, fullExpression) {
+        if (name === "constructor") {
+            throw $parseMinErr('isecfld',
+                'Referencing "constructor" field in Angular expressions is disallowed! Expression: {0}',
+                fullExpression);
+        }
+        return name;
+    }
+
+    function ensureSafeObject(obj, fullExpression) {
+        // nifty check if obj is Function that is fast and works across iframes and other contexts
+        if (obj) {
+            if (obj.constructor === obj) {
+                throw $parseMinErr('isecfn',
+                    'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+                    fullExpression);
+            } else if (// isWindow(obj)
+            obj.document && obj.location && obj.alert && obj.setInterval) {
+                throw $parseMinErr('isecwindow',
+                    'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+                    fullExpression);
+            } else if (// isElement(obj)
+            obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+                throw $parseMinErr('isecdom',
+                    'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+                    fullExpression);
+            }
+        }
+        return obj;
+    }
+
+    var OPERATORS = {
+        /* jshint bitwise : false */
+        'null':function(){return null;},
+        'true':function(){return true;},
+        'false':function(){return false;},
+        undefined:noop,
+        '+':function(self, locals, a,b){
+            a=a(self, locals); b=b(self, locals);
+            if (isDefined(a)) {
+                if (isDefined(b)) {
+                    return a + b;
+                }
+                return a;
+            }
+            return isDefined(b)?b:undefined;},
+        '-':function(self, locals, a,b){
+            a=a(self, locals); b=b(self, locals);
+            return (isDefined(a)?a:0)-(isDefined(b)?b:0);
+        },
+        '*':function(self, locals, a,b){return a(self, locals)*b(self, locals);},
+        '/':function(self, locals, a,b){return a(self, locals)/b(self, locals);},
+        '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);},
+        '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);},
+        '=':noop,
+        '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);},
+        '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);},
+        '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);},
+        '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);},
+        '<':function(self, locals, a,b){return a(self, locals)<b(self, locals);},
+        '>':function(self, locals, a,b){return a(self, locals)>b(self, locals);},
+        '<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);},
+        '>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);},
+        '&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);},
+        '||':function(self, locals, a,b){return a(self, locals)||b(self, locals);},
+        '&':function(self, locals, a,b){return a(self, locals)&b(self, locals);},
+//    '|':function(self, locals, a,b){return a|b;},
+        '|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));},
+        '!':function(self, locals, a){return !a(self, locals);}
+    };
+    /* jshint bitwise: true */
+    var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
+
+
+/////////////////////////////////////////
+
+
+    /**
+     * @constructor
+     */
+    var Lexer = function (options) {
+        this.options = options;
+    };
+
+    Lexer.prototype = {
+        constructor: Lexer,
+
+        lex: function (text) {
+            this.text = text;
+
+            this.index = 0;
+            this.ch = undefined;
+            this.lastCh = ':'; // can start regexp
+
+            this.tokens = [];
+
+            var token;
+            var json = [];
+
+            while (this.index < this.text.length) {
+                this.ch = this.text.charAt(this.index);
+                if (this.is('"\'')) {
+                    this.readString(this.ch);
+                } else if (this.isNumber(this.ch) || this.is('.') && this.isNumber(this.peek())) {
+                    this.readNumber();
+                } else if (this.isIdent(this.ch)) {
+                    this.readIdent();
+                    // identifiers can only be if the preceding char was a { or ,
+                    if (this.was('{,') && json[0] === '{' &&
+                        (token = this.tokens[this.tokens.length - 1])) {
+                        token.json = token.text.indexOf('.') === -1;
+                    }
+                } else if (this.is('(){}[].,;:?')) {
+                    this.tokens.push({
+                        index: this.index,
+                        text: this.ch,
+                        json: (this.was(':[,') && this.is('{[')) || this.is('}]:,')
+                    });
+                    if (this.is('{[')) json.unshift(this.ch);
+                    if (this.is('}]')) json.shift();
+                    this.index++;
+                } else if (this.isWhitespace(this.ch)) {
+                    this.index++;
+                    continue;
+                } else {
+                    var ch2 = this.ch + this.peek();
+                    var ch3 = ch2 + this.peek(2);
+                    var fn = OPERATORS[this.ch];
+                    var fn2 = OPERATORS[ch2];
+                    var fn3 = OPERATORS[ch3];
+                    if (fn3) {
+                        this.tokens.push({index: this.index, text: ch3, fn: fn3});
+                        this.index += 3;
+                    } else if (fn2) {
+                        this.tokens.push({index: this.index, text: ch2, fn: fn2});
+                        this.index += 2;
+                    } else if (fn) {
+                        this.tokens.push({
+                            index: this.index,
+                            text: this.ch,
+                            fn: fn,
+                            json: (this.was('[,:') && this.is('+-'))
+                        });
+                        this.index += 1;
+                    } else {
+                        this.throwError('Unexpected next character ', this.index, this.index + 1);
+                    }
+                }
+                this.lastCh = this.ch;
+            }
+            return this.tokens;
+        },
+
+        is: function(chars) {
+            return chars.indexOf(this.ch) !== -1;
+        },
+
+        was: function(chars) {
+            return chars.indexOf(this.lastCh) !== -1;
+        },
+
+        peek: function(i) {
+            var num = i || 1;
+            return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
+        },
+
+        isNumber: function(ch) {
+            return ('0' <= ch && ch <= '9');
+        },
+
+        isWhitespace: function(ch) {
+            // IE treats non-breaking space as \u00A0
+            return (ch === ' ' || ch === '\r' || ch === '\t' ||
+            ch === '\n' || ch === '\v' || ch === '\u00A0');
+        },
+
+        isIdent: function(ch) {
+            return ('a' <= ch && ch <= 'z' ||
+            'A' <= ch && ch <= 'Z' ||
+            '_' === ch || ch === '$');
+        },
+
+        isExpOperator: function(ch) {
+            return (ch === '-' || ch === '+' || this.isNumber(ch));
+        },
+
+        throwError: function(error, start, end) {
+            end = end || this.index;
+            var colStr = (isDefined(start)
+                ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'
+                : ' ' + end);
+            throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
+                error, colStr, this.text);
+        },
+
+        readNumber: function() {
+            var number = '';
+            var start = this.index;
+            while (this.index < this.text.length) {
+                var ch = lowercase(this.text.charAt(this.index));
+                if (ch == '.' || this.isNumber(ch)) {
+                    number += ch;
+                } else {
+                    var peekCh = this.peek();
+                    if (ch == 'e' && this.isExpOperator(peekCh)) {
+                        number += ch;
+                    } else if (this.isExpOperator(ch) &&
+                        peekCh && this.isNumber(peekCh) &&
+                        number.charAt(number.length - 1) == 'e') {
+                        number += ch;
+                    } else if (this.isExpOperator(ch) &&
+                        (!peekCh || !this.isNumber(peekCh)) &&
+                        number.charAt(number.length - 1) == 'e') {
+                        this.throwError('Invalid exponent');
+                    } else {
+                        break;
+                    }
+                }
+                this.index++;
+            }
+            number = 1 * number;
+            this.tokens.push({
+                index: start,
+                text: number,
+                json: true,
+                fn: function() { return number; }
+            });
+        },
+
+        readIdent: function() {
+            var parser = this;
+
+            var ident = '';
+            var start = this.index;
+
+            var lastDot, peekIndex, methodName, ch;
+
+            while (this.index < this.text.length) {
+                ch = this.text.charAt(this.index);
+                if (ch === '.' || this.isIdent(ch) || this.isNumber(ch)) {
+                    if (ch === '.') lastDot = this.index;
+                    ident += ch;
+                } else {
+                    break;
+                }
+                this.index++;
+            }
+
+            //check if this is not a method invocation and if it is back out to last dot
+            if (lastDot) {
+                peekIndex = this.index;
+                while (peekIndex < this.text.length) {
+                    ch = this.text.charAt(peekIndex);
+                    if (ch === '(') {
+                        methodName = ident.substr(lastDot - start + 1);
+                        ident = ident.substr(0, lastDot - start);
+                        this.index = peekIndex;
+                        break;
+                    }
+                    if (this.isWhitespace(ch)) {
+                        peekIndex++;
+                    } else {
+                        break;
+                    }
+                }
+            }
+
+
+            var token = {
+                index: start,
+                text: ident
+            };
+
+            // OPERATORS is our own object so we don't need to use special hasOwnPropertyFn
+            if (OPERATORS.hasOwnProperty(ident)) {
+                token.fn = OPERATORS[ident];
+                token.json = OPERATORS[ident];
+            } else {
+                var getter = getterFn(ident, this.options, this.text);
+                token.fn = extend(function(self, locals) {
+                    return (getter(self, locals));
+                }, {
+                    assign: function(self, value) {
+                        return setter(self, ident, value, parser.text, parser.options);
+                    }
+                });
+            }
+
+            this.tokens.push(token);
+
+            if (methodName) {
+                this.tokens.push({
+                    index:lastDot,
+                    text: '.',
+                    json: false
+                });
+                this.tokens.push({
+                    index: lastDot + 1,
+                    text: methodName,
+                    json: false
+                });
+            }
+        },
+
+        readString: function(quote) {
+            var start = this.index;
+            this.index++;
+            var string = '';
+            var rawString = quote;
+            var escape = false;
+            while (this.index < this.text.length) {
+                var ch = this.text.charAt(this.index);
+                rawString += ch;
+                if (escape) {
+                    if (ch === 'u') {
+                        var hex = this.text.substring(this.index + 1, this.index + 5);
+                        if (!hex.match(/[\da-f]{4}/i))
+                            this.throwError('Invalid unicode escape [\\u' + hex + ']');
+                        this.index += 4;
+                        string += String.fromCharCode(parseInt(hex, 16));
+                    } else {
+                        var rep = ESCAPE[ch];
+                        if (rep) {
+                            string += rep;
+                        } else {
+                            string += ch;
+                        }
+                    }
+                    escape = false;
+                } else if (ch === '\\') {
+                    escape = true;
+                } else if (ch === quote) {
+                    this.index++;
+                    this.tokens.push({
+                        index: start,
+                        text: rawString,
+                        string: string,
+                        json: true,
+                        fn: function() { return string; }
+                    });
+                    return;
+                } else {
+                    string += ch;
+                }
+                this.index++;
+            }
+            this.throwError('Unterminated quote', start);
+        }
+    };
+
+
+    /**
+     * @constructor
+     */
+    var Parser = function (lexer, $filter, options) {
+        this.lexer = lexer;
+        this.$filter = $filter;
+        this.options = options;
+    };
+
+    Parser.ZERO = extend(function () {
+        return 0;
+    }, {
+        constant: true
+    });
+
+    Parser.prototype = {
+        constructor: Parser,
+
+        parse: function (text, json) {
+            this.text = text;
+
+            //TODO(i): strip all the obsolte json stuff from this file
+            this.json = json;
+
+            this.tokens = this.lexer.lex(text);
+
+            if (json) {
+                // The extra level of aliasing is here, just in case the lexer misses something, so that
+                // we prevent any accidental execution in JSON.
+                this.assignment = this.logicalOR;
+
+                this.functionCall =
+                    this.fieldAccess =
+                        this.objectIndex =
+                            this.filterChain = function() {
+                                this.throwError('is not valid json', {text: text, index: 0});
+                            };
+            }
+
+            var value = json ? this.primary() : this.statements();
+
+            if (this.tokens.length !== 0) {
+                this.throwError('is an unexpected token', this.tokens[0]);
+            }
+
+            value.literal = !!value.literal;
+            value.constant = !!value.constant;
+
+            return value;
+        },
+
+        primary: function () {
+            var primary;
+            if (this.expect('(')) {
+                primary = this.filterChain();
+                this.consume(')');
+            } else if (this.expect('[')) {
+                primary = this.arrayDeclaration();
+            } else if (this.expect('{')) {
+                primary = this.object();
+            } else {
+                var token = this.expect();
+                primary = token.fn;
+                if (!primary) {
+                    this.throwError('not a primary expression', token);
+                }
+                if (token.json) {
+                    primary.constant = true;
+                    primary.literal = true;
+                }
+            }
+
+            var next, context;
+            while ((next = this.expect('(', '[', '.'))) {
+                if (next.text === '(') {
+                    primary = this.functionCall(primary, context);
+                    context = null;
+                } else if (next.text === '[') {
+                    context = primary;
+                    primary = this.objectIndex(primary);
+                } else if (next.text === '.') {
+                    context = primary;
+                    primary = this.fieldAccess(primary);
+                } else {
+                    this.throwError('IMPOSSIBLE');
+                }
+            }
+            return primary;
+        },
+
+        throwError: function(msg, token) {
+            throw $parseMinErr('syntax',
+                'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
+                token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
+        },
+
+        peekToken: function() {
+            if (this.tokens.length === 0)
+                throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+            return this.tokens[0];
+        },
+
+        peek: function(e1, e2, e3, e4) {
+            if (this.tokens.length > 0) {
+                var token = this.tokens[0];
+                var t = token.text;
+                if (t === e1 || t === e2 || t === e3 || t === e4 ||
+                    (!e1 && !e2 && !e3 && !e4)) {
+                    return token;
+                }
+            }
+            return false;
+        },
+
+        expect: function(e1, e2, e3, e4){
+            var token = this.peek(e1, e2, e3, e4);
+            if (token) {
+                if (this.json && !token.json) {
+                    this.throwError('is not valid json', token);
+                }
+                this.tokens.shift();
+                return token;
+            }
+            return false;
+        },
+
+        consume: function(e1){
+            if (!this.expect(e1)) {
+                this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
+            }
+        },
+
+        unaryFn: function(fn, right) {
+            return extend(function(self, locals) {
+                return fn(self, locals, right);
+            }, {
+                constant:right.constant
+            });
+        },
+
+        ternaryFn: function(left, middle, right){
+            return extend(function(self, locals){
+                return left(self, locals) ? middle(self, locals) : right(self, locals);
+            }, {
+                constant: left.constant && middle.constant && right.constant
+            });
+        },
+
+        binaryFn: function(left, fn, right) {
+            return extend(function(self, locals) {
+                return fn(self, locals, left, right);
+            }, {
+                constant:left.constant && right.constant
+            });
+        },
+
+        statements: function() {
+            var statements = [];
+            while (true) {
+                if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
+                    statements.push(this.filterChain());
+                if (!this.expect(';')) {
+                    // optimize for the common case where there is only one statement.
+                    // TODO(size): maybe we should not support multiple statements?
+                    return (statements.length === 1)
+                        ? statements[0]
+                        : function(self, locals) {
+                        var value;
+                        for (var i = 0; i < statements.length; i++) {
+                            var statement = statements[i];
+                            if (statement) {
+                                value = statement(self, locals);
+                            }
+                        }
+                        return value;
+                    };
+                }
+            }
+        },
+
+        filterChain: function() {
+            var left = this.expression();
+            var token;
+            while (true) {
+                if ((token = this.expect('|'))) {
+                    left = this.binaryFn(left, token.fn, this.filter());
+                } else {
+                    return left;
+                }
+            }
+        },
+
+        filter: function() {
+            var token = this.expect();
+            var fn = this.$filter(token.text);
+            var argsFn = [];
+            while (true) {
+                if ((token = this.expect(':'))) {
+                    argsFn.push(this.expression());
+                } else {
+                    var fnInvoke = function(self, locals, input) {
+                        var args = [input];
+                        for (var i = 0; i < argsFn.length; i++) {
+                            args.push(argsFn[i](self, locals));
+                        }
+                        return fn.apply(self, args);
+                    };
+                    return function() {
+                        return fnInvoke;
+                    };
+                }
+            }
+        },
+
+        expression: function() {
+            return this.assignment();
+        },
+
+        assignment: function() {
+            var left = this.ternary();
+            var right;
+            var token;
+            if ((token = this.expect('='))) {
+                if (!left.assign) {
+                    this.throwError('implies assignment but [' +
+                    this.text.substring(0, token.index) + '] can not be assigned to', token);
+                }
+                right = this.ternary();
+                return function(scope, locals) {
+                    return left.assign(scope, right(scope, locals), locals);
+                };
+            }
+            return left;
+        },
+
+        ternary: function() {
+            var left = this.logicalOR();
+            var middle;
+            var token;
+            if ((token = this.expect('?'))) {
+                middle = this.ternary();
+                if ((token = this.expect(':'))) {
+                    return this.ternaryFn(left, middle, this.ternary());
+                } else {
+                    this.throwError('expected :', token);
+                }
+            } else {
+                return left;
+            }
+        },
+
+        logicalOR: function() {
+            var left = this.logicalAND();
+            var token;
+            while (true) {
+                if ((token = this.expect('||'))) {
+                    left = this.binaryFn(left, token.fn, this.logicalAND());
+                } else {
+                    return left;
+                }
+            }
+        },
+
+        logicalAND: function() {
+            var left = this.equality();
+            var token;
+            if ((token = this.expect('&&'))) {
+                left = this.binaryFn(left, token.fn, this.logicalAND());
+            }
+            return left;
+        },
+
+        equality: function() {
+            var left = this.relational();
+            var token;
+            if ((token = this.expect('==','!=','===','!=='))) {
+                left = this.binaryFn(left, token.fn, this.equality());
+            }
+            return left;
+        },
+
+        relational: function() {
+            var left = this.additive();
+            var token;
+            if ((token = this.expect('<', '>', '<=', '>='))) {
+                left = this.binaryFn(left, token.fn, this.relational());
+            }
+            return left;
+        },
+
+        additive: function() {
+            var left = this.multiplicative();
+            var token;
+            while ((token = this.expect('+','-'))) {
+                left = this.binaryFn(left, token.fn, this.multiplicative());
+            }
+            return left;
+        },
+
+        multiplicative: function() {
+            var left = this.unary();
+            var token;
+            while ((token = this.expect('*','/','%'))) {
+                left = this.binaryFn(left, token.fn, this.unary());
+            }
+            return left;
+        },
+
+        unary: function() {
+            var token;
+            if (this.expect('+')) {
+                return this.primary();
+            } else if ((token = this.expect('-'))) {
+                return this.binaryFn(Parser.ZERO, token.fn, this.unary());
+            } else if ((token = this.expect('!'))) {
+                return this.unaryFn(token.fn, this.unary());
+            } else {
+                return this.primary();
+            }
+        },
+
+        fieldAccess: function(object) {
+            var parser = this;
+            var field = this.expect().text;
+            var getter = getterFn(field, this.options, this.text);
+
+            return extend(function(scope, locals, self) {
+                return getter(self || object(scope, locals));
+            }, {
+                assign: function(scope, value, locals) {
+                    return setter(object(scope, locals), field, value, parser.text, parser.options);
+                }
+            });
+        },
+
+        objectIndex: function(obj) {
+            var parser = this;
+
+            var indexFn = this.expression();
+            this.consume(']');
+
+            return extend(function(self, locals) {
+                var o = obj(self, locals),
+                    i = indexFn(self, locals),
+                    v, p;
+
+                if (!o) return undefined;
+                v = ensureSafeObject(o[i], parser.text);
+                if (v && v.then && parser.options.unwrapPromises) {
+                    p = v;
+                    if (!('$$v' in v)) {
+                        p.$$v = undefined;
+                        p.then(function(val) { p.$$v = val; });
+                    }
+                    v = v.$$v;
+                }
+                return v;
+            }, {
+                assign: function(self, value, locals) {
+                    var key = indexFn(self, locals);
+                    // prevent overwriting of Function.constructor which would break ensureSafeObject check
+                    var safe = ensureSafeObject(obj(self, locals), parser.text);
+                    return safe[key] = value;
+                }
+            });
+        },
+
+        functionCall: function(fn, contextGetter) {
+            var argsFn = [];
+            if (this.peekToken().text !== ')') {
+                do {
+                    argsFn.push(this.expression());
+                } while (this.expect(','));
+            }
+            this.consume(')');
+
+            var parser = this;
+
+            return function(scope, locals) {
+                var args = [];
+                var context = contextGetter ? contextGetter(scope, locals) : scope;
+
+                for (var i = 0; i < argsFn.length; i++) {
+                    args.push(argsFn[i](scope, locals));
+                }
+                var fnPtr = fn(scope, locals, context) || noop;
+
+                ensureSafeObject(context, parser.text);
+                ensureSafeObject(fnPtr, parser.text);
+
+                // IE stupidity! (IE doesn't have apply for some native functions)
+                var v = fnPtr.apply
+                    ? fnPtr.apply(context, args)
+                    : fnPtr(args[0], args[1], args[2], args[3], args[4]);
+
+                return ensureSafeObject(v, parser.text);
+            };
+        },
+
+        // This is used with json array declaration
+        arrayDeclaration: function () {
+            var elementFns = [];
+            var allConstant = true;
+            if (this.peekToken().text !== ']') {
+                do {
+                    if (this.peek(']')) {
+                        // Support trailing commas per ES5.1.
+                        break;
+                    }
+                    var elementFn = this.expression();
+                    elementFns.push(elementFn);
+                    if (!elementFn.constant) {
+                        allConstant = false;
+                    }
+                } while (this.expect(','));
+            }
+            this.consume(']');
+
+            return extend(function(self, locals) {
+                var array = [];
+                for (var i = 0; i < elementFns.length; i++) {
+                    array.push(elementFns[i](self, locals));
+                }
+                return array;
+            }, {
+                literal: true,
+                constant: allConstant
+            });
+        },
+
+        object: function () {
+            var keyValues = [];
+            var allConstant = true;
+            if (this.peekToken().text !== '}') {
+                do {
+                    if (this.peek('}')) {
+                        // Support trailing commas per ES5.1.
+                        break;
+                    }
+                    var token = this.expect(),
+                        key = token.string || token.text;
+                    this.consume(':');
+                    var value = this.expression();
+                    keyValues.push({key: key, value: value});
+                    if (!value.constant) {
+                        allConstant = false;
+                    }
+                } while (this.expect(','));
+            }
+            this.consume('}');
+
+            return extend(function(self, locals) {
+                var object = {};
+                for (var i = 0; i < keyValues.length; i++) {
+                    var keyValue = keyValues[i];
+                    object[keyValue.key] = keyValue.value(self, locals);
+                }
+                return object;
+            }, {
+                literal: true,
+                constant: allConstant
+            });
+        }
+    };
+
+
+//////////////////////////////////////////////////
+// Parser helper functions
+//////////////////////////////////////////////////
+
+    function setter(obj, path, setValue, fullExp, options) {
+        //needed?
+        options = options || {};
+
+        var element = path.split('.'), key;
+        for (var i = 0; element.length > 1; i++) {
+            key = ensureSafeMemberName(element.shift(), fullExp);
+            var propertyObj = obj[key];
+            if (!propertyObj) {
+                propertyObj = {};
+                obj[key] = propertyObj;
+            }
+            obj = propertyObj;
+            if (obj.then && options.unwrapPromises) {
+                promiseWarning(fullExp);
+                if (!("$$v" in obj)) {
+                    (function(promise) {
+                        promise.then(function(val) { promise.$$v = val; }); }
+                    )(obj);
+                }
+                if (obj.$$v === undefined) {
+                    obj.$$v = {};
+                }
+                obj = obj.$$v;
+            }
+        }
+        key = ensureSafeMemberName(element.shift(), fullExp);
+        obj[key] = setValue;
+        return setValue;
+    }
+
+    var getterFnCache = {};
+
+    /**
+     * Implementation of the "Black Hole" variant from:
+     * - http://jsperf.com/angularjs-parse-getter/4
+     * - http://jsperf.com/path-evaluation-simplified/7
+     */
+    function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
+        ensureSafeMemberName(key0, fullExp);
+        ensureSafeMemberName(key1, fullExp);
+        ensureSafeMemberName(key2, fullExp);
+        ensureSafeMemberName(key3, fullExp);
+        ensureSafeMemberName(key4, fullExp);
+
+        return !options.unwrapPromises
+            ? function cspSafeGetter(scope, locals) {
+            var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;
+
+            if (pathVal == null) return pathVal;
+            pathVal = pathVal[key0];
+
+            if (!key1) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key1];
+
+            if (!key2) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key2];
+
+            if (!key3) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key3];
+
+            if (!key4) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key4];
+
+            return pathVal;
+        }
+            : function cspSafePromiseEnabledGetter(scope, locals) {
+            var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope,
+                promise;
+
+            if (pathVal == null) return pathVal;
+
+            pathVal = pathVal[key0];
+            if (pathVal && pathVal.then) {
+                promiseWarning(fullExp);
+                if (!("$$v" in pathVal)) {
+                    promise = pathVal;
+                    promise.$$v = undefined;
+                    promise.then(function(val) { promise.$$v = val; });
+                }
+                pathVal = pathVal.$$v;
+            }
+
+            if (!key1) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key1];
+            if (pathVal && pathVal.then) {
+                promiseWarning(fullExp);
+                if (!("$$v" in pathVal)) {
+                    promise = pathVal;
+                    promise.$$v = undefined;
+                    promise.then(function(val) { promise.$$v = val; });
+                }
+                pathVal = pathVal.$$v;
+            }
+
+            if (!key2) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key2];
+            if (pathVal && pathVal.then) {
+                promiseWarning(fullExp);
+                if (!("$$v" in pathVal)) {
+                    promise = pathVal;
+                    promise.$$v = undefined;
+                    promise.then(function(val) { promise.$$v = val; });
+                }
+                pathVal = pathVal.$$v;
+            }
+
+            if (!key3) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key3];
+            if (pathVal && pathVal.then) {
+                promiseWarning(fullExp);
+                if (!("$$v" in pathVal)) {
+                    promise = pathVal;
+                    promise.$$v = undefined;
+                    promise.then(function(val) { promise.$$v = val; });
+                }
+                pathVal = pathVal.$$v;
+            }
+
+            if (!key4) return pathVal;
+            if (pathVal == null) return undefined;
+            pathVal = pathVal[key4];
+            if (pathVal && pathVal.then) {
+                promiseWarning(fullExp);
+                if (!("$$v" in pathVal)) {
+                    promise = pathVal;
+                    promise.$$v = undefined;
+                    promise.then(function(val) { promise.$$v = val; });
+                }
+                pathVal = pathVal.$$v;
+            }
+            return pathVal;
+        };
+    }
+
+    function simpleGetterFn1(key0, fullExp) {
+        ensureSafeMemberName(key0, fullExp);
+
+        return function simpleGetterFn1(scope, locals) {
+            if (scope == null) return undefined;
+            return ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
+        };
+    }
+
+    function simpleGetterFn2(key0, key1, fullExp) {
+        ensureSafeMemberName(key0, fullExp);
+        ensureSafeMemberName(key1, fullExp);
+
+        return function simpleGetterFn2(scope, locals) {
+            if (scope == null) return undefined;
+            scope = ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
+            return scope == null ? undefined : scope[key1];
+        };
+    }
+
+    function getterFn(path, options, fullExp) {
+        // Check whether the cache has this getter already.
+        // We can use hasOwnProperty directly on the cache because we ensure,
+        // see below, that the cache never stores a path called 'hasOwnProperty'
+        if (getterFnCache.hasOwnProperty(path)) {
+            return getterFnCache[path];
+        }
+
+        var pathKeys = path.split('.'),
+            pathKeysLength = pathKeys.length,
+            fn;
+
+        // When we have only 1 or 2 tokens, use optimized special case closures.
+        // http://jsperf.com/angularjs-parse-getter/6
+        if (!options.unwrapPromises && pathKeysLength === 1) {
+            fn = simpleGetterFn1(pathKeys[0], fullExp);
+        } else if (!options.unwrapPromises && pathKeysLength === 2) {
+            fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
+        } else if (options.csp) {
+            if (pathKeysLength < 6) {
+                fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
+                    options);
+            } else {
+                fn = function(scope, locals) {
+                    var i = 0, val;
+                    do {
+                        val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],
+                            pathKeys[i++], fullExp, options)(scope, locals);
+
+                        locals = undefined; // clear after first iteration
+                        scope = val;
+                    } while (i < pathKeysLength);
+                    return val;
+                };
+            }
+        } else {
+            var code = 'var p;\n';
+            forEach(pathKeys, function(key, index) {
+                ensureSafeMemberName(key, fullExp);
+                code += 'if(s == null) return undefined;\n' +
+                's='+ (index
+                    // we simply dereference 's' on any .dot notation
+                    ? 's'
+                    // but if we are first then we check locals first, and if so read it first
+                    : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
+                (options.unwrapPromises
+                    ? 'if (s && s.then) {\n' +
+                ' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +
+                ' if (!("$$v" in s)) {\n' +
+                ' p=s;\n' +
+                ' p.$$v = undefined;\n' +
+                ' p.then(function(v) {p.$$v=v;});\n' +
+                '}\n' +
+                ' s=s.$$v\n' +
+                '}\n'
+                    : '');
+            });
+            code += 'return s;';
+
+            /* jshint -W054 */
+            var evaledFnGetter = new Function('s', 'k', 'pw', code); // s=scope, k=locals, pw=promiseWarning
+            /* jshint +W054 */
+            evaledFnGetter.toString = valueFn(code);
+            fn = options.unwrapPromises ? function(scope, locals) {
+                return evaledFnGetter(scope, locals, promiseWarning);
+            } : evaledFnGetter;
+        }
+
+        // Only cache the value if it's not going to mess up the cache object
+        // This is more performant that using Object.prototype.hasOwnProperty.call
+        if (path !== 'hasOwnProperty') {
+            getterFnCache[path] = fn;
+        }
+        return fn;
+    }
+
+///////////////////////////////////
+
+    /**
+     * @ngdoc service
+     * @name $parse
+     * @kind function
+     *
+     * @description
+     *
+     * Converts Angular {@link guide/expression expression} into a function.
+     *
+     * ```js
+     *   var getter = $parse('user.name');
+     *   var setter = getter.assign;
+     *   var context = {user:{name:'angular'}};
+     *   var locals = {user:{name:'local'}};
+     *
+     *   expect(getter(context)).toEqual('angular');
+     *   setter(context, 'newValue');
+     *   expect(context.user.name).toEqual('newValue');
+     *   expect(getter(context, locals)).toEqual('local');
+     * ```
+     *
+     *
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     *
+     *    The returned function also has the following properties:
+     *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript
+     *        literal.
+     *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript
+     *        constant literals.
+     *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be
+     *        set to a function to change its value on the given context.
+     *
+     */
+
+
+    /**
+     * @ngdoc provider
+     * @name $parseProvider
+     * @function
+     *
+     * @description
+     * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
+     *  service.
+     */
+    function $ParseProvider() {
+        var cache = {};
+
+        var $parseOptions = {
+            csp: false,
+            unwrapPromises: false,
+            logPromiseWarnings: true
+        };
+
+
+        /**
+         * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.
+         *
+         * @ngdoc method
+         * @name $parseProvider#unwrapPromises
+         * @description
+         *
+         * **This feature is deprecated, see deprecation notes below for more info**
+         *
+         * If set to true (default is false), $parse will unwrap promises automatically when a promise is
+         * found at any part of the expression. In other words, if set to true, the expression will always
+         * result in a non-promise value.
+         *
+         * While the promise is unresolved, it's treated as undefined, but once resolved and fulfilled,
+         * the fulfillment value is used in place of the promise while evaluating the expression.
+         *
+         * **Deprecation notice**
+         *
+         * This is a feature that didn't prove to be wildly useful or popular, primarily because of the
+         * dichotomy between data access in templates (accessed as raw values) and controller code
+         * (accessed as promises).
+         *
+         * In most code we ended up resolving promises manually in controllers anyway and thus unifying
+         * the model access there.
+         *
+         * Other downsides of automatic promise unwrapping:
+         *
+         * - when building components it's often desirable to receive the raw promises
+         * - adds complexity and slows down expression evaluation
+         * - makes expression code pre-generation unattractive due to the amount of code that needs to be
+         *   generated
+         * - makes IDE auto-completion and tool support hard
+         *
+         * **Warning Logs**
+         *
+         * If the unwrapping is enabled, Angular will log a warning about each expression that unwraps a
+         * promise (to reduce the noise, each expression is logged only once). To disable this logging use
+         * `$parseProvider.logPromiseWarnings(false)` api.
+         *
+         *
+         * @param {boolean=} value New value.
+         * @returns {boolean|self} Returns the current setting when used as getter and self if used as
+         *                         setter.
+         */
+        this.unwrapPromises = function(value) {
+            if (isDefined(value)) {
+                $parseOptions.unwrapPromises = !!value;
+                return this;
+            } else {
+                return $parseOptions.unwrapPromises;
+            }
+        };
+
+
+        /**
+         * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future.
+         *
+         * @ngdoc method
+         * @name $parseProvider#logPromiseWarnings
+         * @description
+         *
+         * Controls whether Angular should log a warning on any encounter of a promise in an expression.
+         *
+         * The default is set to `true`.
+         *
+         * This setting applies only if `$parseProvider.unwrapPromises` setting is set to true as well.
+         *
+         * @param {boolean=} value New value.
+         * @returns {boolean|self} Returns the current setting when used as getter and self if used as
+         *                         setter.
+         */
+        this.logPromiseWarnings = function(value) {
+            if (isDefined(value)) {
+                $parseOptions.logPromiseWarnings = value;
+                return this;
+            } else {
+                return $parseOptions.logPromiseWarnings;
+            }
+        };
+
+
+        this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) {
+            $parseOptions.csp = $sniffer.csp;
+
+            promiseWarning = function promiseWarningFn(fullExp) {
+                if (!$parseOptions.logPromiseWarnings || promiseWarningCache.hasOwnProperty(fullExp)) return;
+                promiseWarningCache[fullExp] = true;
+                $log.warn('[$parse] Promise found in the expression `' + fullExp + '`. ' +
+                'Automatic unwrapping of promises in Angular expressions is deprecated.');
+            };
+
+            return function(exp) {
+                var parsedExpression;
+
+                switch (typeof exp) {
+                    case 'string':
+
+                        if (cache.hasOwnProperty(exp)) {
+                            return cache[exp];
+                        }
+
+                        var lexer = new Lexer($parseOptions);
+                        var parser = new Parser(lexer, $filter, $parseOptions);
+                        parsedExpression = parser.parse(exp, false);
+
+                        if (exp !== 'hasOwnProperty') {
+                            // Only cache the value if it's not going to mess up the cache object
+                            // This is more performant that using Object.prototype.hasOwnProperty.call
+                            cache[exp] = parsedExpression;
+                        }
+
+                        return parsedExpression;
+
+                    case 'function':
+                        return exp;
+
+                    default:
+                        return noop;
+                }
+            };
+        }];
+    }
+
+    /**
+     * @ngdoc service
+     * @name $q
+     * @requires $rootScope
+     *
+     * @description
+     * A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
+     *
+     * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
+     * interface for interacting with an object that represents the result of an action that is
+     * performed asynchronously, and may or may not be finished at any given point in time.
+     *
+     * From the perspective of dealing with error handling, deferred and promise APIs are to
+     * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
+     *
+     * ```js
+     *   // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet`
+     *   // are available in the current lexical scope (they could have been injected or passed in).
+     *
+     *   function asyncGreet(name) {
+ *     var deferred = $q.defer();
+ *
+ *     setTimeout(function() {
+ *       // since this fn executes async in a future turn of the event loop, we need to wrap
+ *       // our code into an $apply call so that the model changes are properly observed.
+ *       scope.$apply(function() {
+ *         deferred.notify('About to greet ' + name + '.');
+ *
+ *         if (okToGreet(name)) {
+ *           deferred.resolve('Hello, ' + name + '!');
+ *         } else {
+ *           deferred.reject('Greeting ' + name + ' is not allowed.');
+ *         }
+ *       });
+ *     }, 1000);
+ *
+ *     return deferred.promise;
+ *   }
+     *
+     *   var promise = asyncGreet('Robin Hood');
+     *   promise.then(function(greeting) {
+ *     alert('Success: ' + greeting);
+ *   }, function(reason) {
+ *     alert('Failed: ' + reason);
+ *   }, function(update) {
+ *     alert('Got notification: ' + update);
+ *   });
+     * ```
+     *
+     * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
+     * comes in the way of guarantees that promise and deferred APIs make, see
+     * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
+     *
+     * Additionally the promise api allows for composition that is very hard to do with the
+     * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
+     * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
+     * section on serial or parallel joining of promises.
+     *
+     *
+     * # The Deferred API
+     *
+     * A new instance of deferred is constructed by calling `$q.defer()`.
+     *
+     * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
+     * that can be used for signaling the successful or unsuccessful completion, as well as the status
+     * of the task.
+     *
+     * **Methods**
+     *
+     * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
+     *   constructed via `$q.reject`, the promise will be rejected instead.
+     * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
+     *   resolving it with a rejection constructed via `$q.reject`.
+     * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
+     *   multiple times before the promise is either resolved or rejected.
+     *
+     * **Properties**
+     *
+     * - promise – `{Promise}` – promise object associated with this deferred.
+     *
+     *
+     * # The Promise API
+     *
+     * A new promise instance is created when a deferred instance is created and can be retrieved by
+     * calling `deferred.promise`.
+     *
+     * The purpose of the promise object is to allow for interested parties to get access to the result
+     * of the deferred task when it completes.
+     *
+     * **Methods**
+     *
+     * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or
+     *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
+     *   as soon as the result is available. The callbacks are called with a single argument: the result
+     *   or rejection reason. Additionally, the notify callback may be called zero or more times to
+     *   provide a progress indication, before the promise is resolved or rejected.
+     *
+     *   This method *returns a new promise* which is resolved or rejected via the return value of the
+     *   `successCallback`, `errorCallback`. It also notifies via the return value of the
+     *   `notifyCallback` method. The promise can not be resolved or rejected from the notifyCallback
+     *   method.
+     *
+     * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
+     *
+     * - `finally(callback)` – allows you to observe either the fulfillment or rejection of a promise,
+     *   but to do so without modifying the final value. This is useful to release resources or do some
+     *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full
+     *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
+     *   more information.
+     *
+     *   Because `finally` is a reserved word in JavaScript and reserved keywords are not supported as
+     *   property names by ES3, you'll need to invoke the method like `promise['finally'](callback)` to
+     *   make your code IE8 and Android 2.x compatible.
+     *
+     * # Chaining promises
+     *
+     * Because calling the `then` method of a promise returns a new derived promise, it is easily
+     * possible to create a chain of promises:
+     *
+     * ```js
+     *   promiseB = promiseA.then(function(result) {
+ *     return result + 1;
+ *   });
+     *
+     *   // promiseB will be resolved immediately after promiseA is resolved and its value
+     *   // will be the result of promiseA incremented by 1
+     * ```
+     *
+     * It is possible to create chains of any length and since a promise can be resolved with another
+     * promise (which will defer its resolution further), it is possible to pause/defer resolution of
+     * the promises at any point in the chain. This makes it possible to implement powerful APIs like
+     * $http's response interceptors.
+     *
+     *
+     * # Differences between Kris Kowal's Q and $q
+     *
+     *  There are two main differences:
+     *
+     * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
+     *   mechanism in angular, which means faster propagation of resolution or rejection into your
+     *   models and avoiding unnecessary browser repaints, which would result in flickering UI.
+     * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
+     *   all the important functionality needed for common async tasks.
+     *
+     *  # Testing
+     *
+     *  ```js
+     *    it('should simulate promise', inject(function($q, $rootScope) {
+ *      var deferred = $q.defer();
+ *      var promise = deferred.promise;
+ *      var resolvedValue;
+ *
+ *      promise.then(function(value) { resolvedValue = value; });
+ *      expect(resolvedValue).toBeUndefined();
+ *
+ *      // Simulate resolving of promise
+ *      deferred.resolve(123);
+ *      // Note that the 'then' function does not get called synchronously.
+ *      // This is because we want the promise API to always be async, whether or not
+ *      // it got called synchronously or asynchronously.
+ *      expect(resolvedValue).toBeUndefined();
+ *
+ *      // Propagate promise resolution to 'then' functions using $apply().
+ *      $rootScope.$apply();
+ *      expect(resolvedValue).toEqual(123);
+ *    }));
+     *  ```
+     */
+    function $QProvider() {
+
+        this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
+            return qFactory(function(callback) {
+                $rootScope.$evalAsync(callback);
+            }, $exceptionHandler);
+        }];
+    }
+
+
+    /**
+     * Constructs a promise manager.
+     *
+     * @param {function(Function)} nextTick Function for executing functions in the next turn.
+     * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
+     *     debugging purposes.
+     * @returns {object} Promise manager.
+     */
+    function qFactory(nextTick, exceptionHandler) {
+
+        /**
+         * @ngdoc method
+         * @name $q#defer
+         * @function
+         *
+         * @description
+         * Creates a `Deferred` object which represents a task which will finish in the future.
+         *
+         * @returns {Deferred} Returns a new instance of deferred.
+         */
+        var defer = function() {
+            var pending = [],
+                value, deferred;
+
+            deferred = {
+
+                resolve: function(val) {
+                    if (pending) {
+                        var callbacks = pending;
+                        pending = undefined;
+                        value = ref(val);
+
+                        if (callbacks.length) {
+                            nextTick(function() {
+                                var callback;
+                                for (var i = 0, ii = callbacks.length; i < ii; i++) {
+                                    callback = callbacks[i];
+                                    value.then(callback[0], callback[1], callback[2]);
+                                }
+                            });
+                        }
+                    }
+                },
+
+
+                reject: function(reason) {
+                    deferred.resolve(createInternalRejectedPromise(reason));
+                },
+
+
+                notify: function(progress) {
+                    if (pending) {
+                        var callbacks = pending;
+
+                        if (pending.length) {
+                            nextTick(function() {
+                                var callback;
+                                for (var i = 0, ii = callbacks.length; i < ii; i++) {
+                                    callback = callbacks[i];
+                                    callback[2](progress);
+                                }
+                            });
+                        }
+                    }
+                },
+
+
+                promise: {
+                    then: function(callback, errback, progressback) {
+                        var result = defer();
+
+                        var wrappedCallback = function(value) {
+                            try {
+                                result.resolve((isFunction(callback) ? callback : defaultCallback)(value));
+                            } catch(e) {
+                                result.reject(e);
+                                exceptionHandler(e);
+                            }
+                        };
+
+                        var wrappedErrback = function(reason) {
+                            try {
+                                result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
+                            } catch(e) {
+                                result.reject(e);
+                                exceptionHandler(e);
+                            }
+                        };
+
+                        var wrappedProgressback = function(progress) {
+                            try {
+                                result.notify((isFunction(progressback) ? progressback : defaultCallback)(progress));
+                            } catch(e) {
+                                exceptionHandler(e);
+                            }
+                        };
+
+                        if (pending) {
+                            pending.push([wrappedCallback, wrappedErrback, wrappedProgressback]);
+                        } else {
+                            value.then(wrappedCallback, wrappedErrback, wrappedProgressback);
+                        }
+
+                        return result.promise;
+                    },
+
+                    "catch": function(callback) {
+                        return this.then(null, callback);
+                    },
+
+                    "finally": function(callback) {
+
+                        function makePromise(value, resolved) {
+                            var result = defer();
+                            if (resolved) {
+                                result.resolve(value);
+                            } else {
+                                result.reject(value);
+                            }
+                            return result.promise;
+                        }
+
+                        function handleCallback(value, isResolved) {
+                            var callbackOutput = null;
+                            try {
+                                callbackOutput = (callback ||defaultCallback)();
+                            } catch(e) {
+                                return makePromise(e, false);
+                            }
+                            if (callbackOutput && isFunction(callbackOutput.then)) {
+                                return callbackOutput.then(function() {
+                                    return makePromise(value, isResolved);
+                                }, function(error) {
+                                    return makePromise(error, false);
+                                });
+                            } else {
+                                return makePromise(value, isResolved);
+                            }
+                        }
+
+                        return this.then(function(value) {
+                            return handleCallback(value, true);
+                        }, function(error) {
+                            return handleCallback(error, false);
+                        });
+                    }
+                }
+            };
+
+            return deferred;
+        };
+
+
+        var ref = function(value) {
+            if (value && isFunction(value.then)) return value;
+            return {
+                then: function(callback) {
+                    var result = defer();
+                    nextTick(function() {
+                        result.resolve(callback(value));
+                    });
+                    return result.promise;
+                }
+            };
+        };
+
+
+        /**
+         * @ngdoc method
+         * @name $q#reject
+         * @function
+         *
+         * @description
+         * Creates a promise that is resolved as rejected with the specified `reason`. This api should be
+         * used to forward rejection in a chain of promises. If you are dealing with the last promise in
+         * a promise chain, you don't need to worry about it.
+         *
+         * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
+         * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
+         * a promise error callback and you want to forward the error to the promise derived from the
+         * current promise, you have to "rethrow" the error by returning a rejection constructed via
+         * `reject`.
+         *
+         * ```js
+         *   promiseB = promiseA.then(function(result) {
+   *     // success: do something and resolve promiseB
+   *     //          with the old or a new result
+   *     return result;
+   *   }, function(reason) {
+   *     // error: handle the error if possible and
+   *     //        resolve promiseB with newPromiseOrValue,
+   *     //        otherwise forward the rejection to promiseB
+   *     if (canHandle(reason)) {
+   *      // handle the error and recover
+   *      return newPromiseOrValue;
+   *     }
+   *     return $q.reject(reason);
+   *   });
+         * ```
+         *
+         * @param {*} reason Constant, message, exception or an object representing the rejection reason.
+         * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
+         */
+        var reject = function(reason) {
+            var result = defer();
+            result.reject(reason);
+            return result.promise;
+        };
+
+        var createInternalRejectedPromise = function(reason) {
+            return {
+                then: function(callback, errback) {
+                    var result = defer();
+                    nextTick(function() {
+                        try {
+                            result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
+                        } catch(e) {
+                            result.reject(e);
+                            exceptionHandler(e);
+                        }
+                    });
+                    return result.promise;
+                }
+            };
+        };
+
+
+        /**
+         * @ngdoc method
+         * @name $q#when
+         * @function
+         *
+         * @description
+         * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
+         * This is useful when you are dealing with an object that might or might not be a promise, or if
+         * the promise comes from a source that can't be trusted.
+         *
+         * @param {*} value Value or a promise
+         * @returns {Promise} Returns a promise of the passed value or promise
+         */
+        var when = function(value, callback, errback, progressback) {
+            var result = defer(),
+                done;
+
+            var wrappedCallback = function(value) {
+                try {
+                    return (isFunction(callback) ? callback : defaultCallback)(value);
+                } catch (e) {
+                    exceptionHandler(e);
+                    return reject(e);
+                }
+            };
+
+            var wrappedErrback = function(reason) {
+                try {
+                    return (isFunction(errback) ? errback : defaultErrback)(reason);
+                } catch (e) {
+                    exceptionHandler(e);
+                    return reject(e);
+                }
+            };
+
+            var wrappedProgressback = function(progress) {
+                try {
+                    return (isFunction(progressback) ? progressback : defaultCallback)(progress);
+                } catch (e) {
+                    exceptionHandler(e);
+                }
+            };
+
+            nextTick(function() {
+                ref(value).then(function(value) {
+                    if (done) return;
+                    done = true;
+                    result.resolve(ref(value).then(wrappedCallback, wrappedErrback, wrappedProgressback));
+                }, function(reason) {
+                    if (done) return;
+                    done = true;
+                    result.resolve(wrappedErrback(reason));
+                }, function(progress) {
+                    if (done) return;
+                    result.notify(wrappedProgressback(progress));
+                });
+            });
+
+            return result.promise;
+        };
+
+
+        function defaultCallback(value) {
+            return value;
+        }
+
+
+        function defaultErrback(reason) {
+            return reject(reason);
+        }
+
+
+        /**
+         * @ngdoc method
+         * @name $q#all
+         * @function
+         *
+         * @description
+         * Combines multiple promises into a single promise that is resolved when all of the input
+         * promises are resolved.
+         *
+         * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+         * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,
+         *   each value corresponding to the promise at the same index/key in the `promises` array/hash.
+         *   If any of the promises is resolved with a rejection, this resulting promise will be rejected
+         *   with the same rejection value.
+         */
+        function all(promises) {
+            var deferred = defer(),
+                counter = 0,
+                results = isArray(promises) ? [] : {};
+
+            forEach(promises, function(promise, key) {
+                counter++;
+                ref(promise).then(function(value) {
+                    if (results.hasOwnProperty(key)) return;
+                    results[key] = value;
+                    if (!(--counter)) deferred.resolve(results);
+                }, function(reason) {
+                    if (results.hasOwnProperty(key)) return;
+                    deferred.reject(reason);
+                });
+            });
+
+            if (counter === 0) {
+                deferred.resolve(results);
+            }
+
+            return deferred.promise;
+        }
+
+        return {
+            defer: defer,
+            reject: reject,
+            when: when,
+            all: all
+        };
+    }
+
+    function $$RAFProvider(){ //rAF
+        this.$get = ['$window', '$timeout', function($window, $timeout) {
+            var requestAnimationFrame = $window.requestAnimationFrame ||
+                $window.webkitRequestAnimationFrame ||
+                $window.mozRequestAnimationFrame;
+
+            var cancelAnimationFrame = $window.cancelAnimationFrame ||
+                $window.webkitCancelAnimationFrame ||
+                $window.mozCancelAnimationFrame ||
+                $window.webkitCancelRequestAnimationFrame;
+
+            var rafSupported = !!requestAnimationFrame;
+            var raf = rafSupported
+                ? function(fn) {
+                var id = requestAnimationFrame(fn);
+                return function() {
+                    cancelAnimationFrame(id);
+                };
+            }
+                : function(fn) {
+                var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
+                return function() {
+                    $timeout.cancel(timer);
+                };
+            };
+
+            raf.supported = rafSupported;
+
+            return raf;
+        }];
+    }
+
+    /**
+     * DESIGN NOTES
+     *
+     * The design decisions behind the scope are heavily favored for speed and memory consumption.
+     *
+     * The typical use of scope is to watch the expressions, which most of the time return the same
+     * value as last time so we optimize the operation.
+     *
+     * Closures construction is expensive in terms of speed as well as memory:
+     *   - No closures, instead use prototypical inheritance for API
+     *   - Internal state needs to be stored on scope directly, which means that private state is
+     *     exposed as $$____ properties
+     *
+     * Loop operations are optimized by using while(count--) { ... }
+     *   - this means that in order to keep the same order of execution as addition we have to add
+     *     items to the array at the beginning (shift) instead of at the end (push)
+     *
+     * Child scopes are created and removed often
+     *   - Using an array would be slow since inserts in middle are expensive so we use linked list
+     *
+     * There are few watches then a lot of observers. This is why you don't want the observer to be
+     * implemented in the same way as watch. Watch requires return of initialization function which
+     * are expensive to construct.
+     */
+
+
+    /**
+     * @ngdoc provider
+     * @name $rootScopeProvider
+     * @description
+     *
+     * Provider for the $rootScope service.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $rootScopeProvider#digestTtl
+     * @description
+     *
+     * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
+     * assuming that the model is unstable.
+     *
+     * The current default is 10 iterations.
+     *
+     * In complex applications it's possible that the dependencies between `$watch`s will result in
+     * several digest iterations. However if an application needs more than the default 10 digest
+     * iterations for its model to stabilize then you should investigate what is causing the model to
+     * continuously change during the digest.
+     *
+     * Increasing the TTL could have performance implications, so you should not change it without
+     * proper justification.
+     *
+     * @param {number} limit The number of digest iterations.
+     */
+
+
+    /**
+     * @ngdoc service
+     * @name $rootScope
+     * @description
+     *
+     * Every application has a single root {@link ng.$rootScope.Scope scope}.
+     * All other scopes are descendant scopes of the root scope. Scopes provide separation
+     * between the model and the view, via a mechanism for watching the model for changes.
+     * They also provide an event emission/broadcast and subscription facility. See the
+     * {@link guide/scope developer guide on scopes}.
+     */
+    function $RootScopeProvider(){
+        var TTL = 10;
+        var $rootScopeMinErr = minErr('$rootScope');
+        var lastDirtyWatch = null;
+
+        this.digestTtl = function(value) {
+            if (arguments.length) {
+                TTL = value;
+            }
+            return TTL;
+        };
+
+        this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
+            function( $injector,   $exceptionHandler,   $parse,   $browser) {
+
+                /**
+                 * @ngdoc type
+                 * @name $rootScope.Scope
+                 *
+                 * @description
+                 * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
+                 * {@link auto.$injector $injector}. Child scopes are created using the
+                 * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
+                 * compiled HTML template is executed.)
+                 *
+                 * Here is a simple scope snippet to show how you can interact with the scope.
+                 * ```html
+                 * <file src="./test/ng/rootScopeSpec.js" tag="docs1" />
+                 * ```
+                 *
+                 * # Inheritance
+                 * A scope can inherit from a parent scope, as in this example:
+                 * ```js
+                 var parent = $rootScope;
+                 var child = parent.$new();
+
+                 parent.salutation = "Hello";
+                 child.name = "World";
+                 expect(child.salutation).toEqual('Hello');
+
+                 child.salutation = "Welcome";
+                 expect(child.salutation).toEqual('Welcome');
+                 expect(parent.salutation).toEqual('Hello');
+                 * ```
+                 *
+                 *
+                 * @param {Object.<string, function()>=} providers Map of service factory which need to be
+                 *                                       provided for the current scope. Defaults to {@link ng}.
+                 * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
+                 *                              append/override services provided by `providers`. This is handy
+                 *                              when unit-testing and having the need to override a default
+                 *                              service.
+                 * @returns {Object} Newly created scope.
+                 *
+                 */
+                function Scope() {
+                    this.$id = nextUid();
+                    this.$$phase = this.$parent = this.$$watchers =
+                        this.$$nextSibling = this.$$prevSibling =
+                            this.$$childHead = this.$$childTail = null;
+                    this['this'] = this.$root =  this;
+                    this.$$destroyed = false;
+                    this.$$asyncQueue = [];
+                    this.$$postDigestQueue = [];
+                    this.$$listeners = {};
+                    this.$$listenerCount = {};
+                    this.$$isolateBindings = {};
+                }
+
+                /**
+                 * @ngdoc property
+                 * @name $rootScope.Scope#$id
+                 * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for
+                 *   debugging.
+                 */
+
+
+                Scope.prototype = {
+                    constructor: Scope,
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$new
+                     * @function
+                     *
+                     * @description
+                     * Creates a new child {@link ng.$rootScope.Scope scope}.
+                     *
+                     * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and
+                     * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the
+                     * scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
+                     *
+                     * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
+                     * desired for the scope and its child scopes to be permanently detached from the parent and
+                     * thus stop participating in model change detection and listener notification by invoking.
+                     *
+                     * @param {boolean} isolate If true, then the scope does not prototypically inherit from the
+                     *         parent scope. The scope is isolated, as it can not see parent scope properties.
+                     *         When creating widgets, it is useful for the widget to not accidentally read parent
+                     *         state.
+                     *
+                     * @returns {Object} The newly created child scope.
+                     *
+                     */
+                    $new: function(isolate) {
+                        var ChildScope,
+                            child;
+
+                        if (isolate) {
+                            child = new Scope();
+                            child.$root = this.$root;
+                            // ensure that there is just one async queue per $rootScope and its children
+                            child.$$asyncQueue = this.$$asyncQueue;
+                            child.$$postDigestQueue = this.$$postDigestQueue;
+                        } else {
+                            ChildScope = function() {}; // should be anonymous; This is so that when the minifier munges
+                            // the name it does not become random set of chars. This will then show up as class
+                            // name in the web inspector.
+                            ChildScope.prototype = this;
+                            child = new ChildScope();
+                            child.$id = nextUid();
+                        }
+                        child['this'] = child;
+                        child.$$listeners = {};
+                        child.$$listenerCount = {};
+                        child.$parent = this;
+                        child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
+                        child.$$prevSibling = this.$$childTail;
+                        if (this.$$childHead) {
+                            this.$$childTail.$$nextSibling = child;
+                            this.$$childTail = child;
+                        } else {
+                            this.$$childHead = this.$$childTail = child;
+                        }
+                        return child;
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$watch
+                     * @function
+                     *
+                     * @description
+                     * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+                     *
+                     * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
+       *   $digest()} and should return the value that will be watched. (Since
+                     *   {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the
+                     *   `watchExpression` can execute multiple times per
+                     *   {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
+                     * - The `listener` is called only when the value from the current `watchExpression` and the
+                     *   previous call to `watchExpression` are not equal (with the exception of the initial run,
+                     *   see below). The inequality is determined according to
+                     *   {@link angular.equals} function. To save the value of the object for later comparison,
+                     *   the {@link angular.copy} function is used. It also means that watching complex options
+                     *   will have adverse memory and performance implications.
+                     * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
+                     *   This is achieved by rerunning the watchers until no changes are detected. The rerun
+                     *   iteration limit is 10 to prevent an infinite loop deadlock.
+                     *
+                     *
+                     * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
+                     * you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
+                     * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a
+                     * change is detected, be prepared for multiple calls to your listener.)
+                     *
+                     * After a watcher is registered with the scope, the `listener` fn is called asynchronously
+                     * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
+                     * watcher. In rare cases, this is undesirable because the listener is called when the result
+                     * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
+                     * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
+                     * listener was called due to initialization.
+                     *
+                     * The example below contains an illustration of using a function as your $watch listener
+                     *
+                     *
+                     * # Example
+                     * ```js
+                     // let's assume that scope was dependency injected as the $rootScope
+                     var scope = $rootScope;
+                     scope.name = 'misko';
+                     scope.counter = 0;
+
+                     expect(scope.counter).toEqual(0);
+                     scope.$watch('name', function(newValue, oldValue) {
+             scope.counter = scope.counter + 1;
+           });
+                     expect(scope.counter).toEqual(0);
+
+                     scope.$digest();
+                     // no variable change
+                     expect(scope.counter).toEqual(0);
+
+                     scope.name = 'adam';
+                     scope.$digest();
+                     expect(scope.counter).toEqual(1);
+
+
+
+                     // Using a listener function
+                     var food;
+                     scope.foodCounter = 0;
+                     expect(scope.foodCounter).toEqual(0);
+                     scope.$watch(
+                     // This is the listener function
+                     function() { return food; },
+                     // This is the change handler
+                     function(newValue, oldValue) {
+               if ( newValue !== oldValue ) {
+                 // Only increment the counter if the value changed
+                 scope.foodCounter = scope.foodCounter + 1;
+               }
+             }
+                     );
+                     // No digest has been run so the counter will be zero
+                     expect(scope.foodCounter).toEqual(0);
+
+                     // Run the digest but since food has not changed count will still be zero
+                     scope.$digest();
+                     expect(scope.foodCounter).toEqual(0);
+
+                     // Update food and run digest.  Now the counter will increment
+                     food = 'cheeseburger';
+                     scope.$digest();
+                     expect(scope.foodCounter).toEqual(1);
+
+                     * ```
+                     *
+                     *
+                     *
+                     * @param {(function()|string)} watchExpression Expression that is evaluated on each
+                     *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
+                     *    a call to the `listener`.
+                     *
+                     *    - `string`: Evaluated as {@link guide/expression expression}
+                     *    - `function(scope)`: called with current `scope` as a parameter.
+                     * @param {(function()|string)=} listener Callback called whenever the return value of
+                     *   the `watchExpression` changes.
+                     *
+                     *    - `string`: Evaluated as {@link guide/expression expression}
+                     *    - `function(newValue, oldValue, scope)`: called with current and previous values as
+                     *      parameters.
+                     *
+                     * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of
+                     *     comparing for reference equality.
+                     * @returns {function()} Returns a deregistration function for this listener.
+                     */
+                    $watch: function(watchExp, listener, objectEquality) {
+                        var scope = this,
+                            get = compileToFn(watchExp, 'watch'),
+                            array = scope.$$watchers,
+                            watcher = {
+                                fn: listener,
+                                last: initWatchVal,
+                                get: get,
+                                exp: watchExp,
+                                eq: !!objectEquality
+                            };
+
+                        lastDirtyWatch = null;
+
+                        // in the case user pass string, we need to compile it, do we really need this ?
+                        if (!isFunction(listener)) {
+                            var listenFn = compileToFn(listener || noop, 'listener');
+                            watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};
+                        }
+
+                        if (typeof watchExp == 'string' && get.constant) {
+                            var originalFn = watcher.fn;
+                            watcher.fn = function(newVal, oldVal, scope) {
+                                originalFn.call(this, newVal, oldVal, scope);
+                                arrayRemove(array, watcher);
+                            };
+                        }
+
+                        if (!array) {
+                            array = scope.$$watchers = [];
+                        }
+                        // we use unshift since we use a while loop in $digest for speed.
+                        // the while loop reads in reverse order.
+                        array.unshift(watcher);
+
+                        return function() {
+                            arrayRemove(array, watcher);
+                            lastDirtyWatch = null;
+                        };
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$watchCollection
+                     * @function
+                     *
+                     * @description
+                     * Shallow watches the properties of an object and fires whenever any of the properties change
+                     * (for arrays, this implies watching the array items; for object maps, this implies watching
+                     * the properties). If a change is detected, the `listener` callback is fired.
+                     *
+                     * - The `obj` collection is observed via standard $watch operation and is examined on every
+                     *   call to $digest() to see if any items have been added, removed, or moved.
+                     * - The `listener` is called whenever anything within the `obj` has changed. Examples include
+                     *   adding, removing, and moving items belonging to an object or array.
+                     *
+                     *
+                     * # Example
+                     * ```js
+                     $scope.names = ['igor', 'matias', 'misko', 'james'];
+                     $scope.dataCount = 4;
+
+                     $scope.$watchCollection('names', function(newNames, oldNames) {
+            $scope.dataCount = newNames.length;
+          });
+
+                     expect($scope.dataCount).toEqual(4);
+                     $scope.$digest();
+
+                     //still at 4 ... no changes
+                     expect($scope.dataCount).toEqual(4);
+
+                     $scope.names.pop();
+                     $scope.$digest();
+
+                     //now there's been a change
+                     expect($scope.dataCount).toEqual(3);
+                     * ```
+                     *
+                     *
+                     * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
+                     *    expression value should evaluate to an object or an array which is observed on each
+                     *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
+                     *    collection will trigger a call to the `listener`.
+                     *
+                     * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+                     *    when a change is detected.
+                     *    - The `newCollection` object is the newly modified data obtained from the `obj` expression
+                     *    - The `oldCollection` object is a copy of the former collection data.
+                     *      Due to performance considerations, the`oldCollection` value is computed only if the
+                     *      `listener` function declares two or more arguments.
+                     *    - The `scope` argument refers to the current scope.
+                     *
+                     * @returns {function()} Returns a de-registration function for this listener. When the
+                     *    de-registration function is executed, the internal watch operation is terminated.
+                     */
+                    $watchCollection: function(obj, listener) {
+                        var self = this;
+                        // the current value, updated on each dirty-check run
+                        var newValue;
+                        // a shallow copy of the newValue from the last dirty-check run,
+                        // updated to match newValue during dirty-check run
+                        var oldValue;
+                        // a shallow copy of the newValue from when the last change happened
+                        var veryOldValue;
+                        // only track veryOldValue if the listener is asking for it
+                        var trackVeryOldValue = (listener.length > 1);
+                        var changeDetected = 0;
+                        var objGetter = $parse(obj);
+                        var internalArray = [];
+                        var internalObject = {};
+                        var initRun = true;
+                        var oldLength = 0;
+
+                        function $watchCollectionWatch() {
+                            newValue = objGetter(self);
+                            var newLength, key;
+
+                            if (!isObject(newValue)) { // if primitive
+                                if (oldValue !== newValue) {
+                                    oldValue = newValue;
+                                    changeDetected++;
+                                }
+                            } else if (isArrayLike(newValue)) {
+                                if (oldValue !== internalArray) {
+                                    // we are transitioning from something which was not an array into array.
+                                    oldValue = internalArray;
+                                    oldLength = oldValue.length = 0;
+                                    changeDetected++;
+                                }
+
+                                newLength = newValue.length;
+
+                                if (oldLength !== newLength) {
+                                    // if lengths do not match we need to trigger change notification
+                                    changeDetected++;
+                                    oldValue.length = oldLength = newLength;
+                                }
+                                // copy the items to oldValue and look for changes.
+                                for (var i = 0; i < newLength; i++) {
+                                    var bothNaN = (oldValue[i] !== oldValue[i]) &&
+                                        (newValue[i] !== newValue[i]);
+                                    if (!bothNaN && (oldValue[i] !== newValue[i])) {
+                                        changeDetected++;
+                                        oldValue[i] = newValue[i];
+                                    }
+                                }
+                            } else {
+                                if (oldValue !== internalObject) {
+                                    // we are transitioning from something which was not an object into object.
+                                    oldValue = internalObject = {};
+                                    oldLength = 0;
+                                    changeDetected++;
+                                }
+                                // copy the items to oldValue and look for changes.
+                                newLength = 0;
+                                for (key in newValue) {
+                                    if (newValue.hasOwnProperty(key)) {
+                                        newLength++;
+                                        if (oldValue.hasOwnProperty(key)) {
+                                            if (oldValue[key] !== newValue[key]) {
+                                                changeDetected++;
+                                                oldValue[key] = newValue[key];
+                                            }
+                                        } else {
+                                            oldLength++;
+                                            oldValue[key] = newValue[key];
+                                            changeDetected++;
+                                        }
+                                    }
+                                }
+                                if (oldLength > newLength) {
+                                    // we used to have more keys, need to find them and destroy them.
+                                    changeDetected++;
+                                    for(key in oldValue) {
+                                        if (oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key)) {
+                                            oldLength--;
+                                            delete oldValue[key];
+                                        }
+                                    }
+                                }
+                            }
+                            return changeDetected;
+                        }
+
+                        function $watchCollectionAction() {
+                            if (initRun) {
+                                initRun = false;
+                                listener(newValue, newValue, self);
+                            } else {
+                                listener(newValue, veryOldValue, self);
+                            }
+
+                            // make a copy for the next time a collection is changed
+                            if (trackVeryOldValue) {
+                                if (!isObject(newValue)) {
+                                    //primitive
+                                    veryOldValue = newValue;
+                                } else if (isArrayLike(newValue)) {
+                                    veryOldValue = new Array(newValue.length);
+                                    for (var i = 0; i < newValue.length; i++) {
+                                        veryOldValue[i] = newValue[i];
+                                    }
+                                } else { // if object
+                                    veryOldValue = {};
+                                    for (var key in newValue) {
+                                        if (hasOwnProperty.call(newValue, key)) {
+                                            veryOldValue[key] = newValue[key];
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        return this.$watch($watchCollectionWatch, $watchCollectionAction);
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$digest
+                     * @function
+                     *
+                     * @description
+                     * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+                     * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+                     * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
+                     * until no more listeners are firing. This means that it is possible to get into an infinite
+                     * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
+                     * iterations exceeds 10.
+                     *
+                     * Usually, you don't call `$digest()` directly in
+                     * {@link ng.directive:ngController controllers} or in
+                     * {@link ng.$compileProvider#directive directives}.
+                     * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+                     * a {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.
+                     *
+                     * If you want to be notified whenever `$digest()` is called,
+                     * you can register a `watchExpression` function with
+                     * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
+                     *
+                     * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
+                     *
+                     * # Example
+                     * ```js
+                     var scope = ...;
+                     scope.name = 'misko';
+                     scope.counter = 0;
+
+                     expect(scope.counter).toEqual(0);
+                     scope.$watch('name', function(newValue, oldValue) {
+             scope.counter = scope.counter + 1;
+           });
+                     expect(scope.counter).toEqual(0);
+
+                     scope.$digest();
+                     // no variable change
+                     expect(scope.counter).toEqual(0);
+
+                     scope.name = 'adam';
+                     scope.$digest();
+                     expect(scope.counter).toEqual(1);
+                     * ```
+                     *
+                     */
+                    $digest: function() {
+                        var watch, value, last,
+                            watchers,
+                            asyncQueue = this.$$asyncQueue,
+                            postDigestQueue = this.$$postDigestQueue,
+                            length,
+                            dirty, ttl = TTL,
+                            next, current, target = this,
+                            watchLog = [],
+                            logIdx, logMsg, asyncTask;
+
+                        beginPhase('$digest');
+
+                        lastDirtyWatch = null;
+
+                        do { // "while dirty" loop
+                            dirty = false;
+                            current = target;
+
+                            while(asyncQueue.length) {
+                                try {
+                                    asyncTask = asyncQueue.shift();
+                                    asyncTask.scope.$eval(asyncTask.expression);
+                                } catch (e) {
+                                    clearPhase();
+                                    $exceptionHandler(e);
+                                }
+                                lastDirtyWatch = null;
+                            }
+
+                            traverseScopesLoop:
+                                do { // "traverse the scopes" loop
+                                    if ((watchers = current.$$watchers)) {
+                                        // process our watches
+                                        length = watchers.length;
+                                        while (length--) {
+                                            try {
+                                                watch = watchers[length];
+                                                // Most common watches are on primitives, in which case we can short
+                                                // circuit it with === operator, only when === fails do we use .equals
+                                                if (watch) {
+                                                    if ((value = watch.get(current)) !== (last = watch.last) &&
+                                                        !(watch.eq
+                                                            ? equals(value, last)
+                                                            : (typeof value == 'number' && typeof last == 'number'
+                                                        && isNaN(value) && isNaN(last)))) {
+                                                        dirty = true;
+                                                        lastDirtyWatch = watch;
+                                                        watch.last = watch.eq ? copy(value) : value;
+                                                        watch.fn(value, ((last === initWatchVal) ? value : last), current);
+                                                        if (ttl < 5) {
+                                                            logIdx = 4 - ttl;
+                                                            if (!watchLog[logIdx]) watchLog[logIdx] = [];
+                                                            logMsg = (isFunction(watch.exp))
+                                                                ? 'fn: ' + (watch.exp.name || watch.exp.toString())
+                                                                : watch.exp;
+                                                            logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
+                                                            watchLog[logIdx].push(logMsg);
+                                                        }
+                                                    } else if (watch === lastDirtyWatch) {
+                                                        // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
+                                                        // have already been tested.
+                                                        dirty = false;
+                                                        break traverseScopesLoop;
+                                                    }
+                                                }
+                                            } catch (e) {
+                                                clearPhase();
+                                                $exceptionHandler(e);
+                                            }
+                                        }
+                                    }
+
+                                    // Insanity Warning: scope depth-first traversal
+                                    // yes, this code is a bit crazy, but it works and we have tests to prove it!
+                                    // this piece should be kept in sync with the traversal in $broadcast
+                                    if (!(next = (current.$$childHead ||
+                                        (current !== target && current.$$nextSibling)))) {
+                                        while(current !== target && !(next = current.$$nextSibling)) {
+                                            current = current.$parent;
+                                        }
+                                    }
+                                } while ((current = next));
+
+                            // `break traverseScopesLoop;` takes us to here
+
+                            if((dirty || asyncQueue.length) && !(ttl--)) {
+                                clearPhase();
+                                throw $rootScopeMinErr('infdig',
+                                    '{0} $digest() iterations reached. Aborting!\n' +
+                                    'Watchers fired in the last 5 iterations: {1}',
+                                    TTL, toJson(watchLog));
+                            }
+
+                        } while (dirty || asyncQueue.length);
+
+                        clearPhase();
+
+                        while(postDigestQueue.length) {
+                            try {
+                                postDigestQueue.shift()();
+                            } catch (e) {
+                                $exceptionHandler(e);
+                            }
+                        }
+                    },
+
+
+                    /**
+                     * @ngdoc event
+                     * @name $rootScope.Scope#$destroy
+                     * @eventType broadcast on scope being destroyed
+                     *
+                     * @description
+                     * Broadcasted when a scope and its children are being destroyed.
+                     *
+                     * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+                     * clean up DOM bindings before an element is removed from the DOM.
+                     */
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$destroy
+                     * @function
+                     *
+                     * @description
+                     * Removes the current scope (and all of its children) from the parent scope. Removal implies
+                     * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
+                     * propagate to the current scope and its children. Removal also implies that the current
+                     * scope is eligible for garbage collection.
+                     *
+                     * The `$destroy()` is usually used by directives such as
+                     * {@link ng.directive:ngRepeat ngRepeat} for managing the
+                     * unrolling of the loop.
+                     *
+                     * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
+                     * Application code can register a `$destroy` event handler that will give it a chance to
+                     * perform any necessary cleanup.
+                     *
+                     * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+                     * clean up DOM bindings before an element is removed from the DOM.
+                     */
+                    $destroy: function() {
+                        // we can't destroy the root scope or a scope that has been already destroyed
+                        if (this.$$destroyed) return;
+                        var parent = this.$parent;
+
+                        this.$broadcast('$destroy');
+                        this.$$destroyed = true;
+                        if (this === $rootScope) return;
+
+                        forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));
+
+                        // sever all the references to parent scopes (after this cleanup, the current scope should
+                        // not be retained by any of our references and should be eligible for garbage collection)
+                        if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+                        if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+                        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
+                        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
+
+
+                        // All of the code below is bogus code that works around V8's memory leak via optimized code
+                        // and inline caches.
+                        //
+                        // see:
+                        // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+                        // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+                        // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+                        this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
+                            this.$$childTail = this.$root = null;
+
+                        // don't reset these to null in case some async task tries to register a listener/watch/task
+                        this.$$listeners = {};
+                        this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = [];
+
+                        // prevent NPEs since these methods have references to properties we nulled out
+                        this.$destroy = this.$digest = this.$apply = noop;
+                        this.$on = this.$watch = function() { return noop; };
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$eval
+                     * @function
+                     *
+                     * @description
+                     * Executes the `expression` on the current scope and returns the result. Any exceptions in
+                     * the expression are propagated (uncaught). This is useful when evaluating Angular
+                     * expressions.
+                     *
+                     * # Example
+                     * ```js
+                     var scope = ng.$rootScope.Scope();
+                     scope.a = 1;
+                     scope.b = 2;
+
+                     expect(scope.$eval('a+b')).toEqual(3);
+                     expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+                     * ```
+                     *
+                     * @param {(string|function())=} expression An angular expression to be executed.
+                     *
+                     *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.
+                     *    - `function(scope)`: execute the function with the current `scope` parameter.
+                     *
+                     * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+                     * @returns {*} The result of evaluating the expression.
+                     */
+                    $eval: function(expr, locals) {
+                        return $parse(expr)(this, locals);
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$evalAsync
+                     * @function
+                     *
+                     * @description
+                     * Executes the expression on the current scope at a later point in time.
+                     *
+                     * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only
+                     * that:
+                     *
+                     *   - it will execute after the function that scheduled the evaluation (preferably before DOM
+                     *     rendering).
+                     *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
+                     *     `expression` execution.
+                     *
+                     * Any exceptions from the execution of the expression are forwarded to the
+                     * {@link ng.$exceptionHandler $exceptionHandler} service.
+                     *
+                     * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle
+                     * will be scheduled. However, it is encouraged to always call code that changes the model
+                     * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
+                     *
+                     * @param {(string|function())=} expression An angular expression to be executed.
+                     *
+                     *    - `string`: execute using the rules as defined in {@link guide/expression expression}.
+                     *    - `function(scope)`: execute the function with the current `scope` parameter.
+                     *
+                     */
+                    $evalAsync: function(expr) {
+                        // if we are outside of an $digest loop and this is the first time we are scheduling async
+                        // task also schedule async auto-flush
+                        if (!$rootScope.$$phase && !$rootScope.$$asyncQueue.length) {
+                            $browser.defer(function() {
+                                if ($rootScope.$$asyncQueue.length) {
+                                    $rootScope.$digest();
+                                }
+                            });
+                        }
+
+                        this.$$asyncQueue.push({scope: this, expression: expr});
+                    },
+
+                    $$postDigest : function(fn) {
+                        this.$$postDigestQueue.push(fn);
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$apply
+                     * @function
+                     *
+                     * @description
+                     * `$apply()` is used to execute an expression in angular from outside of the angular
+                     * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
+                     * Because we are calling into the angular framework we need to perform proper scope life
+                     * cycle of {@link ng.$exceptionHandler exception handling},
+                     * {@link ng.$rootScope.Scope#$digest executing watches}.
+                     *
+                     * ## Life cycle
+                     *
+                     * # Pseudo-Code of `$apply()`
+                     * ```js
+                     function $apply(expr) {
+             try {
+               return $eval(expr);
+             } catch (e) {
+               $exceptionHandler(e);
+             } finally {
+               $root.$digest();
+             }
+           }
+                     * ```
+                     *
+                     *
+                     * Scope's `$apply()` method transitions through the following stages:
+                     *
+                     * 1. The {@link guide/expression expression} is executed using the
+                     *    {@link ng.$rootScope.Scope#$eval $eval()} method.
+                     * 2. Any exceptions from the execution of the expression are forwarded to the
+                     *    {@link ng.$exceptionHandler $exceptionHandler} service.
+                     * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+                     *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
+                     *
+                     *
+                     * @param {(string|function())=} exp An angular expression to be executed.
+                     *
+                     *    - `string`: execute using the rules as defined in {@link guide/expression expression}.
+                     *    - `function(scope)`: execute the function with current `scope` parameter.
+                     *
+                     * @returns {*} The result of evaluating the expression.
+                     */
+                    $apply: function(expr) {
+                        try {
+                            beginPhase('$apply');
+                            return this.$eval(expr);
+                        } catch (e) {
+                            $exceptionHandler(e);
+                        } finally {
+                            clearPhase();
+                            try {
+                                $rootScope.$digest();
+                            } catch (e) {
+                                $exceptionHandler(e);
+                                throw e;
+                            }
+                        }
+                    },
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$on
+                     * @function
+                     *
+                     * @description
+                     * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
+                     * discussion of event life cycle.
+                     *
+                     * The event listener function format is: `function(event, args...)`. The `event` object
+                     * passed into the listener has the following attributes:
+                     *
+                     *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or
+                     *     `$broadcast`-ed.
+                     *   - `currentScope` - `{Scope}`: the current scope which is handling the event.
+                     *   - `name` - `{string}`: name of the event.
+                     *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel
+                     *     further event propagation (available only for events that were `$emit`-ed).
+                     *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag
+                     *     to true.
+                     *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+                     *
+                     * @param {string} name Event name to listen on.
+                     * @param {function(event, ...args)} listener Function to call when the event is emitted.
+                     * @returns {function()} Returns a deregistration function for this listener.
+                     */
+                    $on: function(name, listener) {
+                        var namedListeners = this.$$listeners[name];
+                        if (!namedListeners) {
+                            this.$$listeners[name] = namedListeners = [];
+                        }
+                        namedListeners.push(listener);
+
+                        var current = this;
+                        do {
+                            if (!current.$$listenerCount[name]) {
+                                current.$$listenerCount[name] = 0;
+                            }
+                            current.$$listenerCount[name]++;
+                        } while ((current = current.$parent));
+
+                        var self = this;
+                        return function() {
+                            namedListeners[indexOf(namedListeners, listener)] = null;
+                            decrementListenerCount(self, 1, name);
+                        };
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$emit
+                     * @function
+                     *
+                     * @description
+                     * Dispatches an event `name` upwards through the scope hierarchy notifying the
+                     * registered {@link ng.$rootScope.Scope#$on} listeners.
+                     *
+                     * The event life cycle starts at the scope on which `$emit` was called. All
+                     * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+                     * notified. Afterwards, the event traverses upwards toward the root scope and calls all
+                     * registered listeners along the way. The event will stop propagating if one of the listeners
+                     * cancels it.
+                     *
+                     * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+                     * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+                     *
+                     * @param {string} name Event name to emit.
+                     * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+                     * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
+                     */
+                    $emit: function(name, args) {
+                        var empty = [],
+                            namedListeners,
+                            scope = this,
+                            stopPropagation = false,
+                            event = {
+                                name: name,
+                                targetScope: scope,
+                                stopPropagation: function() {stopPropagation = true;},
+                                preventDefault: function() {
+                                    event.defaultPrevented = true;
+                                },
+                                defaultPrevented: false
+                            },
+                            listenerArgs = concat([event], arguments, 1),
+                            i, length;
+
+                        do {
+                            namedListeners = scope.$$listeners[name] || empty;
+                            event.currentScope = scope;
+                            for (i=0, length=namedListeners.length; i<length; i++) {
+
+                                // if listeners were deregistered, defragment the array
+                                if (!namedListeners[i]) {
+                                    namedListeners.splice(i, 1);
+                                    i--;
+                                    length--;
+                                    continue;
+                                }
+                                try {
+                                    //allow all listeners attached to the current scope to run
+                                    namedListeners[i].apply(null, listenerArgs);
+                                } catch (e) {
+                                    $exceptionHandler(e);
+                                }
+                            }
+                            //if any listener on the current scope stops propagation, prevent bubbling
+                            if (stopPropagation) return event;
+                            //traverse upwards
+                            scope = scope.$parent;
+                        } while (scope);
+
+                        return event;
+                    },
+
+
+                    /**
+                     * @ngdoc method
+                     * @name $rootScope.Scope#$broadcast
+                     * @function
+                     *
+                     * @description
+                     * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
+                     * registered {@link ng.$rootScope.Scope#$on} listeners.
+                     *
+                     * The event life cycle starts at the scope on which `$broadcast` was called. All
+                     * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+                     * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
+                     * scope and calls all registered listeners along the way. The event cannot be canceled.
+                     *
+                     * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+                     * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+                     *
+                     * @param {string} name Event name to broadcast.
+                     * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+                     * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
+                     */
+                    $broadcast: function(name, args) {
+                        console.debug(name);
+                        var target = this,
+                            current = target,
+                            next = target,
+                            event = {
+                                name: name,
+                                targetScope: target,
+                                preventDefault: function() {
+                                    event.defaultPrevented = true;
+                                },
+                                defaultPrevented: false
+                            },
+                            listenerArgs = concat([event], arguments, 1),
+                            listeners, i, length;
+
+                        //down while you can, then up and next sibling or up and next sibling until back at root
+                        while ((current = next)) {
+                            event.currentScope = current;
+                            listeners = current.$$listeners[name] || [];
+                            for (i=0, length = listeners.length; i<length; i++) {
+                                // if listeners were deregistered, defragment the array
+                                if (!listeners[i]) {
+                                    listeners.splice(i, 1);
+                                    i--;
+                                    length--;
+                                    continue;
+                                }
+
+                                try {
+                                    listeners[i].apply(null, listenerArgs);
+                                } catch(e) {
+                                    $exceptionHandler(e);
+                                }
+                            }
+
+                            // Insanity Warning: scope depth-first traversal
+                            // yes, this code is a bit crazy, but it works and we have tests to prove it!
+                            // this piece should be kept in sync with the traversal in $digest
+                            // (though it differs due to having the extra check for $$listenerCount)
+                            if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
+                                (current !== target && current.$$nextSibling)))) {
+                                while(current !== target && !(next = current.$$nextSibling)) {
+                                    current = current.$parent;
+                                }
+                            }
+                        }
+
+                        return event;
+                    }
+                };
+
+                var $rootScope = new Scope();
+
+                return $rootScope;
+
+
+                function beginPhase(phase) {
+                    if ($rootScope.$$phase) {
+                        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
+                    }
+
+                    $rootScope.$$phase = phase;
+                }
+
+                function clearPhase() {
+                    $rootScope.$$phase = null;
+                }
+
+                function compileToFn(exp, name) {
+                    var fn = $parse(exp);
+                    assertArgFn(fn, name);
+                    return fn;
+                }
+
+                function decrementListenerCount(current, count, name) {
+                    do {
+                        current.$$listenerCount[name] -= count;
+
+                        if (current.$$listenerCount[name] === 0) {
+                            delete current.$$listenerCount[name];
+                        }
+                    } while ((current = current.$parent));
+                }
+
+                /**
+                 * function used as an initial value for watchers.
+                 * because it's unique we can easily tell it apart from other values
+                 */
+                function initWatchVal() {}
+            }];
+    }
+
+    /**
+     * @description
+     * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
+     */
+    function $$SanitizeUriProvider() {
+        var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
+            imgSrcSanitizationWhitelist = /^\s*(https?|ftp|file):|data:image\//;
+
+        /**
+         * @description
+         * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+         * urls during a[href] sanitization.
+         *
+         * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+         *
+         * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+         * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+         * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+         * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+         *
+         * @param {RegExp=} regexp New regexp to whitelist urls with.
+         * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+         *    chaining otherwise.
+         */
+        this.aHrefSanitizationWhitelist = function(regexp) {
+            if (isDefined(regexp)) {
+                aHrefSanitizationWhitelist = regexp;
+                return this;
+            }
+            return aHrefSanitizationWhitelist;
+        };
+
+
+        /**
+         * @description
+         * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+         * urls during img[src] sanitization.
+         *
+         * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+         *
+         * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+         * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+         * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+         * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+         *
+         * @param {RegExp=} regexp New regexp to whitelist urls with.
+         * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+         *    chaining otherwise.
+         */
+        this.imgSrcSanitizationWhitelist = function(regexp) {
+            if (isDefined(regexp)) {
+                imgSrcSanitizationWhitelist = regexp;
+                return this;
+            }
+            return imgSrcSanitizationWhitelist;
+        };
+
+        this.$get = function() {
+            return function sanitizeUri(uri, isImage) {
+                var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
+                var normalizedVal;
+                // NOTE: urlResolve() doesn't support IE < 8 so we don't sanitize for that case.
+                if (!msie || msie >= 8 ) {
+                    normalizedVal = urlResolve(uri).href;
+                    if (normalizedVal !== '' && !normalizedVal.match(regex)) {
+                        return 'unsafe:'+normalizedVal;
+                    }
+                }
+                return uri;
+            };
+        };
+    }
+
+    var $sceMinErr = minErr('$sce');
+
+    var SCE_CONTEXTS = {
+        HTML: 'html',
+        CSS: 'css',
+        URL: 'url',
+        // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+        // url.  (e.g. ng-include, script src, templateUrl)
+        RESOURCE_URL: 'resourceUrl',
+        JS: 'js'
+    };
+
+// Helper functions follow.
+
+// Copied from:
+// http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962
+// Prereq: s is a string.
+    function escapeForRegexp(s) {
+        return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+            replace(/\x08/g, '\\x08');
+    }
+
+
+    function adjustMatcher(matcher) {
+        if (matcher === 'self') {
+            return matcher;
+        } else if (isString(matcher)) {
+            // Strings match exactly except for 2 wildcards - '*' and '**'.
+            // '*' matches any character except those from the set ':/.?&'.
+            // '**' matches any character (like .* in a RegExp).
+            // More than 2 *'s raises an error as it's ill defined.
+            if (matcher.indexOf('***') > -1) {
+                throw $sceMinErr('iwcard',
+                    'Illegal sequence *** in string matcher.  String: {0}', matcher);
+            }
+            matcher = escapeForRegexp(matcher).
+                replace('\\*\\*', '.*').
+                replace('\\*', '[^:/.?&;]*');
+            return new RegExp('^' + matcher + '$');
+        } else if (isRegExp(matcher)) {
+            // The only other type of matcher allowed is a Regexp.
+            // Match entire URL / disallow partial matches.
+            // Flags are reset (i.e. no global, ignoreCase or multiline)
+            return new RegExp('^' + matcher.source + '$');
+        } else {
+            throw $sceMinErr('imatcher',
+                'Matchers may only be "self", string patterns or RegExp objects');
+        }
+    }
+
+
+    function adjustMatchers(matchers) {
+        var adjustedMatchers = [];
+        if (isDefined(matchers)) {
+            forEach(matchers, function(matcher) {
+                adjustedMatchers.push(adjustMatcher(matcher));
+            });
+        }
+        return adjustedMatchers;
+    }
+
+
+    /**
+     * @ngdoc service
+     * @name $sceDelegate
+     * @function
+     *
+     * @description
+     *
+     * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
+ * Contextual Escaping (SCE)} services to AngularJS.
+     *
+     * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
+     * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is
+     * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
+     * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
+     * work because `$sce` delegates to `$sceDelegate` for these operations.
+     *
+     * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
+     *
+     * The default instance of `$sceDelegate` should work out of the box with little pain.  While you
+     * can override it completely to change the behavior of `$sce`, the common case would
+     * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
+     * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
+     * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
+ * $sceDelegateProvider.resourceUrlWhitelist} and {@link
+        * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+     */
+
+    /**
+     * @ngdoc provider
+     * @name $sceDelegateProvider
+     * @description
+     *
+     * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
+ * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure
+     * that the URLs used for sourcing Angular templates are safe.  Refer {@link
+        * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+     * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+     *
+     * For the general details about this service in Angular, read the main page for {@link ng.$sce
+ * Strict Contextual Escaping (SCE)}.
+     *
+     * **Example**:  Consider the following case. <a name="example"></a>
+     *
+     * - your app is hosted at url `http://myapp.example.com/`
+     * - but some of your templates are hosted on other domains you control such as
+     *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+     * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
+     *
+     * Here is what a secure configuration for this scenario might look like:
+     *
+     * <pre class="prettyprint">
+     *    angular.module('myApp', []).config(function($sceDelegateProvider) {
+ *      $sceDelegateProvider.resourceUrlWhitelist([
+ *        // Allow same origin resource loads.
+ *        'self',
+ *        // Allow loading from our assets domain.  Notice the difference between * and **.
+ *        'http://srv*.assets.example.com/**']);
+ *
+ *      // The blacklist overrides the whitelist so the open redirect here is blocked.
+ *      $sceDelegateProvider.resourceUrlBlacklist([
+ *        'http://myapp.example.com/clickThru**']);
+ *      });
+     * </pre>
+     */
+
+    function $SceDelegateProvider() {
+        this.SCE_CONTEXTS = SCE_CONTEXTS;
+
+        // Resource URLs can also be trusted by policy.
+        var resourceUrlWhitelist = ['self'],
+            resourceUrlBlacklist = [];
+
+        /**
+         * @ngdoc method
+         * @name $sceDelegateProvider#resourceUrlWhitelist
+         * @function
+         *
+         * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
+         *     provided.  This must be an array or null.  A snapshot of this array is used so further
+         *     changes to the array are ignored.
+         *
+         *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+         *     allowed in this array.
+         *
+         *     Note: **an empty whitelist array will block all URLs**!
+         *
+         * @return {Array} the currently set whitelist array.
+         *
+         * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
+         * same origin resource requests.
+         *
+         * @description
+         * Sets/Gets the whitelist of trusted resource URLs.
+         */
+        this.resourceUrlWhitelist = function (value) {
+            if (arguments.length) {
+                resourceUrlWhitelist = adjustMatchers(value);
+            }
+            return resourceUrlWhitelist;
+        };
+
+        /**
+         * @ngdoc method
+         * @name $sceDelegateProvider#resourceUrlBlacklist
+         * @function
+         *
+         * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
+         *     provided.  This must be an array or null.  A snapshot of this array is used so further
+         *     changes to the array are ignored.
+         *
+         *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+         *     allowed in this array.
+         *
+         *     The typical usage for the blacklist is to **block
+         *     [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+         *     these would otherwise be trusted but actually return content from the redirected domain.
+         *
+         *     Finally, **the blacklist overrides the whitelist** and has the final say.
+         *
+         * @return {Array} the currently set blacklist array.
+         *
+         * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
+         * is no blacklist.)
+         *
+         * @description
+         * Sets/Gets the blacklist of trusted resource URLs.
+         */
+
+        this.resourceUrlBlacklist = function (value) {
+            if (arguments.length) {
+                resourceUrlBlacklist = adjustMatchers(value);
+            }
+            return resourceUrlBlacklist;
+        };
+
+        this.$get = ['$injector', function($injector) {
+
+            var htmlSanitizer = function htmlSanitizer(html) {
+                throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+            };
+
+            if ($injector.has('$sanitize')) {
+                htmlSanitizer = $injector.get('$sanitize');
+            }
+
+
+            function matchUrl(matcher, parsedUrl) {
+                if (matcher === 'self') {
+                    return urlIsSameOrigin(parsedUrl);
+                } else {
+                    // definitely a regex.  See adjustMatchers()
+                    return !!matcher.exec(parsedUrl.href);
+                }
+            }
+
+            function isResourceUrlAllowedByPolicy(url) {
+                var parsedUrl = urlResolve(url.toString());
+                var i, n, allowed = false;
+                // Ensure that at least one item from the whitelist allows this url.
+                for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
+                    if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
+                        allowed = true;
+                        break;
+                    }
+                }
+                if (allowed) {
+                    // Ensure that no item from the blacklist blocked this url.
+                    for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
+                        if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
+                            allowed = false;
+                            break;
+                        }
+                    }
+                }
+                return allowed;
+            }
+
+            function generateHolderType(Base) {
+                var holderType = function TrustedValueHolderType(trustedValue) {
+                    this.$$unwrapTrustedValue = function() {
+                        return trustedValue;
+                    };
+                };
+                if (Base) {
+                    holderType.prototype = new Base();
+                }
+                holderType.prototype.valueOf = function sceValueOf() {
+                    return this.$$unwrapTrustedValue();
+                };
+                holderType.prototype.toString = function sceToString() {
+                    return this.$$unwrapTrustedValue().toString();
+                };
+                return holderType;
+            }
+
+            var trustedValueHolderBase = generateHolderType(),
+                byType = {};
+
+            byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
+            byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
+            byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
+            byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
+            byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
+
+            /**
+             * @ngdoc method
+             * @name $sceDelegate#trustAs
+             *
+             * @description
+             * Returns an object that is trusted by angular for use in specified strict
+             * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+             * attribute interpolation, any dom event binding attribute interpolation
+             * such as for onclick,  etc.) that uses the provided value.
+             * See {@link ng.$sce $sce} for enabling strict contextual escaping.
+             *
+             * @param {string} type The kind of context in which this value is safe for use.  e.g. url,
+             *   resourceUrl, html, js and css.
+             * @param {*} value The value that that should be considered trusted/safe.
+             * @returns {*} A value that can be used to stand in for the provided `value` in places
+             * where Angular expects a $sce.trustAs() return value.
+             */
+            function trustAs(type, trustedValue) {
+                var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+                if (!Constructor) {
+                    throw $sceMinErr('icontext',
+                        'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
+                        type, trustedValue);
+                }
+                if (trustedValue === null || trustedValue === undefined || trustedValue === '') {
+                    return trustedValue;
+                }
+                // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting
+                // mutable objects, we ensure here that the value passed in is actually a string.
+                if (typeof trustedValue !== 'string') {
+                    throw $sceMinErr('itype',
+                        'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
+                        type);
+                }
+                return new Constructor(trustedValue);
+            }
+
+            /**
+             * @ngdoc method
+             * @name $sceDelegate#valueOf
+             *
+             * @description
+             * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
+     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
+                * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
+             *
+             * If the passed parameter is not a value that had been returned by {@link
+                * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
+             *
+             * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
+             *      call or anything else.
+             * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns
+             *     `value` unchanged.
+             */
+            function valueOf(maybeTrusted) {
+                if (maybeTrusted instanceof trustedValueHolderBase) {
+                    return maybeTrusted.$$unwrapTrustedValue();
+                } else {
+                    return maybeTrusted;
+                }
+            }
+
+            /**
+             * @ngdoc method
+             * @name $sceDelegate#getTrusted
+             *
+             * @description
+             * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+             * returns the originally supplied value if the queried context type is a supertype of the
+             * created type.  If this condition isn't satisfied, throws an exception.
+             *
+             * @param {string} type The kind of context in which this value is to be used.
+             * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} call.
+             * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.
+             */
+            function getTrusted(type, maybeTrusted) {
+                if (maybeTrusted === null || maybeTrusted === undefined || maybeTrusted === '') {
+                    return maybeTrusted;
+                }
+                var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+                if (constructor && maybeTrusted instanceof constructor) {
+                    return maybeTrusted.$$unwrapTrustedValue();
+                }
+                // If we get here, then we may only take one of two actions.
+                // 1. sanitize the value for the requested type, or
+                // 2. throw an exception.
+                if (type === SCE_CONTEXTS.RESOURCE_URL) {
+                    if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
+                        return maybeTrusted;
+                    } else {
+                        throw $sceMinErr('insecurl',
+                            'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',
+                            maybeTrusted.toString());
+                    }
+                } else if (type === SCE_CONTEXTS.HTML) {
+                    return htmlSanitizer(maybeTrusted);
+                }
+                throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+            }
+
+            return { trustAs: trustAs,
+                getTrusted: getTrusted,
+                valueOf: valueOf };
+        }];
+    }
+
+
+    /**
+     * @ngdoc provider
+     * @name $sceProvider
+     * @description
+     *
+     * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
+     * -   enable/disable Strict Contextual Escaping (SCE) in a module
+     * -   override the default implementation with a custom delegate
+     *
+     * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
+     */
+
+    /* jshint maxlen: false*/
+
+    /**
+     * @ngdoc service
+     * @name $sce
+     * @function
+     *
+     * @description
+     *
+     * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
+     *
+     * # Strict Contextual Escaping
+     *
+     * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+     * contexts to result in a value that is marked as safe to use for that context.  One example of
+     * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer
+     * to these contexts as privileged or SCE contexts.
+     *
+     * As of version 1.2, Angular ships with SCE enabled by default.
+     *
+     * Note:  When enabled (the default), IE8 in quirks mode is not supported.  In this mode, IE8 allows
+     * one to execute arbitrary javascript by the use of the expression() syntax.  Refer
+     * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+     * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+     * to the top of your HTML document.
+     *
+     * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
+     * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
+     *
+     * Here's an example of a binding in a privileged context:
+     *
+     * <pre class="prettyprint">
+     *     <input ng-model="userHtml">
+     *     <div ng-bind-html="userHtml">
+     * </pre>
+     *
+     * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE
+     * disabled, this application allows the user to render arbitrary HTML into the DIV.
+     * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+     * bindings.  (HTML is just one example of a context where rendering user controlled input creates
+     * security vulnerabilities.)
+     *
+     * For the case of HTML, you might use a library, either on the client side, or on the server side,
+     * to sanitize unsafe HTML before binding to the value and rendering it in the document.
+     *
+     * How would you ensure that every place that used these types of bindings was bound to a value that
+     * was sanitized by your library (or returned as safe for rendering by your server?)  How can you
+     * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
+     * properties/fields and forgot to update the binding to the sanitized value?
+     *
+     * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+     * determine that something explicitly says it's safe to use a value for binding in that
+     * context.  You can then audit your code (a simple grep would do) to ensure that this is only done
+     * for those values that you can easily tell are safe - because they were received from your server,
+     * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps
+     * allowing only the files in a specific directory to do this.  Ensuring that the internal API
+     * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
+     *
+     * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+     * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
+     * obtain values that will be accepted by SCE / privileged contexts.
+     *
+     *
+     * ## How does it work?
+     *
+     * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
+ * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link
+        * ng.$sce#parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+     * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+     *
+     * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
+        * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly
+     * simplified):
+     *
+     * <pre class="prettyprint">
+     *   var ngBindHtmlDirective = ['$sce', function($sce) {
+ *     return function(scope, element, attr) {
+ *       scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ *         element.html(value || '');
+ *       });
+ *     };
+ *   }];
+     * </pre>
+     *
+     * ## Impact on loading templates
+     *
+     * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as
+     * `templateUrl`'s specified by {@link guide/directive directives}.
+     *
+     * By default, Angular only loads templates from the same domain and protocol as the application
+     * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or
+     * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
+     *
+     * *Please note*:
+     * The browser's
+     * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+     * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+     * policy apply in addition to this and may further restrict whether the template is successfully
+     * loaded.  This means that without the right CORS policy, loading templates from a different domain
+     * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some
+     * browsers.
+     *
+     * ## This feels like too much overhead for the developer?
+     *
+     * It's important to remember that SCE only applies to interpolation expressions.
+     *
+     * If your expressions are constant literals, they're automatically trusted and you don't need to
+     * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+     * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+     *
+     * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+     * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.
+     *
+     * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
+     * templates in `ng-include` from your application's domain without having to even know about SCE.
+     * It blocks loading templates from other domains or loading templates over http from an https
+     * served document.  You can change these by setting your own custom {@link
+        * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+        * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
+     *
+     * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an
+     * application that's secure and can be audited to verify that with much more ease than bolting
+     * security onto an application later.
+     *
+     * <a name="contexts"></a>
+     * ## What trusted context types are supported?
+     *
+     * | Context             | Notes          |
+     * |---------------------|----------------|
+     * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. |
+     * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |
+     * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+     * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+     * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |
+     *
+     * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
+     *
+     *  Each element in these arrays must be one of the following:
+     *
+     *  - **'self'**
+     *    - The special **string**, `'self'`, can be used to match against all URLs of the **same
+     *      domain** as the application document using the **same protocol**.
+     *  - **String** (except the special value `'self'`)
+     *    - The string is matched against the full *normalized / absolute URL* of the resource
+     *      being tested (substring matches are not good enough.)
+     *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters
+     *      match themselves.
+     *    - `*`: matches zero or more occurrences of any character other than one of the following 6
+     *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'.  It's a useful wildcard for use
+     *      in a whitelist.
+     *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not
+     *      not appropriate to use in for a scheme, domain, etc. as it would match too much.  (e.g.
+     *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
+     *      not have been the intention.)  It's usage at the very end of the path is ok.  (e.g.
+     *      http://foo.example.com/templates/**).
+     *  - **RegExp** (*see caveat below*)
+     *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax
+     *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to
+     *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should
+     *      have good test coverage.).  For instance, the use of `.` in the regex is correct only in a
+     *      small number of cases.  A `.` character in the regex used when matching the scheme or a
+     *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It
+     *      is highly recommended to use the string patterns and only fall back to regular expressions
+     *      if they as a last resort.
+     *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is
+     *      matched against the **entire** *normalized / absolute URL* of the resource being tested
+     *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags
+     *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+     *    - If you are generating your JavaScript from some other templating engine (not
+     *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),
+     *      remember to escape your regular expression (and be aware that you might need more than
+     *      one level of escaping depending on your templating engine and the way you interpolated
+     *      the value.)  Do make use of your platform's escaping mechanism as it might be good
+     *      enough before coding your own.  e.g. Ruby has
+     *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
+     *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
+     *      Javascript lacks a similar built in function for escaping.  Take a look at Google
+     *      Closure library's [goog.string.regExpEscape(s)](
+     *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
+     *
+     * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.
+     *
+     * ## Show me an example using SCE.
+     *
+     * @example
+     <example module="mySceApp" deps="angular-sanitize.js">
+     <file name="index.html">
+     <div ng-controller="myAppController as myCtrl">
+     <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
+     <b>User comments</b><br>
+     By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
+     $sanitize is available.  If $sanitize isn't available, this results in an error instead of an
+     exploit.
+     <div class="well">
+     <div ng-repeat="userComment in myCtrl.userComments">
+     <b>{{userComment.name}}</b>:
+     <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
+     <br>
+     </div>
+     </div>
+     </div>
+     </file>
+
+     <file name="script.js">
+     var mySceApp = angular.module('mySceApp', ['ngSanitize']);
+
+     mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) {
+    var self = this;
+    $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+      self.userComments = userComments;
+    });
+    self.explicitlyTrustedHtml = $sce.trustAsHtml(
+        '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+        'sanitization.&quot;">Hover over this text.</span>');
+  });
+     </file>
+
+     <file name="test_data.json">
+     [
+     { "name": "Alice",
+    "htmlComment":
+        "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
+  },
+     { "name": "Bob",
+    "htmlComment": "<i>Yes!</i>  Am I the only other one?"
+  }
+     ]
+     </file>
+
+     <file name="protractor.js" type="protractor">
+     describe('SCE doc demo', function() {
+    it('should sanitize untrusted values', function() {
+      expect(element(by.css('.htmlComment')).getInnerHtml())
+          .toBe('<span>Is <i>anyone</i> reading this?</span>');
+    });
+
+    it('should NOT sanitize explicitly trusted values', function() {
+      expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
+          '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+          'sanitization.&quot;">Hover over this text.</span>');
+    });
+  });
+     </file>
+     </example>
+     *
+     *
+     *
+     * ## Can I disable SCE completely?
+     *
+     * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits
+     * for little coding overhead.  It will be much harder to take an SCE disabled application and
+     * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE
+     * for cases where you have a lot of existing code that was written before SCE was introduced and
+     * you're migrating them a module at a time.
+     *
+     * That said, here's how you can completely disable SCE:
+     *
+     * <pre class="prettyprint">
+     *   angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ *     // Completely disable SCE.  For demonstration purposes only!
+ *     // Do not use in new projects.
+ *     $sceProvider.enabled(false);
+ *   });
+     * </pre>
+     *
+     */
+    /* jshint maxlen: 100 */
+
+    function $SceProvider() {
+        var enabled = true;
+
+        /**
+         * @ngdoc method
+         * @name $sceProvider#enabled
+         * @function
+         *
+         * @param {boolean=} value If provided, then enables/disables SCE.
+         * @return {boolean} true if SCE is enabled, false otherwise.
+         *
+         * @description
+         * Enables/disables SCE and returns the current value.
+         */
+        this.enabled = function (value) {
+            if (arguments.length) {
+                enabled = !!value;
+            }
+            return enabled;
+        };
+
+
+        /* Design notes on the default implementation for SCE.
+         *
+         * The API contract for the SCE delegate
+         * -------------------------------------
+         * The SCE delegate object must provide the following 3 methods:
+         *
+         * - trustAs(contextEnum, value)
+         *     This method is used to tell the SCE service that the provided value is OK to use in the
+         *     contexts specified by contextEnum.  It must return an object that will be accepted by
+         *     getTrusted() for a compatible contextEnum and return this value.
+         *
+         * - valueOf(value)
+         *     For values that were not produced by trustAs(), return them as is.  For values that were
+         *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if
+         *     trustAs is wrapping the given values into some type, this operation unwraps it when given
+         *     such a value.
+         *
+         * - getTrusted(contextEnum, value)
+         *     This function should return the a value that is safe to use in the context specified by
+         *     contextEnum or throw and exception otherwise.
+         *
+         * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be
+         * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For
+         * instance, an implementation could maintain a registry of all trusted objects by context.  In
+         * such a case, trustAs() would return the same object that was passed in.  getTrusted() would
+         * return the same object passed in if it was found in the registry under a compatible context or
+         * throw an exception otherwise.  An implementation might only wrap values some of the time based
+         * on some criteria.  getTrusted() might return a value and not throw an exception for special
+         * constants or objects even if not wrapped.  All such implementations fulfill this contract.
+         *
+         *
+         * A note on the inheritance model for SCE contexts
+         * ------------------------------------------------
+         * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This
+         * is purely an implementation details.
+         *
+         * The contract is simply this:
+         *
+         *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
+         *     will also succeed.
+         *
+         * Inheritance happens to capture this in a natural way.  In some future, we
+         * may not use inheritance anymore.  That is OK because no code outside of
+         * sce.js and sceSpecs.js would need to be aware of this detail.
+         */
+
+        this.$get = ['$parse', '$sniffer', '$sceDelegate', function(
+            $parse,   $sniffer,   $sceDelegate) {
+            // Prereq: Ensure that we're not running in IE8 quirks mode.  In that mode, IE allows
+            // the "expression(javascript expression)" syntax which is insecure.
+            if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {
+                throw $sceMinErr('iequirks',
+                    'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' +
+                    'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +
+                    'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');
+            }
+
+            var sce = copy(SCE_CONTEXTS);
+
+            /**
+             * @ngdoc method
+             * @name $sce#isEnabled
+             * @function
+             *
+             * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you
+             * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+             *
+             * @description
+             * Returns a boolean indicating if SCE is enabled.
+             */
+            sce.isEnabled = function () {
+                return enabled;
+            };
+            sce.trustAs = $sceDelegate.trustAs;
+            sce.getTrusted = $sceDelegate.getTrusted;
+            sce.valueOf = $sceDelegate.valueOf;
+
+            if (!enabled) {
+                sce.trustAs = sce.getTrusted = function(type, value) { return value; };
+                sce.valueOf = identity;
+            }
+
+            /**
+             * @ngdoc method
+             * @name $sce#parse
+             *
+             * @description
+             * Converts Angular {@link guide/expression expression} into a function.  This is like {@link
+                * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it
+             * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
+     * *result*)}
+             *
+             * @param {string} type The kind of SCE context in which this result will be used.
+             * @param {string} expression String expression to compile.
+             * @returns {function(context, locals)} a function which represents the compiled expression:
+             *
+             *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+             *      are evaluated against (typically a scope object).
+             *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+             *      `context`.
+             */
+            sce.parseAs = function sceParseAs(type, expr) {
+                var parsed = $parse(expr);
+                if (parsed.literal && parsed.constant) {
+                    return parsed;
+                } else {
+                    return function sceParseAsTrusted(self, locals) {
+                        return sce.getTrusted(type, parsed(self, locals));
+                    };
+                }
+            };
+
+            /**
+             * @ngdoc method
+             * @name $sce#trustAs
+             *
+             * @description
+             * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,
+             * returns an object that is trusted by angular for use in specified strict contextual
+             * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+             * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)
+             * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual
+             * escaping.
+             *
+             * @param {string} type The kind of context in which this value is safe for use.  e.g. url,
+             *   resource_url, html, js and css.
+             * @param {*} value The value that that should be considered trusted/safe.
+             * @returns {*} A value that can be used to stand in for the provided `value` in places
+             * where Angular expects a $sce.trustAs() return value.
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#trustAsHtml
+             *
+             * @description
+             * Shorthand method.  `$sce.trustAsHtml(value)` →
+             *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+             *
+             * @param {*} value The value to trustAs.
+             * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives
+             *     only accept expressions that are either literal constants or are the
+             *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#trustAsUrl
+             *
+             * @description
+             * Shorthand method.  `$sce.trustAsUrl(value)` →
+             *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+             *
+             * @param {*} value The value to trustAs.
+             * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives
+             *     only accept expressions that are either literal constants or are the
+             *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#trustAsResourceUrl
+             *
+             * @description
+             * Shorthand method.  `$sce.trustAsResourceUrl(value)` →
+             *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+             *
+             * @param {*} value The value to trustAs.
+             * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives
+             *     only accept expressions that are either literal constants or are the return
+             *     value of {@link ng.$sce#trustAs $sce.trustAs}.)
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#trustAsJs
+             *
+             * @description
+             * Shorthand method.  `$sce.trustAsJs(value)` →
+             *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+             *
+             * @param {*} value The value to trustAs.
+             * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives
+             *     only accept expressions that are either literal constants or are the
+             *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#getTrusted
+             *
+             * @description
+             * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,
+             * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+             * originally supplied value if the queried context type is a supertype of the created type.
+             * If this condition isn't satisfied, throws an exception.
+             *
+             * @param {string} type The kind of context in which this value is to be used.
+             * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+             *                         call.
+             * @returns {*} The value the was originally provided to
+             *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+             *              Otherwise, throws an exception.
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#getTrustedHtml
+             *
+             * @description
+             * Shorthand method.  `$sce.getTrustedHtml(value)` →
+             *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+             *
+             * @param {*} value The value to pass to `$sce.getTrusted`.
+             * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#getTrustedCss
+             *
+             * @description
+             * Shorthand method.  `$sce.getTrustedCss(value)` →
+             *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+             *
+             * @param {*} value The value to pass to `$sce.getTrusted`.
+             * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#getTrustedUrl
+             *
+             * @description
+             * Shorthand method.  `$sce.getTrustedUrl(value)` →
+             *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+             *
+             * @param {*} value The value to pass to `$sce.getTrusted`.
+             * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#getTrustedResourceUrl
+             *
+             * @description
+             * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →
+             *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+             *
+             * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
+             * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#getTrustedJs
+             *
+             * @description
+             * Shorthand method.  `$sce.getTrustedJs(value)` →
+             *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+             *
+             * @param {*} value The value to pass to `$sce.getTrusted`.
+             * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#parseAsHtml
+             *
+             * @description
+             * Shorthand method.  `$sce.parseAsHtml(expression string)` →
+             *     {@link ng.$sce#parse `$sce.parseAs($sce.HTML, value)`}
+             *
+             * @param {string} expression String expression to compile.
+             * @returns {function(context, locals)} a function which represents the compiled expression:
+             *
+             *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+             *      are evaluated against (typically a scope object).
+             *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+             *      `context`.
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#parseAsCss
+             *
+             * @description
+             * Shorthand method.  `$sce.parseAsCss(value)` →
+             *     {@link ng.$sce#parse `$sce.parseAs($sce.CSS, value)`}
+             *
+             * @param {string} expression String expression to compile.
+             * @returns {function(context, locals)} a function which represents the compiled expression:
+             *
+             *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+             *      are evaluated against (typically a scope object).
+             *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+             *      `context`.
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#parseAsUrl
+             *
+             * @description
+             * Shorthand method.  `$sce.parseAsUrl(value)` →
+             *     {@link ng.$sce#parse `$sce.parseAs($sce.URL, value)`}
+             *
+             * @param {string} expression String expression to compile.
+             * @returns {function(context, locals)} a function which represents the compiled expression:
+             *
+             *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+             *      are evaluated against (typically a scope object).
+             *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+             *      `context`.
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#parseAsResourceUrl
+             *
+             * @description
+             * Shorthand method.  `$sce.parseAsResourceUrl(value)` →
+             *     {@link ng.$sce#parse `$sce.parseAs($sce.RESOURCE_URL, value)`}
+             *
+             * @param {string} expression String expression to compile.
+             * @returns {function(context, locals)} a function which represents the compiled expression:
+             *
+             *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+             *      are evaluated against (typically a scope object).
+             *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+             *      `context`.
+             */
+
+            /**
+             * @ngdoc method
+             * @name $sce#parseAsJs
+             *
+             * @description
+             * Shorthand method.  `$sce.parseAsJs(value)` →
+             *     {@link ng.$sce#parse `$sce.parseAs($sce.JS, value)`}
+             *
+             * @param {string} expression String expression to compile.
+             * @returns {function(context, locals)} a function which represents the compiled expression:
+             *
+             *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+             *      are evaluated against (typically a scope object).
+             *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+             *      `context`.
+             */
+
+            // Shorthand delegations.
+            var parse = sce.parseAs,
+                getTrusted = sce.getTrusted,
+                trustAs = sce.trustAs;
+
+            forEach(SCE_CONTEXTS, function (enumValue, name) {
+                var lName = lowercase(name);
+                sce[camelCase("parse_as_" + lName)] = function (expr) {
+                    return parse(enumValue, expr);
+                };
+                sce[camelCase("get_trusted_" + lName)] = function (value) {
+                    return getTrusted(enumValue, value);
+                };
+                sce[camelCase("trust_as_" + lName)] = function (value) {
+                    return trustAs(enumValue, value);
+                };
+            });
+
+            return sce;
+        }];
+    }
+
+    /**
+     * !!! This is an undocumented "private" service !!!
+     *
+     * @name $sniffer
+     * @requires $window
+     * @requires $document
+     *
+     * @property {boolean} history Does the browser support html5 history api ?
+     * @property {boolean} hashchange Does the browser support hashchange event ?
+     * @property {boolean} transitions Does the browser support CSS transition events ?
+     * @property {boolean} animations Does the browser support CSS animation events ?
+     *
+     * @description
+     * This is very simple implementation of testing browser's features.
+     */
+    function $SnifferProvider() {
+        this.$get = ['$window', '$document', function($window, $document) {
+            var eventSupport = {},
+                android =
+                    int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+                boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
+                document = $document[0] || {},
+                documentMode = document.documentMode,
+                vendorPrefix,
+                vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
+                bodyStyle = document.body && document.body.style,
+                transitions = false,
+                animations = false,
+                match;
+
+            if (bodyStyle) {
+                for(var prop in bodyStyle) {
+                    if(match = vendorRegex.exec(prop)) {
+                        vendorPrefix = match[0];
+                        vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+                        break;
+                    }
+                }
+
+                if(!vendorPrefix) {
+                    vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+                }
+
+                transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+                animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+                if (android && (!transitions||!animations)) {
+                    transitions = isString(document.body.style.webkitTransition);
+                    animations = isString(document.body.style.webkitAnimation);
+                }
+            }
+
+
+            return {
+                // Android has history.pushState, but it does not update location correctly
+                // so let's not use the history API at all.
+                // http://code.google.com/p/android/issues/detail?id=17471
+                // https://github.com/angular/angular.js/issues/904
+
+                // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
+                // so let's not use the history API also
+                // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+                // jshint -W018
+                history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
+                // jshint +W018
+                hashchange: 'onhashchange' in $window &&
+                    // IE8 compatible mode lies
+                (!documentMode || documentMode > 7),
+                hasEvent: function(event) {
+                    // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
+                    // it. In particular the event is not fired when backspace or delete key are pressed or
+                    // when cut operation is performed.
+                    if (event == 'input' && msie == 9) return false;
+
+                    if (isUndefined(eventSupport[event])) {
+                        var divElm = document.createElement('div');
+                        eventSupport[event] = 'on' + event in divElm;
+                    }
+
+                    return eventSupport[event];
+                },
+                csp: csp(),
+                vendorPrefix: vendorPrefix,
+                transitions : transitions,
+                animations : animations,
+                android: android,
+                msie : msie,
+                msieDocumentMode: documentMode
+            };
+        }];
+    }
+
+    function $TimeoutProvider() {
+        this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler',
+            function($rootScope,   $browser,   $q,   $exceptionHandler) {
+                var deferreds = {};
+
+
+                /**
+                 * @ngdoc service
+                 * @name $timeout
+                 *
+                 * @description
+                 * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
+                 * block and delegates any exceptions to
+                 * {@link ng.$exceptionHandler $exceptionHandler} service.
+                 *
+                 * The return value of registering a timeout function is a promise, which will be resolved when
+                 * the timeout is reached and the timeout function is executed.
+                 *
+                 * To cancel a timeout request, call `$timeout.cancel(promise)`.
+                 *
+                 * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
+                 * synchronously flush the queue of deferred functions.
+                 *
+                 * @param {function()} fn A function, whose execution should be delayed.
+                 * @param {number=} [delay=0] Delay in milliseconds.
+                 * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+                 *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+                 * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
+                 *   promise will be resolved with is the return value of the `fn` function.
+                 *
+                 */
+                function timeout(fn, delay, invokeApply) {
+                    var deferred = $q.defer(),
+                        promise = deferred.promise,
+                        skipApply = (isDefined(invokeApply) && !invokeApply),
+                        timeoutId;
+
+                    timeoutId = $browser.defer(function() {
+                        try {
+                            deferred.resolve(fn());
+                        } catch(e) {
+                            deferred.reject(e);
+                            $exceptionHandler(e);
+                        }
+                        finally {
+                            delete deferreds[promise.$$timeoutId];
+                        }
+
+                        if (!skipApply) $rootScope.$apply();
+                    }, delay);
+
+                    promise.$$timeoutId = timeoutId;
+                    deferreds[timeoutId] = deferred;
+
+                    return promise;
+                }
+
+
+                /**
+                 * @ngdoc method
+                 * @name $timeout#cancel
+                 *
+                 * @description
+                 * Cancels a task associated with the `promise`. As a result of this, the promise will be
+                 * resolved with a rejection.
+                 *
+                 * @param {Promise=} promise Promise returned by the `$timeout` function.
+                 * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+                 *   canceled.
+                 */
+                timeout.cancel = function(promise) {
+                    if (promise && promise.$$timeoutId in deferreds) {
+                        deferreds[promise.$$timeoutId].reject('canceled');
+                        delete deferreds[promise.$$timeoutId];
+                        return $browser.defer.cancel(promise.$$timeoutId);
+                    }
+                    return false;
+                };
+
+                return timeout;
+            }];
+    }
+
+// NOTE:  The usage of window and document instead of $window and $document here is
+// deliberate.  This service depends on the specific behavior of anchor nodes created by the
+// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
+// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it
+// doesn't know about mocked locations and resolves URLs to the real document - which is
+// exactly the behavior needed here.  There is little value is mocking these out for this
+// service.
+    var urlParsingNode = document.createElement("a");
+    var originUrl = urlResolve(window.location.href, true);
+
+
+    /**
+     *
+     * Implementation Notes for non-IE browsers
+     * ----------------------------------------
+     * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
+     * results both in the normalizing and parsing of the URL.  Normalizing means that a relative
+     * URL will be resolved into an absolute URL in the context of the application document.
+     * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
+     * properties are all populated to reflect the normalized URL.  This approach has wide
+     * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See
+     * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+     *
+     * Implementation Notes for IE
+     * ---------------------------
+     * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other
+     * browsers.  However, the parsed components will not be set if the URL assigned did not specify
+     * them.  (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.)  We
+     * work around that by performing the parsing in a 2nd step by taking a previously normalized
+     * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the
+     * properties such as protocol, hostname, port, etc.
+     *
+     * IE7 does not normalize the URL when assigned to an anchor node.  (Apparently, it does, if one
+     * uses the inner HTML approach to assign the URL as part of an HTML snippet -
+     * http://stackoverflow.com/a/472729)  However, setting img[src] does normalize the URL.
+     * Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception.
+     * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that
+     * method and IE < 8 is unsupported.
+     *
+     * References:
+     *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
+     *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+     *   http://url.spec.whatwg.org/#urlutils
+     *   https://github.com/angular/angular.js/pull/2902
+     *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+     *
+     * @function
+     * @param {string} url The URL to be parsed.
+     * @description Normalizes and parses a URL.
+     * @returns {object} Returns the normalized URL as a dictionary.
+     *
+     *   | member name   | Description    |
+     *   |---------------|----------------|
+     *   | href          | A normalized version of the provided URL if it was not an absolute URL |
+     *   | protocol      | The protocol including the trailing colon                              |
+     *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |
+     *   | search        | The search params, minus the question mark                             |
+     *   | hash          | The hash string, minus the hash symbol
+     *   | hostname      | The hostname
+     *   | port          | The port, without ":"
+     *   | pathname      | The pathname, beginning with "/"
+     *
+     */
+    function urlResolve(url, base) {
+        var href = url;
+
+        if (msie) {
+            // Normalize before parse.  Refer Implementation Notes on why this is
+            // done in two steps on IE.
+            urlParsingNode.setAttribute("href", href);
+            href = urlParsingNode.href;
+        }
+
+        urlParsingNode.setAttribute('href', href);
+
+        // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+        return {
+            href: urlParsingNode.href,
+            protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+            host: urlParsingNode.host,
+            search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+            hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+            hostname: urlParsingNode.hostname,
+            port: urlParsingNode.port,
+            pathname: (urlParsingNode.pathname.charAt(0) === '/')
+                ? urlParsingNode.pathname
+                : '/' + urlParsingNode.pathname
+        };
+    }
+
+    /**
+     * Parse a request URL and determine whether this is a same-origin request as the application document.
+     *
+     * @param {string|object} requestUrl The url of the request as a string that will be resolved
+     * or a parsed URL object.
+     * @returns {boolean} Whether the request is for the same origin as the application document.
+     */
+    function urlIsSameOrigin(requestUrl) {
+        var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
+        return (parsed.protocol === originUrl.protocol &&
+        parsed.host === originUrl.host);
+    }
+
+    /**
+     * @ngdoc service
+     * @name $window
+     *
+     * @description
+     * A reference to the browser's `window` object. While `window`
+     * is globally available in JavaScript, it causes testability problems, because
+     * it is a global variable. In angular we always refer to it through the
+     * `$window` service, so it may be overridden, removed or mocked for testing.
+     *
+     * Expressions, like the one defined for the `ngClick` directive in the example
+     * below, are evaluated with respect to the current scope.  Therefore, there is
+     * no risk of inadvertently coding in a dependency on a global value in such an
+     * expression.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope, $window) {
+           $scope.greeting = 'Hello, World!';
+           $scope.doGreeting = function(greeting) {
+               $window.alert(greeting);
+           };
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     <input type="text" ng-model="greeting" />
+     <button ng-click="doGreeting(greeting)">ALERT</button>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should display the greeting in the input box', function() {
+       element(by.model('greeting')).sendKeys('Hello, E2E Tests');
+       // If we click the button it will block the test runner
+       // element(':button').click();
+      });
+     </file>
+     </example>
+     */
+    function $WindowProvider(){
+        this.$get = valueFn(window);
+    }
+
+    /**
+     * @ngdoc provider
+     * @name $filterProvider
+     * @description
+     *
+     * Filters are just functions which transform input to an output. However filters need to be
+     * Dependency Injected. To achieve this a filter definition consists of a factory function which is
+     * annotated with dependencies and is responsible for creating a filter function.
+     *
+     * ```js
+     *   // Filter registration
+     *   function MyModule($provide, $filterProvider) {
+ *     // create a service to demonstrate injection (not always needed)
+ *     $provide.value('greet', function(name){
+ *       return 'Hello ' + name + '!';
+ *     });
+ *
+ *     // register a filter factory which uses the
+ *     // greet service to demonstrate DI.
+ *     $filterProvider.register('greet', function(greet){
+ *       // return the filter function which uses the greet service
+ *       // to generate salutation
+ *       return function(text) {
+ *         // filters need to be forgiving so check input validity
+ *         return text && greet(text) || text;
+ *       };
+ *     });
+ *   }
+     * ```
+     *
+     * The filter function is registered with the `$injector` under the filter name suffix with
+     * `Filter`.
+     *
+     * ```js
+     *   it('should be the same instance', inject(
+     *     function($filterProvider) {
+ *       $filterProvider.register('reverse', function(){
+ *         return ...;
+ *       });
+ *     },
+     *     function($filter, reverseFilter) {
+ *       expect($filter('reverse')).toBe(reverseFilter);
+ *     });
+     * ```
+     *
+     *
+     * For more information about how angular filters work, and how to create your own filters, see
+     * {@link guide/filter Filters} in the Angular Developer Guide.
+     */
+    /**
+     * @ngdoc method
+     * @name $filterProvider#register
+     * @description
+     * Register filter factory function.
+     *
+     * @param {String} name Name of the filter.
+     * @param {Function} fn The filter factory function which is injectable.
+     */
+
+
+    /**
+     * @ngdoc service
+     * @name $filter
+     * @function
+     * @description
+     * Filters are used for formatting data displayed to the user.
+     *
+     * The general syntax in templates is as follows:
+     *
+     *         {{ expression [| filter_name[:parameter_value] ... ] }}
+     *
+     * @param {String} name Name of the filter function to retrieve
+     * @return {Function} the filter function
+     */
+    $FilterProvider.$inject = ['$provide'];
+    function $FilterProvider($provide) {
+        var suffix = 'Filter';
+
+        /**
+         * @ngdoc method
+         * @name $controllerProvider#register
+         * @param {string|Object} name Name of the filter function, or an object map of filters where
+         *    the keys are the filter names and the values are the filter factories.
+         * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
+         *    of the registered filter instances.
+         */
+        function register(name, factory) {
+            if(isObject(name)) {
+                var filters = {};
+                forEach(name, function(filter, key) {
+                    filters[key] = register(key, filter);
+                });
+                return filters;
+            } else {
+                return $provide.factory(name + suffix, factory);
+            }
+        }
+        this.register = register;
+
+        this.$get = ['$injector', function($injector) {
+            return function(name) {
+                return $injector.get(name + suffix);
+            };
+        }];
+
+        ////////////////////////////////////////
+
+        /* global
+         currencyFilter: false,
+         dateFilter: false,
+         filterFilter: false,
+         jsonFilter: false,
+         limitToFilter: false,
+         lowercaseFilter: false,
+         numberFilter: false,
+         orderByFilter: false,
+         uppercaseFilter: false,
+         */
+
+        register('currency', currencyFilter);
+        register('date', dateFilter);
+        register('filter', filterFilter);
+        register('json', jsonFilter);
+        register('limitTo', limitToFilter);
+        register('lowercase', lowercaseFilter);
+        register('number', numberFilter);
+        register('orderBy', orderByFilter);
+        register('uppercase', uppercaseFilter);
+    }
+
+    /**
+     * @ngdoc filter
+     * @name filter
+     * @function
+     *
+     * @description
+     * Selects a subset of items from `array` and returns it as a new array.
+     *
+     * @param {Array} array The source array.
+     * @param {string|Object|function()} expression The predicate to be used for selecting items from
+     *   `array`.
+     *
+     *   Can be one of:
+     *
+     *   - `string`: The string is evaluated as an expression and the resulting value is used for substring match against
+     *     the contents of the `array`. All strings or objects with string properties in `array` that contain this string
+     *     will be returned. The predicate can be negated by prefixing the string with `!`.
+     *
+     *   - `Object`: A pattern object can be used to filter specific properties on objects contained
+     *     by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
+     *     which have property `name` containing "M" and property `phone` containing "1". A special
+     *     property name `$` can be used (as in `{$:"text"}`) to accept a match against any
+     *     property of the object. That's equivalent to the simple substring match with a `string`
+     *     as described above.
+     *
+     *   - `function(value)`: A predicate function can be used to write arbitrary filters. The function is
+     *     called for each element of `array`. The final result is an array of those elements that
+     *     the predicate returned true for.
+     *
+     * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+     *     determining if the expected value (from the filter expression) and actual value (from
+     *     the object in the array) should be considered a match.
+     *
+     *   Can be one of:
+     *
+     *     - `function(actual, expected)`:
+     *       The function will be given the object value and the predicate value to compare and
+     *       should return true if the item should be included in filtered result.
+     *
+     *     - `true`: A shorthand for `function(actual, expected) { return angular.equals(expected, actual)}`.
+     *       this is essentially strict comparison of expected and actual.
+     *
+     *     - `false|undefined`: A short hand for a function which will look for a substring match in case
+     *       insensitive way.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <div ng-init="friends = [{name:'John', phone:'555-1276'},
+     {name:'Mary', phone:'800-BIG-MARY'},
+     {name:'Mike', phone:'555-4321'},
+     {name:'Adam', phone:'555-5678'},
+     {name:'Julie', phone:'555-8765'},
+     {name:'Juliette', phone:'555-5678'}]"></div>
+
+     Search: <input ng-model="searchText">
+     <table id="searchTextResults">
+     <tr><th>Name</th><th>Phone</th></tr>
+     <tr ng-repeat="friend in friends | filter:searchText">
+     <td>{{friend.name}}</td>
+     <td>{{friend.phone}}</td>
+     </tr>
+     </table>
+     <hr>
+     Any: <input ng-model="search.$"> <br>
+     Name only <input ng-model="search.name"><br>
+     Phone only <input ng-model="search.phone"><br>
+     Equality <input type="checkbox" ng-model="strict"><br>
+     <table id="searchObjResults">
+     <tr><th>Name</th><th>Phone</th></tr>
+     <tr ng-repeat="friendObj in friends | filter:search:strict">
+     <td>{{friendObj.name}}</td>
+     <td>{{friendObj.phone}}</td>
+     </tr>
+     </table>
+     </file>
+     <file name="protractor.js" type="protractor">
+     var expectFriendNames = function(expectedNames, key) {
+         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
+           arr.forEach(function(wd, i) {
+             expect(wd.getText()).toMatch(expectedNames[i]);
+           });
+         });
+       };
+
+     it('should search across all fields when filtering with a string', function() {
+         var searchText = element(by.model('searchText'));
+         searchText.clear();
+         searchText.sendKeys('m');
+         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
+
+         searchText.clear();
+         searchText.sendKeys('76');
+         expectFriendNames(['John', 'Julie'], 'friend');
+       });
+
+     it('should search in specific fields when filtering with a predicate object', function() {
+         var searchAny = element(by.model('search.$'));
+         searchAny.clear();
+         searchAny.sendKeys('i');
+         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
+       });
+     it('should use a equal comparison when comparator is true', function() {
+         var searchName = element(by.model('search.name'));
+         var strict = element(by.model('strict'));
+         searchName.clear();
+         searchName.sendKeys('Julie');
+         strict.click();
+         expectFriendNames(['Julie'], 'friendObj');
+       });
+     </file>
+     </example>
+     */
+    function filterFilter() {
+        return function(array, expression, comparator) {
+            if (!isArray(array)) return array;
+
+            var comparatorType = typeof(comparator),
+                predicates = [];
+
+            predicates.check = function(value) {
+                for (var j = 0; j < predicates.length; j++) {
+                    if(!predicates[j](value)) {
+                        return false;
+                    }
+                }
+                return true;
+            };
+
+            if (comparatorType !== 'function') {
+                if (comparatorType === 'boolean' && comparator) {
+                    comparator = function(obj, text) {
+                        return angular.equals(obj, text);
+                    };
+                } else {
+                    comparator = function(obj, text) {
+                        if (obj && text && typeof obj === 'object' && typeof text === 'object') {
+                            for (var objKey in obj) {
+                                if (objKey.charAt(0) !== '$' && hasOwnProperty.call(obj, objKey) &&
+                                    comparator(obj[objKey], text[objKey])) {
+                                    return true;
+                                }
+                            }
+                            return false;
+                        }
+                        text = (''+text).toLowerCase();
+                        return (''+obj).toLowerCase().indexOf(text) > -1;
+                    };
+                }
+            }
+
+            var search = function(obj, text){
+                if (typeof text == 'string' && text.charAt(0) === '!') {
+                    return !search(obj, text.substr(1));
+                }
+                switch (typeof obj) {
+                    case "boolean":
+                    case "number":
+                    case "string":
+                        return comparator(obj, text);
+                    case "object":
+                        switch (typeof text) {
+                            case "object":
+                                return comparator(obj, text);
+                            default:
+                                for ( var objKey in obj) {
+                                    if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {
+                                        return true;
+                                    }
+                                }
+                                break;
+                        }
+                        return false;
+                    case "array":
+                        for ( var i = 0; i < obj.length; i++) {
+                            if (search(obj[i], text)) {
+                                return true;
+                            }
+                        }
+                        return false;
+                    default:
+                        return false;
+                }
+            };
+            switch (typeof expression) {
+                case "boolean":
+                case "number":
+                case "string":
+                    // Set up expression object and fall through
+                    expression = {$:expression};
+                // jshint -W086
+                case "object":
+                    // jshint +W086
+                    for (var key in expression) {
+                        (function(path) {
+                            if (typeof expression[path] == 'undefined') return;
+                            predicates.push(function(value) {
+                                return search(path == '$' ? value : (value && value[path]), expression[path]);
+                            });
+                        })(key);
+                    }
+                    break;
+                case 'function':
+                    predicates.push(expression);
+                    break;
+                default:
+                    return array;
+            }
+            var filtered = [];
+            for ( var j = 0; j < array.length; j++) {
+                var value = array[j];
+                if (predicates.check(value)) {
+                    filtered.push(value);
+                }
+            }
+            return filtered;
+        };
+    }
+
+    /**
+     * @ngdoc filter
+     * @name currency
+     * @function
+     *
+     * @description
+     * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
+     * symbol for current locale is used.
+     *
+     * @param {number} amount Input to filter.
+     * @param {string=} symbol Currency symbol or identifier to be displayed.
+     * @returns {string} Formatted number.
+     *
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.amount = 1234.56;
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     <input type="number" ng-model="amount"> <br>
+     default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
+     custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should init with 1234.56', function() {
+         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
+         expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('USD$1,234.56');
+       });
+     it('should update', function() {
+         if (browser.params.browser == 'safari') {
+           // Safari does not understand the minus key. See
+           // https://github.com/angular/protractor/issues/481
+           return;
+         }
+         element(by.model('amount')).clear();
+         element(by.model('amount')).sendKeys('-1234');
+         expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');
+         expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('(USD$1,234.00)');
+       });
+     </file>
+     </example>
+     */
+    currencyFilter.$inject = ['$locale'];
+    function currencyFilter($locale) {
+        var formats = $locale.NUMBER_FORMATS;
+        return function(amount, currencySymbol){
+            if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM;
+            return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2).
+                replace(/\u00A4/g, currencySymbol);
+        };
+    }
+
+    /**
+     * @ngdoc filter
+     * @name number
+     * @function
+     *
+     * @description
+     * Formats a number as text.
+     *
+     * If the input is not a number an empty string is returned.
+     *
+     * @param {number|string} number Number to format.
+     * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
+     * If this is not provided then the fraction size is computed from the current locale's number
+     * formatting pattern. In the case of the default locale, it will be 3.
+     * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.val = 1234.56789;
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     Enter number: <input ng-model='val'><br>
+     Default formatting: <span id='number-default'>{{val | number}}</span><br>
+     No fractions: <span>{{val | number:0}}</span><br>
+     Negative number: <span>{{-val | number:4}}</span>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should format numbers', function() {
+         expect(element(by.id('number-default')).getText()).toBe('1,234.568');
+         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
+         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
+       });
+
+     it('should update', function() {
+         element(by.model('val')).clear();
+         element(by.model('val')).sendKeys('3374.333');
+         expect(element(by.id('number-default')).getText()).toBe('3,374.333');
+         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
+         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
+      });
+     </file>
+     </example>
+     */
+
+
+    numberFilter.$inject = ['$locale'];
+    function numberFilter($locale) {
+        var formats = $locale.NUMBER_FORMATS;
+        return function(number, fractionSize) {
+            return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
+                fractionSize);
+        };
+    }
+
+    var DECIMAL_SEP = '.';
+    function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
+        if (number == null || !isFinite(number) || isObject(number)) return '';
+
+        var isNegative = number < 0;
+        number = Math.abs(number);
+        var numStr = number + '',
+            formatedText = '',
+            parts = [];
+
+        var hasExponent = false;
+        if (numStr.indexOf('e') !== -1) {
+            var match = numStr.match(/([\d\.]+)e(-?)(\d+)/);
+            if (match && match[2] == '-' && match[3] > fractionSize + 1) {
+                numStr = '0';
+            } else {
+                formatedText = numStr;
+                hasExponent = true;
+            }
+        }
+
+        if (!hasExponent) {
+            var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length;
+
+            // determine fractionSize if it is not specified
+            if (isUndefined(fractionSize)) {
+                fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac);
+            }
+
+            var pow = Math.pow(10, fractionSize);
+            number = Math.round(number * pow) / pow;
+            var fraction = ('' + number).split(DECIMAL_SEP);
+            var whole = fraction[0];
+            fraction = fraction[1] || '';
+
+            var i, pos = 0,
+                lgroup = pattern.lgSize,
+                group = pattern.gSize;
+
+            if (whole.length >= (lgroup + group)) {
+                pos = whole.length - lgroup;
+                for (i = 0; i < pos; i++) {
+                    if ((pos - i)%group === 0 && i !== 0) {
+                        formatedText += groupSep;
+                    }
+                    formatedText += whole.charAt(i);
+                }
+            }
+
+            for (i = pos; i < whole.length; i++) {
+                if ((whole.length - i)%lgroup === 0 && i !== 0) {
+                    formatedText += groupSep;
+                }
+                formatedText += whole.charAt(i);
+            }
+
+            // format fraction part.
+            while(fraction.length < fractionSize) {
+                fraction += '0';
+            }
+
+            if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize);
+        } else {
+
+            if (fractionSize > 0 && number > -1 && number < 1) {
+                formatedText = number.toFixed(fractionSize);
+            }
+        }
+
+        parts.push(isNegative ? pattern.negPre : pattern.posPre);
+        parts.push(formatedText);
+        parts.push(isNegative ? pattern.negSuf : pattern.posSuf);
+        return parts.join('');
+    }
+
+    function padNumber(num, digits, trim) {
+        var neg = '';
+        if (num < 0) {
+            neg =  '-';
+            num = -num;
+        }
+        num = '' + num;
+        while(num.length < digits) num = '0' + num;
+        if (trim)
+            num = num.substr(num.length - digits);
+        return neg + num;
+    }
+
+
+    function dateGetter(name, size, offset, trim) {
+        offset = offset || 0;
+        return function(date) {
+            var value = date['get' + name]();
+            if (offset > 0 || value > -offset)
+                value += offset;
+            if (value === 0 && offset == -12 ) value = 12;
+            return padNumber(value, size, trim);
+        };
+    }
+
+    function dateStrGetter(name, shortForm) {
+        return function(date, formats) {
+            var value = date['get' + name]();
+            var get = uppercase(shortForm ? ('SHORT' + name) : name);
+
+            return formats[get][value];
+        };
+    }
+
+    function timeZoneGetter(date) {
+        var zone = -1 * date.getTimezoneOffset();
+        var paddedZone = (zone >= 0) ? "+" : "";
+
+        paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
+        padNumber(Math.abs(zone % 60), 2);
+
+        return paddedZone;
+    }
+
+    function ampmGetter(date, formats) {
+        return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
+    }
+
+    var DATE_FORMATS = {
+        yyyy: dateGetter('FullYear', 4),
+        yy: dateGetter('FullYear', 2, 0, true),
+        y: dateGetter('FullYear', 1),
+        MMMM: dateStrGetter('Month'),
+        MMM: dateStrGetter('Month', true),
+        MM: dateGetter('Month', 2, 1),
+        M: dateGetter('Month', 1, 1),
+        dd: dateGetter('Date', 2),
+        d: dateGetter('Date', 1),
+        HH: dateGetter('Hours', 2),
+        H: dateGetter('Hours', 1),
+        hh: dateGetter('Hours', 2, -12),
+        h: dateGetter('Hours', 1, -12),
+        mm: dateGetter('Minutes', 2),
+        m: dateGetter('Minutes', 1),
+        ss: dateGetter('Seconds', 2),
+        s: dateGetter('Seconds', 1),
+        // while ISO 8601 requires fractions to be prefixed with `.` or `,`
+        // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions
+        sss: dateGetter('Milliseconds', 3),
+        EEEE: dateStrGetter('Day'),
+        EEE: dateStrGetter('Day', true),
+        a: ampmGetter,
+        Z: timeZoneGetter
+    };
+
+    var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
+        NUMBER_STRING = /^\-?\d+$/;
+
+    /**
+     * @ngdoc filter
+     * @name date
+     * @function
+     *
+     * @description
+     *   Formats `date` to a string based on the requested `format`.
+     *
+     *   `format` string can be composed of the following elements:
+     *
+     *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
+     *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
+     *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
+     *   * `'MMMM'`: Month in year (January-December)
+     *   * `'MMM'`: Month in year (Jan-Dec)
+     *   * `'MM'`: Month in year, padded (01-12)
+     *   * `'M'`: Month in year (1-12)
+     *   * `'dd'`: Day in month, padded (01-31)
+     *   * `'d'`: Day in month (1-31)
+     *   * `'EEEE'`: Day in Week,(Sunday-Saturday)
+     *   * `'EEE'`: Day in Week, (Sun-Sat)
+     *   * `'HH'`: Hour in day, padded (00-23)
+     *   * `'H'`: Hour in day (0-23)
+     *   * `'hh'`: Hour in am/pm, padded (01-12)
+     *   * `'h'`: Hour in am/pm, (1-12)
+     *   * `'mm'`: Minute in hour, padded (00-59)
+     *   * `'m'`: Minute in hour (0-59)
+     *   * `'ss'`: Second in minute, padded (00-59)
+     *   * `'s'`: Second in minute (0-59)
+     *   * `'.sss' or ',sss'`: Millisecond in second, padded (000-999)
+     *   * `'a'`: am/pm marker
+     *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
+     *
+     *   `format` string can also be one of the following predefined
+     *   {@link guide/i18n localizable formats}:
+     *
+     *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
+     *     (e.g. Sep 3, 2010 12:05:08 pm)
+     *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 pm)
+     *   * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US  locale
+     *     (e.g. Friday, September 3, 2010)
+     *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)
+     *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)
+     *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
+     *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm)
+     *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm)
+     *
+     *   `format` string can contain literal values. These need to be quoted with single quotes (e.g.
+     *   `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence
+     *   (e.g. `"h 'o''clock'"`).
+     *
+     * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
+     *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and its
+     *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+     *    specified in the string input, the time is considered to be in the local timezone.
+     * @param {string=} format Formatting rules (see Description). If not specified,
+     *    `mediumDate` is used.
+     * @returns {string} Formatted string or the input if input is not recognized as date/millis.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
+     <span>{{1288323623006 | date:'medium'}}</span><br>
+     <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
+     <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
+     <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
+     <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should format date', function() {
+         expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
+            toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
+         expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
+            toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
+         expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
+     toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
+     });
+     </file>
+     </example>
+     */
+    dateFilter.$inject = ['$locale'];
+    function dateFilter($locale) {
+
+
+        var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
+        // 1        2       3         4          5          6          7          8  9     10      11
+        function jsonStringToDate(string) {
+            var match;
+            if (match = string.match(R_ISO8601_STR)) {
+                var date = new Date(0),
+                    tzHour = 0,
+                    tzMin  = 0,
+                    dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
+                    timeSetter = match[8] ? date.setUTCHours : date.setHours;
+
+                if (match[9]) {
+                    tzHour = int(match[9] + match[10]);
+                    tzMin = int(match[9] + match[11]);
+                }
+                dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3]));
+                var h = int(match[4]||0) - tzHour;
+                var m = int(match[5]||0) - tzMin;
+                var s = int(match[6]||0);
+                var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000);
+                timeSetter.call(date, h, m, s, ms);
+                return date;
+            }
+            return string;
+        }
+
+
+        return function(date, format) {
+            var text = '',
+                parts = [],
+                fn, match;
+
+            format = format || 'mediumDate';
+            format = $locale.DATETIME_FORMATS[format] || format;
+            if (isString(date)) {
+                if (NUMBER_STRING.test(date)) {
+                    date = int(date);
+                } else {
+                    date = jsonStringToDate(date);
+                }
+            }
+
+            if (isNumber(date)) {
+                date = new Date(date);
+            }
+
+            if (!isDate(date)) {
+                return date;
+            }
+
+            while(format) {
+                match = DATE_FORMATS_SPLIT.exec(format);
+                if (match) {
+                    parts = concat(parts, match, 1);
+                    format = parts.pop();
+                } else {
+                    parts.push(format);
+                    format = null;
+                }
+            }
+
+            forEach(parts, function(value){
+                fn = DATE_FORMATS[value];
+                text += fn ? fn(date, $locale.DATETIME_FORMATS)
+                    : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
+            });
+
+            return text;
+        };
+    }
+
+
+    /**
+     * @ngdoc filter
+     * @name json
+     * @function
+     *
+     * @description
+     *   Allows you to convert a JavaScript object into JSON string.
+     *
+     *   This filter is mostly useful for debugging. When using the double curly {{value}} notation
+     *   the binding is automatically converted to JSON.
+     *
+     * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
+     * @returns {string} JSON string.
+     *
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <pre>{{ {'name':'value'} | json }}</pre>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should jsonify filtered objects', function() {
+         expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n  "name": ?"value"\n}/);
+       });
+     </file>
+     </example>
+     *
+     */
+    function jsonFilter() {
+        return function(object) {
+            return toJson(object, true);
+        };
+    }
+
+
+    /**
+     * @ngdoc filter
+     * @name lowercase
+     * @function
+     * @description
+     * Converts string to lowercase.
+     * @see angular.lowercase
+     */
+    var lowercaseFilter = valueFn(lowercase);
+
+
+    /**
+     * @ngdoc filter
+     * @name uppercase
+     * @function
+     * @description
+     * Converts string to uppercase.
+     * @see angular.uppercase
+     */
+    var uppercaseFilter = valueFn(uppercase);
+
+    /**
+     * @ngdoc filter
+     * @name limitTo
+     * @function
+     *
+     * @description
+     * Creates a new array or string containing only a specified number of elements. The elements
+     * are taken from either the beginning or the end of the source array or string, as specified by
+     * the value and sign (positive or negative) of `limit`.
+     *
+     * @param {Array|string} input Source array or string to be limited.
+     * @param {string|number} limit The length of the returned array or string. If the `limit` number
+     *     is positive, `limit` number of items from the beginning of the source array/string are copied.
+     *     If the number is negative, `limit` number  of items from the end of the source array/string
+     *     are copied. The `limit` will be trimmed if it exceeds `array.length`
+     * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
+     *     had less than `limit` elements.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.numbers = [1,2,3,4,5,6,7,8,9];
+           $scope.letters = "abcdefghi";
+           $scope.numLimit = 3;
+           $scope.letterLimit = 3;
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
+     <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
+     Limit {{letters}} to: <input type="integer" ng-model="letterLimit">
+     <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     var numLimitInput = element(by.model('numLimit'));
+     var letterLimitInput = element(by.model('letterLimit'));
+     var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
+     var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
+
+     it('should limit the number array to first three items', function() {
+         expect(numLimitInput.getAttribute('value')).toBe('3');
+         expect(letterLimitInput.getAttribute('value')).toBe('3');
+         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
+         expect(limitedLetters.getText()).toEqual('Output letters: abc');
+       });
+
+     it('should update the output when -3 is entered', function() {
+         numLimitInput.clear();
+         numLimitInput.sendKeys('-3');
+         letterLimitInput.clear();
+         letterLimitInput.sendKeys('-3');
+         expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
+         expect(limitedLetters.getText()).toEqual('Output letters: ghi');
+       });
+
+     it('should not exceed the maximum size of input array', function() {
+         numLimitInput.clear();
+         numLimitInput.sendKeys('100');
+         letterLimitInput.clear();
+         letterLimitInput.sendKeys('100');
+         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
+         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
+       });
+     </file>
+     </example>
+     */
+    function limitToFilter(){
+        return function(input, limit) {
+            if (!isArray(input) && !isString(input)) return input;
+
+            limit = int(limit);
+
+            if (isString(input)) {
+                //NaN check on limit
+                if (limit) {
+                    return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length);
+                } else {
+                    return "";
+                }
+            }
+
+            var out = [],
+                i, n;
+
+            // if abs(limit) exceeds maximum length, trim it
+            if (limit > input.length)
+                limit = input.length;
+            else if (limit < -input.length)
+                limit = -input.length;
+
+            if (limit > 0) {
+                i = 0;
+                n = limit;
+            } else {
+                i = input.length + limit;
+                n = input.length;
+            }
+
+            for (; i<n; i++) {
+                out.push(input[i]);
+            }
+
+            return out;
+        };
+    }
+
+    /**
+     * @ngdoc filter
+     * @name orderBy
+     * @function
+     *
+     * @description
+     * Orders a specified `array` by the `expression` predicate.
+     *
+     * @param {Array} array The array to sort.
+     * @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be
+     *    used by the comparator to determine the order of elements.
+     *
+     *    Can be one of:
+     *
+     *    - `function`: Getter function. The result of this function will be sorted using the
+     *      `<`, `=`, `>` operator.
+     *    - `string`: An Angular expression which evaluates to an object to order by, such as 'name'
+     *      to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control
+     *      ascending or descending sort order (for example, +name or -name).
+     *    - `Array`: An array of function or string predicates. The first predicate in the array
+     *      is used for sorting, but when two items are equivalent, the next predicate is used.
+     *
+     * @param {boolean=} reverse Reverse the order of the array.
+     * @returns {Array} Sorted copy of the source array.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.friends =
+               [{name:'John', phone:'555-1212', age:10},
+                {name:'Mary', phone:'555-9876', age:19},
+                {name:'Mike', phone:'555-4321', age:21},
+                {name:'Adam', phone:'555-5678', age:35},
+                {name:'Julie', phone:'555-8765', age:29}]
+           $scope.predicate = '-age';
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+     <hr/>
+     [ <a href="" ng-click="predicate=''">unsorted</a> ]
+     <table class="friend">
+     <tr>
+     <th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a>
+     (<a href="" ng-click="predicate = '-name'; reverse=false">^</a>)</th>
+     <th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th>
+     <th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th>
+     </tr>
+     <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
+     <td>{{friend.name}}</td>
+     <td>{{friend.phone}}</td>
+     <td>{{friend.age}}</td>
+     </tr>
+     </table>
+     </div>
+     </file>
+     </example>
+     */
+    orderByFilter.$inject = ['$parse'];
+    function orderByFilter($parse){
+        return function(array, sortPredicate, reverseOrder) {
+            if (!isArray(array)) return array;
+            if (!sortPredicate) return array;
+            sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
+            sortPredicate = map(sortPredicate, function(predicate){
+                var descending = false, get = predicate || identity;
+                if (isString(predicate)) {
+                    if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+                        descending = predicate.charAt(0) == '-';
+                        predicate = predicate.substring(1);
+                    }
+                    get = $parse(predicate);
+                    if (get.constant) {
+                        var key = get();
+                        return reverseComparator(function(a,b) {
+                            return compare(a[key], b[key]);
+                        }, descending);
+                    }
+                }
+                return reverseComparator(function(a,b){
+                    return compare(get(a),get(b));
+                }, descending);
+            });
+            var arrayCopy = [];
+            for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
+            return arrayCopy.sort(reverseComparator(comparator, reverseOrder));
+
+            function comparator(o1, o2){
+                for ( var i = 0; i < sortPredicate.length; i++) {
+                    var comp = sortPredicate[i](o1, o2);
+                    if (comp !== 0) return comp;
+                }
+                return 0;
+            }
+            function reverseComparator(comp, descending) {
+                return toBoolean(descending)
+                    ? function(a,b){return comp(b,a);}
+                    : comp;
+            }
+            function compare(v1, v2){
+                var t1 = typeof v1;
+                var t2 = typeof v2;
+                if (t1 == t2) {
+                    if (t1 == "string") {
+                        v1 = v1.toLowerCase();
+                        v2 = v2.toLowerCase();
+                    }
+                    if (v1 === v2) return 0;
+                    return v1 < v2 ? -1 : 1;
+                } else {
+                    return t1 < t2 ? -1 : 1;
+                }
+            }
+        };
+    }
+
+    function ngDirective(directive) {
+        if (isFunction(directive)) {
+            directive = {
+                link: directive
+            };
+        }
+        directive.restrict = directive.restrict || 'AC';
+        return valueFn(directive);
+    }
+
+    /**
+     * @ngdoc directive
+     * @name a
+     * @restrict E
+     *
+     * @description
+     * Modifies the default behavior of the html A tag so that the default action is prevented when
+     * the href attribute is empty.
+     *
+     * This change permits the easy creation of action links with the `ngClick` directive
+     * without changing the location or causing page reloads, e.g.:
+     * `<a href="" ng-click="list.addItem()">Add Item</a>`
+     */
+    var htmlAnchorDirective = valueFn({
+        restrict: 'E',
+        compile: function(element, attr) {
+
+            if (msie <= 8) {
+
+                // turn <a href ng-click="..">link</a> into a stylable link in IE
+                // but only if it doesn't have name attribute, in which case it's an anchor
+                if (!attr.href && !attr.name) {
+                    attr.$set('href', '');
+                }
+
+                // add a comment node to anchors to workaround IE bug that causes element content to be reset
+                // to new attribute content if attribute is updated with value containing @ and element also
+                // contains value with @
+                // see issue #1949
+                element.append(document.createComment('IE fix'));
+            }
+
+            if (!attr.href && !attr.xlinkHref && !attr.name) {
+                return function(scope, element) {
+                    // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
+                    var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
+                        'xlink:href' : 'href';
+                    element.on('click', function(event){
+                        // if we have no href url, then don't navigate anywhere.
+                        if (!element.attr(href)) {
+                            event.preventDefault();
+                        }
+                    });
+                };
+            }
+        }
+    });
+
+    /**
+     * @ngdoc directive
+     * @name ngHref
+     * @restrict A
+     * @priority 99
+     *
+     * @description
+     * Using Angular markup like `{{hash}}` in an href attribute will
+     * make the link go to the wrong URL if the user clicks it before
+     * Angular has a chance to replace the `{{hash}}` markup with its
+     * value. Until Angular replaces the markup the link will be broken
+     * and will most likely return a 404 error.
+     *
+     * The `ngHref` directive solves this problem.
+     *
+     * The wrong way to write it:
+     * ```html
+     * <a href="http://www.gravatar.com/avatar/{{hash}}"/>
+     * ```
+     *
+     * The correct way to write it:
+     * ```html
+     * <a ng-href="http://www.gravatar.com/avatar/{{hash}}"/>
+     * ```
+     *
+     * @element A
+     * @param {template} ngHref any string which can contain `{{}}` markup.
+     *
+     * @example
+     * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
+     * in links and their different behaviors:
+     <example>
+     <file name="index.html">
+     <input ng-model="value" /><br />
+     <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
+     <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
+     <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
+     <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
+     <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
+     <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should execute ng-click but not reload when href without value', function() {
+          element(by.id('link-1')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('1');
+          expect(element(by.id('link-1')).getAttribute('href')).toBe('');
+        });
+
+     it('should execute ng-click but not reload when href empty string', function() {
+          element(by.id('link-2')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('2');
+          expect(element(by.id('link-2')).getAttribute('href')).toBe('');
+        });
+
+     it('should execute ng-click and change url when ng-href specified', function() {
+          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
+
+          element(by.id('link-3')).click();
+
+          // At this point, we navigate away from an Angular page, so we need
+          // to use browser.driver to get the base webdriver.
+
+          browser.wait(function() {
+            return browser.driver.getCurrentUrl().then(function(url) {
+              return url.match(/\/123$/);
+            });
+          }, 1000, 'page should navigate to /123');
+        });
+
+     xit('should execute ng-click but not reload when href empty string and name specified', function() {
+          element(by.id('link-4')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('4');
+          expect(element(by.id('link-4')).getAttribute('href')).toBe('');
+        });
+
+     it('should execute ng-click but not reload when no href but name specified', function() {
+          element(by.id('link-5')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('5');
+          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
+        });
+
+     it('should only change url when only ng-href', function() {
+          element(by.model('value')).clear();
+          element(by.model('value')).sendKeys('6');
+          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
+
+          element(by.id('link-6')).click();
+
+          // At this point, we navigate away from an Angular page, so we need
+          // to use browser.driver to get the base webdriver.
+          browser.wait(function() {
+            return browser.driver.getCurrentUrl().then(function(url) {
+              return url.match(/\/6$/);
+            });
+          }, 1000, 'page should navigate to /6');
+        });
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngSrc
+     * @restrict A
+     * @priority 99
+     *
+     * @description
+     * Using Angular markup like `{{hash}}` in a `src` attribute doesn't
+     * work right: The browser will fetch from the URL with the literal
+     * text `{{hash}}` until Angular replaces the expression inside
+     * `{{hash}}`. The `ngSrc` directive solves this problem.
+     *
+     * The buggy way to write it:
+     * ```html
+     * <img src="http://www.gravatar.com/avatar/{{hash}}"/>
+     * ```
+     *
+     * The correct way to write it:
+     * ```html
+     * <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>
+     * ```
+     *
+     * @element IMG
+     * @param {template} ngSrc any string which can contain `{{}}` markup.
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngSrcset
+     * @restrict A
+     * @priority 99
+     *
+     * @description
+     * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
+     * work right: The browser will fetch from the URL with the literal
+     * text `{{hash}}` until Angular replaces the expression inside
+     * `{{hash}}`. The `ngSrcset` directive solves this problem.
+     *
+     * The buggy way to write it:
+     * ```html
+     * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/>
+     * ```
+     *
+     * The correct way to write it:
+     * ```html
+     * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/>
+     * ```
+     *
+     * @element IMG
+     * @param {template} ngSrcset any string which can contain `{{}}` markup.
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngDisabled
+     * @restrict A
+     * @priority 100
+     *
+     * @description
+     *
+     * The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:
+     * ```html
+     * <div ng-init="scope = { isDisabled: false }">
+     *  <button disabled="{{scope.isDisabled}}">Disabled</button>
+     * </div>
+     * ```
+     *
+     * The HTML specification does not require browsers to preserve the values of boolean attributes
+     * such as disabled. (Their presence means true and their absence means false.)
+     * If we put an Angular interpolation expression into such an attribute then the
+     * binding information would be lost when the browser removes the attribute.
+     * The `ngDisabled` directive solves this problem for the `disabled` attribute.
+     * This complementary directive is not removed by the browser and so provides
+     * a permanent reliable place to store the binding information.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     Click me to toggle: <input type="checkbox" ng-model="checked"><br/>
+     <button ng-model="button" ng-disabled="checked">Button</button>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should toggle button', function() {
+          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
+          element(by.model('checked')).click();
+          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
+        });
+     </file>
+     </example>
+     *
+     * @element INPUT
+     * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
+     *     then special attribute "disabled" will be set on the element
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngChecked
+     * @restrict A
+     * @priority 100
+     *
+     * @description
+     * The HTML specification does not require browsers to preserve the values of boolean attributes
+     * such as checked. (Their presence means true and their absence means false.)
+     * If we put an Angular interpolation expression into such an attribute then the
+     * binding information would be lost when the browser removes the attribute.
+     * The `ngChecked` directive solves this problem for the `checked` attribute.
+     * This complementary directive is not removed by the browser and so provides
+     * a permanent reliable place to store the binding information.
+     * @example
+     <example>
+     <file name="index.html">
+     Check me to check both: <input type="checkbox" ng-model="master"><br/>
+     <input id="checkSlave" type="checkbox" ng-checked="master">
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check both checkBoxes', function() {
+          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
+          element(by.model('master')).click();
+          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
+        });
+     </file>
+     </example>
+     *
+     * @element INPUT
+     * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,
+     *     then special attribute "checked" will be set on the element
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngReadonly
+     * @restrict A
+     * @priority 100
+     *
+     * @description
+     * The HTML specification does not require browsers to preserve the values of boolean attributes
+     * such as readonly. (Their presence means true and their absence means false.)
+     * If we put an Angular interpolation expression into such an attribute then the
+     * binding information would be lost when the browser removes the attribute.
+     * The `ngReadonly` directive solves this problem for the `readonly` attribute.
+     * This complementary directive is not removed by the browser and so provides
+     * a permanent reliable place to store the binding information.
+     * @example
+     <example>
+     <file name="index.html">
+     Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/>
+     <input type="text" ng-readonly="checked" value="I'm Angular"/>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should toggle readonly attr', function() {
+          expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
+          element(by.model('checked')).click();
+          expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
+        });
+     </file>
+     </example>
+     *
+     * @element INPUT
+     * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,
+     *     then special attribute "readonly" will be set on the element
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngSelected
+     * @restrict A
+     * @priority 100
+     *
+     * @description
+     * The HTML specification does not require browsers to preserve the values of boolean attributes
+     * such as selected. (Their presence means true and their absence means false.)
+     * If we put an Angular interpolation expression into such an attribute then the
+     * binding information would be lost when the browser removes the attribute.
+     * The `ngSelected` directive solves this problem for the `selected` attribute.
+     * This complementary directive is not removed by the browser and so provides
+     * a permanent reliable place to store the binding information.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     Check me to select: <input type="checkbox" ng-model="selected"><br/>
+     <select>
+     <option>Hello!</option>
+     <option id="greet" ng-selected="selected">Greetings!</option>
+     </select>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should select Greetings!', function() {
+          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
+          element(by.model('selected')).click();
+          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
+        });
+     </file>
+     </example>
+     *
+     * @element OPTION
+     * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,
+     *     then special attribute "selected" will be set on the element
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngOpen
+     * @restrict A
+     * @priority 100
+     *
+     * @description
+     * The HTML specification does not require browsers to preserve the values of boolean attributes
+     * such as open. (Their presence means true and their absence means false.)
+     * If we put an Angular interpolation expression into such an attribute then the
+     * binding information would be lost when the browser removes the attribute.
+     * The `ngOpen` directive solves this problem for the `open` attribute.
+     * This complementary directive is not removed by the browser and so provides
+     * a permanent reliable place to store the binding information.
+     * @example
+     <example>
+     <file name="index.html">
+     Check me check multiple: <input type="checkbox" ng-model="open"><br/>
+     <details id="details" ng-open="open">
+     <summary>Show/Hide me</summary>
+     </details>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should toggle open', function() {
+           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
+           element(by.model('open')).click();
+           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
+         });
+     </file>
+     </example>
+     *
+     * @element DETAILS
+     * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,
+     *     then special attribute "open" will be set on the element
+     */
+
+    var ngAttributeAliasDirectives = {};
+
+
+// boolean attrs are evaluated
+    forEach(BOOLEAN_ATTR, function(propName, attrName) {
+        // binding to multiple is not supported
+        if (propName == "multiple") return;
+
+        var normalized = directiveNormalize('ng-' + attrName);
+        ngAttributeAliasDirectives[normalized] = function() {
+            return {
+                priority: 100,
+                link: function(scope, element, attr) {
+                    scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
+                        attr.$set(attrName, !!value);
+                    });
+                }
+            };
+        };
+    });
+
+
+// ng-src, ng-srcset, ng-href are interpolated
+    forEach(['src', 'srcset', 'href'], function(attrName) {
+        var normalized = directiveNormalize('ng-' + attrName);
+        ngAttributeAliasDirectives[normalized] = function() {
+            return {
+                priority: 99, // it needs to run after the attributes are interpolated
+                link: function(scope, element, attr) {
+                    var propName = attrName,
+                        name = attrName;
+
+                    if (attrName === 'href' &&
+                        toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
+                        name = 'xlinkHref';
+                        attr.$attr[name] = 'xlink:href';
+                        propName = null;
+                    }
+
+                    attr.$observe(normalized, function(value) {
+                        if (!value)
+                            return;
+
+                        attr.$set(name, value);
+
+                        // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+                        // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
+                        // to set the property as well to achieve the desired effect.
+                        // we use attr[attrName] value since $set can sanitize the url.
+                        if (msie && propName) element.prop(propName, attr[name]);
+                    });
+                }
+            };
+        };
+    });
+
+    /* global -nullFormCtrl */
+    var nullFormCtrl = {
+        $addControl: noop,
+        $removeControl: noop,
+        $setValidity: noop,
+        $setDirty: noop,
+        $setPristine: noop
+    };
+
+    /**
+     * @ngdoc type
+     * @name form.FormController
+     *
+     * @property {boolean} $pristine True if user has not interacted with the form yet.
+     * @property {boolean} $dirty True if user has already interacted with the form.
+     * @property {boolean} $valid True if all of the containing forms and controls are valid.
+     * @property {boolean} $invalid True if at least one containing control or form is invalid.
+     *
+     * @property {Object} $error Is an object hash, containing references to all invalid controls or
+     *  forms, where:
+     *
+     *  - keys are validation tokens (error names),
+     *  - values are arrays of controls or forms that are invalid for given error name.
+     *
+     *
+     *  Built-in validation tokens:
+     *
+     *  - `email`
+     *  - `max`
+     *  - `maxlength`
+     *  - `min`
+     *  - `minlength`
+     *  - `number`
+     *  - `pattern`
+     *  - `required`
+     *  - `url`
+     *
+     * @description
+     * `FormController` keeps track of all its controls and nested forms as well as state of them,
+     * such as being valid/invalid or dirty/pristine.
+     *
+     * Each {@link ng.directive:form form} directive creates an instance
+     * of `FormController`.
+     *
+     */
+//asks for $scope to fool the BC controller module
+    FormController.$inject = ['$element', '$attrs', '$scope', '$animate'];
+    function FormController(element, attrs, $scope, $animate) {
+        var form = this,
+            parentForm = element.parent().controller('form') || nullFormCtrl,
+            invalidCount = 0, // used to easily determine if we are valid
+            errors = form.$error = {},
+            controls = [];
+
+        // init state
+        form.$name = attrs.name || attrs.ngForm;
+        form.$dirty = false;
+        form.$pristine = true;
+        form.$valid = true;
+        form.$invalid = false;
+
+        parentForm.$addControl(form);
+
+        // Setup initial state of the control
+        element.addClass(PRISTINE_CLASS);
+        toggleValidCss(true);
+
+        // convenience method for easy toggling of classes
+        function toggleValidCss(isValid, validationErrorKey) {
+            validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+            $animate.removeClass(element, (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);
+            $animate.addClass(element, (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
+        }
+
+        /**
+         * @ngdoc method
+         * @name form.FormController#$addControl
+         *
+         * @description
+         * Register a control with the form.
+         *
+         * Input elements using ngModelController do this automatically when they are linked.
+         */
+        form.$addControl = function(control) {
+            // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
+            // and not added to the scope.  Now we throw an error.
+            assertNotHasOwnProperty(control.$name, 'input');
+            controls.push(control);
+
+            if (control.$name) {
+                form[control.$name] = control;
+            }
+        };
+
+        /**
+         * @ngdoc method
+         * @name form.FormController#$removeControl
+         *
+         * @description
+         * Deregister a control from the form.
+         *
+         * Input elements using ngModelController do this automatically when they are destroyed.
+         */
+        form.$removeControl = function(control) {
+            if (control.$name && form[control.$name] === control) {
+                delete form[control.$name];
+            }
+            forEach(errors, function(queue, validationToken) {
+                form.$setValidity(validationToken, true, control);
+            });
+
+            arrayRemove(controls, control);
+        };
+
+        /**
+         * @ngdoc method
+         * @name form.FormController#$setValidity
+         *
+         * @description
+         * Sets the validity of a form control.
+         *
+         * This method will also propagate to parent forms.
+         */
+        form.$setValidity = function(validationToken, isValid, control) {
+            var queue = errors[validationToken];
+
+            if (isValid) {
+                if (queue) {
+                    arrayRemove(queue, control);
+                    if (!queue.length) {
+                        invalidCount--;
+                        if (!invalidCount) {
+                            toggleValidCss(isValid);
+                            form.$valid = true;
+                            form.$invalid = false;
+                        }
+                        errors[validationToken] = false;
+                        toggleValidCss(true, validationToken);
+                        parentForm.$setValidity(validationToken, true, form);
+                    }
+                }
+
+            } else {
+                if (!invalidCount) {
+                    toggleValidCss(isValid);
+                }
+                if (queue) {
+                    if (includes(queue, control)) return;
+                } else {
+                    errors[validationToken] = queue = [];
+                    invalidCount++;
+                    toggleValidCss(false, validationToken);
+                    parentForm.$setValidity(validationToken, false, form);
+                }
+                queue.push(control);
+
+                form.$valid = false;
+                form.$invalid = true;
+            }
+        };
+
+        /**
+         * @ngdoc method
+         * @name form.FormController#$setDirty
+         *
+         * @description
+         * Sets the form to a dirty state.
+         *
+         * This method can be called to add the 'ng-dirty' class and set the form to a dirty
+         * state (ng-dirty class). This method will also propagate to parent forms.
+         */
+        form.$setDirty = function() {
+            $animate.removeClass(element, PRISTINE_CLASS);
+            $animate.addClass(element, DIRTY_CLASS);
+            form.$dirty = true;
+            form.$pristine = false;
+            parentForm.$setDirty();
+        };
+
+        /**
+         * @ngdoc method
+         * @name form.FormController#$setPristine
+         *
+         * @description
+         * Sets the form to its pristine state.
+         *
+         * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+         * state (ng-pristine class). This method will also propagate to all the controls contained
+         * in this form.
+         *
+         * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
+         * saving or resetting it.
+         */
+        form.$setPristine = function () {
+            $animate.removeClass(element, DIRTY_CLASS);
+            $animate.addClass(element, PRISTINE_CLASS);
+            form.$dirty = false;
+            form.$pristine = true;
+            forEach(controls, function(control) {
+                control.$setPristine();
+            });
+        };
+    }
+
+
+    /**
+     * @ngdoc directive
+     * @name ngForm
+     * @restrict EAC
+     *
+     * @description
+     * Nestable alias of {@link ng.directive:form `form`} directive. HTML
+     * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
+     * sub-group of controls needs to be determined.
+     *
+     * Note: the purpose of `ngForm` is to group controls,
+     * but not to be a replacement for the `<form>` tag with all of its capabilities
+     * (e.g. posting to the server, ...).
+     *
+     * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+     *                       related scope, under this name.
+     *
+     */
+
+    /**
+     * @ngdoc directive
+     * @name form
+     * @restrict E
+     *
+     * @description
+     * Directive that instantiates
+     * {@link form.FormController FormController}.
+     *
+     * If the `name` attribute is specified, the form controller is published onto the current scope under
+     * this name.
+     *
+     * # Alias: {@link ng.directive:ngForm `ngForm`}
+     *
+     * In Angular forms can be nested. This means that the outer form is valid when all of the child
+     * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+     * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
+     * `<form>` but can be nested.  This allows you to have nested forms, which is very useful when
+     * using Angular validation directives in forms that are dynamically generated using the
+     * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`
+     * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an
+     * `ngForm` directive and nest these in an outer `form` element.
+     *
+     *
+     * # CSS classes
+     *  - `ng-valid` is set if the form is valid.
+     *  - `ng-invalid` is set if the form is invalid.
+     *  - `ng-pristine` is set if the form is pristine.
+     *  - `ng-dirty` is set if the form is dirty.
+     *
+     * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+     *
+     *
+     * # Submitting a form and preventing the default action
+     *
+     * Since the role of forms in client-side Angular applications is different than in classical
+     * roundtrip apps, it is desirable for the browser not to translate the form submission into a full
+     * page reload that sends the data to the server. Instead some javascript logic should be triggered
+     * to handle the form submission in an application-specific way.
+     *
+     * For this reason, Angular prevents the default action (form submission to the server) unless the
+     * `<form>` element has an `action` attribute specified.
+     *
+     * You can use one of the following two ways to specify what javascript method should be called when
+     * a form is submitted:
+     *
+     * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
+     * - {@link ng.directive:ngClick ngClick} directive on the first
+     *  button or input field of type submit (input[type=submit])
+     *
+     * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+     * or {@link ng.directive:ngClick ngClick} directives.
+     * This is because of the following form submission rules in the HTML specification:
+     *
+     * - If a form has only one input field then hitting enter in this field triggers form submit
+     * (`ngSubmit`)
+     * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
+     * doesn't trigger submit
+     * - if a form has one or more input fields and one or more buttons or input[type=submit] then
+     * hitting enter in any of the input fields will trigger the click handler on the *first* button or
+     * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
+     *
+     * @param {string=} name Name of the form. If specified, the form controller will be published into
+     *                       related scope, under this name.
+     *
+     * ## Animation Hooks
+     *
+     * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
+     * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
+     * other validations that are performed within the form. Animations in ngForm are similar to how
+     * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well
+     * as JS animations.
+     *
+     * The following example shows a simple way to utilize CSS transitions to style a form element
+     * that has been rendered as invalid after it has been validated:
+     *
+     * <pre>
+     * //be sure to include ngAnimate as a module to hook into more
+     * //advanced animations
+     * .my-form {
+ *   transition:0.5s linear all;
+ *   background: white;
+ * }
+     * .my-form.ng-invalid {
+ *   background: red;
+ *   color:white;
+ * }
+     * </pre>
+     *
+     * @example
+     <example deps="angular-animate.js" animations="true" fixBase="true">
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.userType = 'guest';
+         }
+     </script>
+     <style>
+     .my-form {
+          -webkit-transition:all linear 0.5s;
+          transition:all linear 0.5s;
+          background: transparent;
+        }
+     .my-form.ng-invalid {
+          background: red;
+        }
+     </style>
+     <form name="myForm" ng-controller="Ctrl" class="my-form">
+     userType: <input name="input" ng-model="userType" required>
+     <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
+     <tt>userType = {{userType}}</tt><br>
+     <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
+     <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
+     <tt>myForm.$valid = {{myForm.$valid}}</tt><br>
+     <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
+     </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should initialize to model', function() {
+          var userType = element(by.binding('userType'));
+          var valid = element(by.binding('myForm.input.$valid'));
+
+          expect(userType.getText()).toContain('guest');
+          expect(valid.getText()).toContain('true');
+        });
+
+     it('should be invalid if empty', function() {
+          var userType = element(by.binding('userType'));
+          var valid = element(by.binding('myForm.input.$valid'));
+          var userInput = element(by.model('userType'));
+
+          userInput.clear();
+          userInput.sendKeys('');
+
+          expect(userType.getText()).toEqual('userType =');
+          expect(valid.getText()).toContain('false');
+        });
+     </file>
+     </example>
+     *
+     */
+    var formDirectiveFactory = function(isNgForm) {
+        return ['$timeout', function($timeout) {
+            var formDirective = {
+                name: 'form',
+                restrict: isNgForm ? 'EAC' : 'E',
+                controller: FormController,
+                compile: function() {
+                    return {
+                        pre: function(scope, formElement, attr, controller) {
+                            if (!attr.action) {
+                                // we can't use jq events because if a form is destroyed during submission the default
+                                // action is not prevented. see #1238
+                                //
+                                // IE 9 is not affected because it doesn't fire a submit event and try to do a full
+                                // page reload if the form was destroyed by submission of the form via a click handler
+                                // on a button in the form. Looks like an IE9 specific bug.
+                                var preventDefaultListener = function(event) {
+                                    event.preventDefault
+                                        ? event.preventDefault()
+                                        : event.returnValue = false; // IE
+                                };
+
+                                addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
+
+                                // unregister the preventDefault listener so that we don't not leak memory but in a
+                                // way that will achieve the prevention of the default action.
+                                formElement.on('$destroy', function() {
+                                    $timeout(function() {
+                                        removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
+                                    }, 0, false);
+                                });
+                            }
+
+                            var parentFormCtrl = formElement.parent().controller('form'),
+                                alias = attr.name || attr.ngForm;
+
+                            if (alias) {
+                                setter(scope, alias, controller, alias);
+                            }
+                            if (parentFormCtrl) {
+                                formElement.on('$destroy', function() {
+                                    parentFormCtrl.$removeControl(controller);
+                                    if (alias) {
+                                        setter(scope, alias, undefined, alias);
+                                    }
+                                    extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+                                });
+                            }
+                        }
+                    };
+                }
+            };
+
+            return formDirective;
+        }];
+    };
+
+    var formDirective = formDirectiveFactory();
+    var ngFormDirective = formDirectiveFactory(true);
+
+    /* global
+
+     -VALID_CLASS,
+     -INVALID_CLASS,
+     -PRISTINE_CLASS,
+     -DIRTY_CLASS
+     */
+
+    var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
+    var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;
+    var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
+
+    var inputType = {
+
+        /**
+         * @ngdoc input
+         * @name input[text]
+         *
+         * @description
+         * Standard HTML text input with angular data binding.
+         *
+         * @param {string} ngModel Assignable angular expression to data-bind to.
+         * @param {string=} name Property name of the form under which the control is published.
+         * @param {string=} required Adds `required` validation error key if the value is not entered.
+         * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+         *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+         *    `required` when you want to data-bind to the `required` attribute.
+         * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+         *    minlength.
+         * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+         *    maxlength.
+         * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+         *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+         *    patterns defined as scope expressions.
+         * @param {string=} ngChange Angular expression to be executed when input changes due to user
+         *    interaction with the input element.
+         * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+         *
+         * @example
+         <example name="text-input-directive">
+         <file name="index.html">
+         <script>
+         function Ctrl($scope) {
+             $scope.text = 'guest';
+             $scope.word = /^\s*\w*\s*$/;
+           }
+         </script>
+         <form name="myForm" ng-controller="Ctrl">
+         Single word: <input type="text" name="input" ng-model="text"
+         ng-pattern="word" required ng-trim="false">
+         <span class="error" ng-show="myForm.input.$error.required">
+         Required!</span>
+         <span class="error" ng-show="myForm.input.$error.pattern">
+         Single word only!</span>
+
+         <tt>text = {{text}}</tt><br/>
+         <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+         <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+         </form>
+         </file>
+         <file name="protractor.js" type="protractor">
+         var text = element(by.binding('text'));
+         var valid = element(by.binding('myForm.input.$valid'));
+         var input = element(by.model('text'));
+
+         it('should initialize to model', function() {
+            expect(text.getText()).toContain('guest');
+            expect(valid.getText()).toContain('true');
+          });
+
+         it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+
+            expect(text.getText()).toEqual('text =');
+            expect(valid.getText()).toContain('false');
+          });
+
+         it('should be invalid if multi word', function() {
+            input.clear();
+            input.sendKeys('hello world');
+
+            expect(valid.getText()).toContain('false');
+          });
+         </file>
+         </example>
+         */
+        'text': textInputType,
+
+
+        /**
+         * @ngdoc input
+         * @name input[number]
+         *
+         * @description
+         * Text input with number validation and transformation. Sets the `number` validation
+         * error if not a valid number.
+         *
+         * @param {string} ngModel Assignable angular expression to data-bind to.
+         * @param {string=} name Property name of the form under which the control is published.
+         * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+         * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+         * @param {string=} required Sets `required` validation error key if the value is not entered.
+         * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+         *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+         *    `required` when you want to data-bind to the `required` attribute.
+         * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+         *    minlength.
+         * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+         *    maxlength.
+         * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+         *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+         *    patterns defined as scope expressions.
+         * @param {string=} ngChange Angular expression to be executed when input changes due to user
+         *    interaction with the input element.
+         *
+         * @example
+         <example name="number-input-directive">
+         <file name="index.html">
+         <script>
+         function Ctrl($scope) {
+             $scope.value = 12;
+           }
+         </script>
+         <form name="myForm" ng-controller="Ctrl">
+         Number: <input type="number" name="input" ng-model="value"
+         min="0" max="99" required>
+         <span class="error" ng-show="myForm.input.$error.required">
+         Required!</span>
+         <span class="error" ng-show="myForm.input.$error.number">
+         Not valid number!</span>
+         <tt>value = {{value}}</tt><br/>
+         <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+         <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+         </form>
+         </file>
+         <file name="protractor.js" type="protractor">
+         var value = element(by.binding('value'));
+         var valid = element(by.binding('myForm.input.$valid'));
+         var input = element(by.model('value'));
+
+         it('should initialize to model', function() {
+            expect(value.getText()).toContain('12');
+            expect(valid.getText()).toContain('true');
+          });
+
+         it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+            expect(value.getText()).toEqual('value =');
+            expect(valid.getText()).toContain('false');
+          });
+
+         it('should be invalid if over max', function() {
+            input.clear();
+            input.sendKeys('123');
+            expect(value.getText()).toEqual('value =');
+            expect(valid.getText()).toContain('false');
+          });
+         </file>
+         </example>
+         */
+        'number': numberInputType,
+
+
+        /**
+         * @ngdoc input
+         * @name input[url]
+         *
+         * @description
+         * Text input with URL validation. Sets the `url` validation error key if the content is not a
+         * valid URL.
+         *
+         * @param {string} ngModel Assignable angular expression to data-bind to.
+         * @param {string=} name Property name of the form under which the control is published.
+         * @param {string=} required Sets `required` validation error key if the value is not entered.
+         * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+         *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+         *    `required` when you want to data-bind to the `required` attribute.
+         * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+         *    minlength.
+         * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+         *    maxlength.
+         * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+         *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+         *    patterns defined as scope expressions.
+         * @param {string=} ngChange Angular expression to be executed when input changes due to user
+         *    interaction with the input element.
+         *
+         * @example
+         <example name="url-input-directive">
+         <file name="index.html">
+         <script>
+         function Ctrl($scope) {
+             $scope.text = 'http://google.com';
+           }
+         </script>
+         <form name="myForm" ng-controller="Ctrl">
+         URL: <input type="url" name="input" ng-model="text" required>
+         <span class="error" ng-show="myForm.input.$error.required">
+         Required!</span>
+         <span class="error" ng-show="myForm.input.$error.url">
+         Not valid url!</span>
+         <tt>text = {{text}}</tt><br/>
+         <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+         <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+         <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
+         </form>
+         </file>
+         <file name="protractor.js" type="protractor">
+         var text = element(by.binding('text'));
+         var valid = element(by.binding('myForm.input.$valid'));
+         var input = element(by.model('text'));
+
+         it('should initialize to model', function() {
+            expect(text.getText()).toContain('http://google.com');
+            expect(valid.getText()).toContain('true');
+          });
+
+         it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+
+            expect(text.getText()).toEqual('text =');
+            expect(valid.getText()).toContain('false');
+          });
+
+         it('should be invalid if not url', function() {
+            input.clear();
+            input.sendKeys('box');
+
+            expect(valid.getText()).toContain('false');
+          });
+         </file>
+         </example>
+         */
+        'url': urlInputType,
+
+
+        /**
+         * @ngdoc input
+         * @name input[email]
+         *
+         * @description
+         * Text input with email validation. Sets the `email` validation error key if not a valid email
+         * address.
+         *
+         * @param {string} ngModel Assignable angular expression to data-bind to.
+         * @param {string=} name Property name of the form under which the control is published.
+         * @param {string=} required Sets `required` validation error key if the value is not entered.
+         * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+         *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+         *    `required` when you want to data-bind to the `required` attribute.
+         * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+         *    minlength.
+         * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+         *    maxlength.
+         * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+         *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+         *    patterns defined as scope expressions.
+         * @param {string=} ngChange Angular expression to be executed when input changes due to user
+         *    interaction with the input element.
+         *
+         * @example
+         <example name="email-input-directive">
+         <file name="index.html">
+         <script>
+         function Ctrl($scope) {
+             $scope.text = 'me@example.com';
+         }
+         </script>
+         <form name="myForm" ng-controller="Ctrl">
+         Email: <input type="email" name="input" ng-model="text" required>
+         <span class="error" ng-show="myForm.input.$error.required">
+         Required!</span>
+         <span class="error" ng-show="myForm.input.$error.email">
+         Not valid email!</span>
+         <tt>text = {{text}}</tt><br/>
+         <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+         <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+         <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
+         </form>
+         </file>
+         <file name="protractor.js" type="protractor">
+         var text = element(by.binding('text'));
+         var valid = element(by.binding('myForm.input.$valid'));
+         var input = element(by.model('text'));
+
+         it('should initialize to model', function() {
+            expect(text.getText()).toContain('me@example.com');
+         expect(valid.getText()).toContain('true');
+         });
+
+         it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+            expect(text.getText()).toEqual('text =');
+            expect(valid.getText()).toContain('false');
+          });
+
+         it('should be invalid if not email', function() {
+            input.clear();
+            input.sendKeys('xxx');
+
+            expect(valid.getText()).toContain('false');
+          });
+         </file>
+         </example>
+         */
+        'email': emailInputType,
+
+
+        /**
+         * @ngdoc input
+         * @name input[radio]
+         *
+         * @description
+         * HTML radio button.
+         *
+         * @param {string} ngModel Assignable angular expression to data-bind to.
+         * @param {string} value The value to which the expression should be set when selected.
+         * @param {string=} name Property name of the form under which the control is published.
+         * @param {string=} ngChange Angular expression to be executed when input changes due to user
+         *    interaction with the input element.
+         * @param {string} ngValue Angular expression which sets the value to which the expression should
+         *    be set when selected.
+         *
+         * @example
+         <example name="radio-input-directive">
+         <file name="index.html">
+         <script>
+         function Ctrl($scope) {
+             $scope.color = 'blue';
+             $scope.specialValue = {
+               "id": "12345",
+               "value": "green"
+             };
+           }
+         </script>
+         <form name="myForm" ng-controller="Ctrl">
+         <input type="radio" ng-model="color" value="red">  Red <br/>
+         <input type="radio" ng-model="color" ng-value="specialValue"> Green <br/>
+         <input type="radio" ng-model="color" value="blue"> Blue <br/>
+         <tt>color = {{color | json}}</tt><br/>
+         </form>
+         Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
+         </file>
+         <file name="protractor.js" type="protractor">
+         it('should change state', function() {
+            var color = element(by.binding('color'));
+
+            expect(color.getText()).toContain('blue');
+
+            element.all(by.model('color')).get(0).click();
+
+            expect(color.getText()).toContain('red');
+          });
+         </file>
+         </example>
+         */
+        'radio': radioInputType,
+
+
+        /**
+         * @ngdoc input
+         * @name input[checkbox]
+         *
+         * @description
+         * HTML checkbox.
+         *
+         * @param {string} ngModel Assignable angular expression to data-bind to.
+         * @param {string=} name Property name of the form under which the control is published.
+         * @param {string=} ngTrueValue The value to which the expression should be set when selected.
+         * @param {string=} ngFalseValue The value to which the expression should be set when not selected.
+         * @param {string=} ngChange Angular expression to be executed when input changes due to user
+         *    interaction with the input element.
+         *
+         * @example
+         <example name="checkbox-input-directive">
+         <file name="index.html">
+         <script>
+         function Ctrl($scope) {
+             $scope.value1 = true;
+             $scope.value2 = 'YES'
+           }
+         </script>
+         <form name="myForm" ng-controller="Ctrl">
+         Value1: <input type="checkbox" ng-model="value1"> <br/>
+         Value2: <input type="checkbox" ng-model="value2"
+         ng-true-value="YES" ng-false-value="NO"> <br/>
+         <tt>value1 = {{value1}}</tt><br/>
+         <tt>value2 = {{value2}}</tt><br/>
+         </form>
+         </file>
+         <file name="protractor.js" type="protractor">
+         it('should change state', function() {
+            var value1 = element(by.binding('value1'));
+            var value2 = element(by.binding('value2'));
+
+            expect(value1.getText()).toContain('true');
+            expect(value2.getText()).toContain('YES');
+
+            element(by.model('value1')).click();
+            element(by.model('value2')).click();
+
+            expect(value1.getText()).toContain('false');
+            expect(value2.getText()).toContain('NO');
+          });
+         </file>
+         </example>
+         */
+        'checkbox': checkboxInputType,
+
+        'hidden': noop,
+        'button': noop,
+        'submit': noop,
+        'reset': noop,
+        'file': noop
+    };
+
+// A helper function to call $setValidity and return the value / undefined,
+// a pattern that is repeated a lot in the input validation logic.
+    function validate(ctrl, validatorName, validity, value){
+        ctrl.$setValidity(validatorName, validity);
+        return validity ? value : undefined;
+    }
+
+
+    function addNativeHtml5Validators(ctrl, validatorName, element) {
+        var validity = element.prop('validity');
+        if (isObject(validity)) {
+            var validator = function(value) {
+                // Don't overwrite previous validation, don't consider valueMissing to apply (ng-required can
+                // perform the required validation)
+                if (!ctrl.$error[validatorName] && (validity.badInput || validity.customError ||
+                    validity.typeMismatch) && !validity.valueMissing) {
+                    ctrl.$setValidity(validatorName, false);
+                    return;
+                }
+                return value;
+            };
+            ctrl.$parsers.push(validator);
+        }
+    }
+
+    function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+        var validity = element.prop('validity');
+        // In composition mode, users are still inputing intermediate text buffer,
+        // hold the listener until composition is done.
+        // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
+        if (!$sniffer.android) {
+            var composing = false;
+
+            element.on('compositionstart', function(data) {
+                composing = true;
+            });
+
+            element.on('compositionend', function() {
+                composing = false;
+                listener();
+            });
+        }
+
+        var listener = function() {
+            if (composing) return;
+            var value = element.val();
+
+            // By default we will trim the value
+            // If the attribute ng-trim exists we will avoid trimming
+            // e.g. <input ng-model="foo" ng-trim="false">
+            if (toBoolean(attr.ngTrim || 'T')) {
+                value = trim(value);
+            }
+
+            if (ctrl.$viewValue !== value ||
+                    // If the value is still empty/falsy, and there is no `required` error, run validators
+                    // again. This enables HTML5 constraint validation errors to affect Angular validation
+                    // even when the first character entered causes an error.
+                (validity && value === '' && !validity.valueMissing)) {
+                if (scope.$$phase) {
+                    ctrl.$setViewValue(value);
+                } else {
+                    scope.$apply(function() {
+                        ctrl.$setViewValue(value);
+                    });
+                }
+            }
+        };
+
+        // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
+        // input event on backspace, delete or cut
+        if ($sniffer.hasEvent('input')) {
+            element.on('input', listener);
+        } else {
+            var timeout;
+
+            var deferListener = function() {
+                if (!timeout) {
+                    timeout = $browser.defer(function() {
+                        listener();
+                        timeout = null;
+                    });
+                }
+            };
+
+            element.on('keydown', function(event) {
+                var key = event.keyCode;
+
+                // ignore
+                //    command            modifiers                   arrows
+                if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
+
+                deferListener();
+            });
+
+            // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+            if ($sniffer.hasEvent('paste')) {
+                element.on('paste cut', deferListener);
+            }
+        }
+
+        // if user paste into input using mouse on older browser
+        // or form autocomplete on newer browser, we need "change" event to catch it
+        element.on('change', listener);
+
+        ctrl.$render = function() {
+            element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);
+        };
+
+        // pattern validator
+        var pattern = attr.ngPattern,
+            patternValidator,
+            match;
+
+        if (pattern) {
+            var validateRegex = function(regexp, value) {
+                return validate(ctrl, 'pattern', ctrl.$isEmpty(value) || regexp.test(value), value);
+            };
+            match = pattern.match(/^\/(.*)\/([gim]*)$/);
+            if (match) {
+                pattern = new RegExp(match[1], match[2]);
+                patternValidator = function(value) {
+                    return validateRegex(pattern, value);
+                };
+            } else {
+                patternValidator = function(value) {
+                    var patternObj = scope.$eval(pattern);
+
+                    if (!patternObj || !patternObj.test) {
+                        throw minErr('ngPattern')('noregexp',
+                            'Expected {0} to be a RegExp but was {1}. Element: {2}', pattern,
+                            patternObj, startingTag(element));
+                    }
+                    return validateRegex(patternObj, value);
+                };
+            }
+
+            ctrl.$formatters.push(patternValidator);
+            ctrl.$parsers.push(patternValidator);
+        }
+
+        // min length validator
+        if (attr.ngMinlength) {
+            var minlength = int(attr.ngMinlength);
+            var minLengthValidator = function(value) {
+                return validate(ctrl, 'minlength', ctrl.$isEmpty(value) || value.length >= minlength, value);
+            };
+
+            ctrl.$parsers.push(minLengthValidator);
+            ctrl.$formatters.push(minLengthValidator);
+        }
+
+        // max length validator
+        if (attr.ngMaxlength) {
+            var maxlength = int(attr.ngMaxlength);
+            var maxLengthValidator = function(value) {
+                return validate(ctrl, 'maxlength', ctrl.$isEmpty(value) || value.length <= maxlength, value);
+            };
+
+            ctrl.$parsers.push(maxLengthValidator);
+            ctrl.$formatters.push(maxLengthValidator);
+        }
+    }
+
+    function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+        textInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+        ctrl.$parsers.push(function(value) {
+            var empty = ctrl.$isEmpty(value);
+            if (empty || NUMBER_REGEXP.test(value)) {
+                ctrl.$setValidity('number', true);
+                return value === '' ? null : (empty ? value : parseFloat(value));
+            } else {
+                ctrl.$setValidity('number', false);
+                return undefined;
+            }
+        });
+
+        addNativeHtml5Validators(ctrl, 'number', element);
+
+        ctrl.$formatters.push(function(value) {
+            return ctrl.$isEmpty(value) ? '' : '' + value;
+        });
+
+        if (attr.min) {
+            var minValidator = function(value) {
+                var min = parseFloat(attr.min);
+                return validate(ctrl, 'min', ctrl.$isEmpty(value) || value >= min, value);
+            };
+
+            ctrl.$parsers.push(minValidator);
+            ctrl.$formatters.push(minValidator);
+        }
+
+        if (attr.max) {
+            var maxValidator = function(value) {
+                var max = parseFloat(attr.max);
+                return validate(ctrl, 'max', ctrl.$isEmpty(value) || value <= max, value);
+            };
+
+            ctrl.$parsers.push(maxValidator);
+            ctrl.$formatters.push(maxValidator);
+        }
+
+        ctrl.$formatters.push(function(value) {
+            return validate(ctrl, 'number', ctrl.$isEmpty(value) || isNumber(value), value);
+        });
+    }
+
+    function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+        textInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+        var urlValidator = function(value) {
+            return validate(ctrl, 'url', ctrl.$isEmpty(value) || URL_REGEXP.test(value), value);
+        };
+
+        ctrl.$formatters.push(urlValidator);
+        ctrl.$parsers.push(urlValidator);
+    }
+
+    function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+        textInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+        var emailValidator = function(value) {
+            return validate(ctrl, 'email', ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value), value);
+        };
+
+        ctrl.$formatters.push(emailValidator);
+        ctrl.$parsers.push(emailValidator);
+    }
+
+    function radioInputType(scope, element, attr, ctrl) {
+        // make the name unique, if not defined
+        if (isUndefined(attr.name)) {
+            element.attr('name', nextUid());
+        }
+
+        element.on('click', function() {
+            if (element[0].checked) {
+                scope.$apply(function() {
+                    ctrl.$setViewValue(attr.value);
+                });
+            }
+        });
+
+        ctrl.$render = function() {
+            var value = attr.value;
+            element[0].checked = (value == ctrl.$viewValue);
+        };
+
+        attr.$observe('value', ctrl.$render);
+    }
+
+    function checkboxInputType(scope, element, attr, ctrl) {
+        var trueValue = attr.ngTrueValue,
+            falseValue = attr.ngFalseValue;
+
+        if (!isString(trueValue)) trueValue = true;
+        if (!isString(falseValue)) falseValue = false;
+
+        element.on('click', function() {
+            scope.$apply(function() {
+                ctrl.$setViewValue(element[0].checked);
+            });
+        });
+
+        ctrl.$render = function() {
+            element[0].checked = ctrl.$viewValue;
+        };
+
+        // Override the standard `$isEmpty` because a value of `false` means empty in a checkbox.
+        ctrl.$isEmpty = function(value) {
+            return value !== trueValue;
+        };
+
+        ctrl.$formatters.push(function(value) {
+            return value === trueValue;
+        });
+
+        ctrl.$parsers.push(function(value) {
+            return value ? trueValue : falseValue;
+        });
+    }
+
+
+    /**
+     * @ngdoc directive
+     * @name textarea
+     * @restrict E
+     *
+     * @description
+     * HTML textarea element control with angular data-binding. The data-binding and validation
+     * properties of this element are exactly the same as those of the
+     * {@link ng.directive:input input element}.
+     *
+     * @param {string} ngModel Assignable angular expression to data-bind to.
+     * @param {string=} name Property name of the form under which the control is published.
+     * @param {string=} required Sets `required` validation error key if the value is not entered.
+     * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+     *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+     *    `required` when you want to data-bind to the `required` attribute.
+     * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+     *    minlength.
+     * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+     *    maxlength.
+     * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+     *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+     *    patterns defined as scope expressions.
+     * @param {string=} ngChange Angular expression to be executed when input changes due to user
+     *    interaction with the input element.
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name input
+     * @restrict E
+     *
+     * @description
+     * HTML input element control with angular data-binding. Input control follows HTML5 input types
+     * and polyfills the HTML5 validation behavior for older browsers.
+     *
+     * @param {string} ngModel Assignable angular expression to data-bind to.
+     * @param {string=} name Property name of the form under which the control is published.
+     * @param {string=} required Sets `required` validation error key if the value is not entered.
+     * @param {boolean=} ngRequired Sets `required` attribute if set to true
+     * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+     *    minlength.
+     * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+     *    maxlength.
+     * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the
+     *    RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
+     *    patterns defined as scope expressions.
+     * @param {string=} ngChange Angular expression to be executed when input changes due to user
+     *    interaction with the input element.
+     *
+     * @example
+     <example name="input-directive">
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.user = {name: 'guest', last: 'visitor'};
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     <form name="myForm">
+     User name: <input type="text" name="userName" ng-model="user.name" required>
+     <span class="error" ng-show="myForm.userName.$error.required">
+     Required!</span><br>
+     Last name: <input type="text" name="lastName" ng-model="user.last"
+     ng-minlength="3" ng-maxlength="10">
+     <span class="error" ng-show="myForm.lastName.$error.minlength">
+     Too short!</span>
+     <span class="error" ng-show="myForm.lastName.$error.maxlength">
+     Too long!</span><br>
+     </form>
+     <hr>
+     <tt>user = {{user}}</tt><br/>
+     <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>
+     <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>
+     <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>
+     <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>
+     <tt>myForm.$valid = {{myForm.$valid}}</tt><br>
+     <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
+     <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>
+     <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     var user = element(by.binding('{{user}}'));
+     var userNameValid = element(by.binding('myForm.userName.$valid'));
+     var lastNameValid = element(by.binding('myForm.lastName.$valid'));
+     var lastNameError = element(by.binding('myForm.lastName.$error'));
+     var formValid = element(by.binding('myForm.$valid'));
+     var userNameInput = element(by.model('user.name'));
+     var userLastInput = element(by.model('user.last'));
+
+     it('should initialize to model', function() {
+          expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
+          expect(userNameValid.getText()).toContain('true');
+          expect(formValid.getText()).toContain('true');
+        });
+
+     it('should be invalid if empty when required', function() {
+          userNameInput.clear();
+          userNameInput.sendKeys('');
+
+          expect(user.getText()).toContain('{"last":"visitor"}');
+          expect(userNameValid.getText()).toContain('false');
+          expect(formValid.getText()).toContain('false');
+        });
+
+     it('should be valid if empty when min length is set', function() {
+          userLastInput.clear();
+          userLastInput.sendKeys('');
+
+          expect(user.getText()).toContain('{"name":"guest","last":""}');
+          expect(lastNameValid.getText()).toContain('true');
+          expect(formValid.getText()).toContain('true');
+        });
+
+     it('should be invalid if less than required min length', function() {
+          userLastInput.clear();
+          userLastInput.sendKeys('xx');
+
+          expect(user.getText()).toContain('{"name":"guest"}');
+          expect(lastNameValid.getText()).toContain('false');
+          expect(lastNameError.getText()).toContain('minlength');
+          expect(formValid.getText()).toContain('false');
+        });
+
+     it('should be invalid if longer than max length', function() {
+          userLastInput.clear();
+          userLastInput.sendKeys('some ridiculously long name');
+
+          expect(user.getText()).toContain('{"name":"guest"}');
+          expect(lastNameValid.getText()).toContain('false');
+          expect(lastNameError.getText()).toContain('maxlength');
+          expect(formValid.getText()).toContain('false');
+        });
+     </file>
+     </example>
+     */
+    var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) {
+        return {
+            restrict: 'E',
+            require: '?ngModel',
+            link: function(scope, element, attr, ctrl) {
+                if (ctrl) {
+                    (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer,
+                        $browser);
+                }
+            }
+        };
+    }];
+
+    var VALID_CLASS = 'ng-valid',
+        INVALID_CLASS = 'ng-invalid',
+        PRISTINE_CLASS = 'ng-pristine',
+        DIRTY_CLASS = 'ng-dirty';
+
+    /**
+     * @ngdoc type
+     * @name ngModel.NgModelController
+     *
+     * @property {string} $viewValue Actual string value in the view.
+     * @property {*} $modelValue The value in the model, that the control is bound to.
+     * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
+     the control reads value from the DOM.  Each function is called, in turn, passing the value
+     through to the next. The last return value is used to populate the model.
+     Used to sanitize / convert the value as well as validation. For validation,
+     the parsers should update the validity state using
+     {@link ngModel.NgModelController#$setValidity $setValidity()},
+     and return `undefined` for invalid values.
+
+     *
+     * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
+     the model value changes. Each function is called, in turn, passing the value through to the
+     next. Used to format / convert values for display in the control and validation.
+     *      ```js
+     *      function formatter(value) {
+ *        if (value) {
+ *          return value.toUpperCase();
+ *        }
+ *      }
+     *      ngModel.$formatters.push(formatter);
+     *      ```
+     *
+     * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
+     *     view value has changed. It is called with no arguments, and its return value is ignored.
+     *     This can be used in place of additional $watches against the model value.
+     *
+     * @property {Object} $error An object hash with all errors as keys.
+     *
+     * @property {boolean} $pristine True if user has not interacted with the control yet.
+     * @property {boolean} $dirty True if user has already interacted with the control.
+     * @property {boolean} $valid True if there is no error.
+     * @property {boolean} $invalid True if at least one error on the control.
+     *
+     * @description
+     *
+     * `NgModelController` provides API for the `ng-model` directive. The controller contains
+     * services for data-binding, validation, CSS updates, and value formatting and parsing. It
+     * purposefully does not contain any logic which deals with DOM rendering or listening to
+     * DOM events. Such DOM related logic should be provided by other directives which make use of
+     * `NgModelController` for data-binding.
+     *
+     * ## Custom Control Example
+     * This example shows how to use `NgModelController` with a custom control to achieve
+     * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
+     * collaborate together to achieve the desired result.
+     *
+     * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element
+     * contents be edited in place by the user.  This will not work on older browsers.
+     *
+     * <example name="NgModelController" module="customControl">
+     <file name="style.css">
+     [contenteditable] {
+        border: 1px solid black;
+        background-color: white;
+        min-height: 20px;
+      }
+
+     .ng-invalid {
+        border: 1px solid red;
+      }
+
+     </file>
+     <file name="script.js">
+     angular.module('customControl', []).
+     directive('contenteditable', function() {
+          return {
+            restrict: 'A', // only activate on element attribute
+            require: '?ngModel', // get a hold of NgModelController
+            link: function(scope, element, attrs, ngModel) {
+              if(!ngModel) return; // do nothing if no ng-model
+
+              // Specify how UI should be updated
+              ngModel.$render = function() {
+                element.html(ngModel.$viewValue || '');
+              };
+
+              // Listen for change events to enable binding
+              element.on('blur keyup change', function() {
+                scope.$apply(read);
+              });
+              read(); // initialize
+
+              // Write data to the model
+              function read() {
+                var html = element.html();
+                // When we clear the content editable the browser leaves a <br> behind
+                // If strip-br attribute is provided then we strip this out
+                if( attrs.stripBr && html == '<br>' ) {
+                  html = '';
+                }
+                ngModel.$setViewValue(html);
+              }
+            }
+          };
+        });
+     </file>
+     <file name="index.html">
+     <form name="myForm">
+     <div contenteditable
+     name="myWidget" ng-model="userContent"
+     strip-br="true"
+     required>Change me!</div>
+     <span ng-show="myForm.myWidget.$error.required">Required!</span>
+     <hr>
+     <textarea ng-model="userContent"></textarea>
+     </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should data-bind and become invalid', function() {
+      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
+        // SafariDriver can't handle contenteditable
+        // and Firefox driver can't clear contenteditables very well
+        return;
+      }
+      var contentEditable = element(by.css('[contenteditable]'));
+      var content = 'Change me!';
+
+      expect(contentEditable.getText()).toEqual(content);
+
+      contentEditable.clear();
+      contentEditable.sendKeys(protractor.Key.BACK_SPACE);
+      expect(contentEditable.getText()).toEqual('');
+      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
+    });
+     </file>
+     * </example>
+     *
+     *
+     */
+    var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate',
+        function($scope, $exceptionHandler, $attr, $element, $parse, $animate) {
+            this.$viewValue = Number.NaN;
+            this.$modelValue = Number.NaN;
+            this.$parsers = [];
+            this.$formatters = [];
+            this.$viewChangeListeners = [];
+            this.$pristine = true;
+            this.$dirty = false;
+            this.$valid = true;
+            this.$invalid = false;
+            this.$name = $attr.name;
+
+            var ngModelGet = $parse($attr.ngModel),
+                ngModelSet = ngModelGet.assign;
+
+            if (!ngModelSet) {
+                throw minErr('ngModel')('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+                    $attr.ngModel, startingTag($element));
+            }
+
+            /**
+             * @ngdoc method
+             * @name ngModel.NgModelController#$render
+             *
+             * @description
+             * Called when the view needs to be updated. It is expected that the user of the ng-model
+             * directive will implement this method.
+             */
+            this.$render = noop;
+
+            /**
+             * @ngdoc method
+             * @name ngModel.NgModelController#$isEmpty
+             *
+             * @description
+             * This is called when we need to determine if the value of the input is empty.
+             *
+             * For instance, the required directive does this to work out if the input has data or not.
+             * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
+             *
+             * You can override this for input directives whose concept of being empty is different to the
+             * default. The `checkboxInputType` directive does this because in its case a value of `false`
+             * implies empty.
+             *
+             * @param {*} value Reference to check.
+             * @returns {boolean} True if `value` is empty.
+             */
+            this.$isEmpty = function(value) {
+                return isUndefined(value) || value === '' || value === null || value !== value;
+            };
+
+            var parentForm = $element.inheritedData('$formController') || nullFormCtrl,
+                invalidCount = 0, // used to easily determine if we are valid
+                $error = this.$error = {}; // keep invalid keys here
+
+
+            // Setup initial state of the control
+            $element.addClass(PRISTINE_CLASS);
+            toggleValidCss(true);
+
+            // convenience method for easy toggling of classes
+            function toggleValidCss(isValid, validationErrorKey) {
+                validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+                $animate.removeClass($element, (isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey);
+                $animate.addClass($element, (isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
+            }
+
+            /**
+             * @ngdoc method
+             * @name ngModel.NgModelController#$setValidity
+             *
+             * @description
+             * Change the validity state, and notifies the form when the control changes validity. (i.e. it
+             * does not notify form if given validator is already marked as invalid).
+             *
+             * This method should be called by validators - i.e. the parser or formatter functions.
+             *
+             * @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign
+             *        to `$error[validationErrorKey]=isValid` so that it is available for data-binding.
+             *        The `validationErrorKey` should be in camelCase and will get converted into dash-case
+             *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+             *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .
+             * @param {boolean} isValid Whether the current state is valid (true) or invalid (false).
+             */
+            this.$setValidity = function(validationErrorKey, isValid) {
+                // Purposeful use of ! here to cast isValid to boolean in case it is undefined
+                // jshint -W018
+                if ($error[validationErrorKey] === !isValid) return;
+                // jshint +W018
+
+                if (isValid) {
+                    if ($error[validationErrorKey]) invalidCount--;
+                    if (!invalidCount) {
+                        toggleValidCss(true);
+                        this.$valid = true;
+                        this.$invalid = false;
+                    }
+                } else {
+                    toggleValidCss(false);
+                    this.$invalid = true;
+                    this.$valid = false;
+                    invalidCount++;
+                }
+
+                $error[validationErrorKey] = !isValid;
+                toggleValidCss(isValid, validationErrorKey);
+
+                parentForm.$setValidity(validationErrorKey, isValid, this);
+            };
+
+            /**
+             * @ngdoc method
+             * @name ngModel.NgModelController#$setPristine
+             *
+             * @description
+             * Sets the control to its pristine state.
+             *
+             * This method can be called to remove the 'ng-dirty' class and set the control to its pristine
+             * state (ng-pristine class).
+             */
+            this.$setPristine = function () {
+                this.$dirty = false;
+                this.$pristine = true;
+                $animate.removeClass($element, DIRTY_CLASS);
+                $animate.addClass($element, PRISTINE_CLASS);
+            };
+
+            /**
+             * @ngdoc method
+             * @name ngModel.NgModelController#$setViewValue
+             *
+             * @description
+             * Update the view value.
+             *
+             * This method should be called when the view value changes, typically from within a DOM event handler.
+             * For example {@link ng.directive:input input} and
+             * {@link ng.directive:select select} directives call it.
+             *
+             * It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
+             * which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
+             * `$modelValue` and the **expression** specified in the `ng-model` attribute.
+             *
+             * Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
+             *
+             * Note that calling this function does not trigger a `$digest`.
+             *
+             * @param {string} value Value from the view.
+             */
+            this.$setViewValue = function(value) {
+                this.$viewValue = value;
+
+                // change to dirty
+                if (this.$pristine) {
+                    this.$dirty = true;
+                    this.$pristine = false;
+                    $animate.removeClass($element, PRISTINE_CLASS);
+                    $animate.addClass($element, DIRTY_CLASS);
+                    parentForm.$setDirty();
+                }
+
+                forEach(this.$parsers, function(fn) {
+                    value = fn(value);
+                });
+
+                if (this.$modelValue !== value) {
+                    this.$modelValue = value;
+                    ngModelSet($scope, value);
+                    forEach(this.$viewChangeListeners, function(listener) {
+                        try {
+                            listener();
+                        } catch(e) {
+                            $exceptionHandler(e);
+                        }
+                    });
+                }
+            };
+
+            // model -> value
+            var ctrl = this;
+
+            $scope.$watch(function ngModelWatch() {
+                var value = ngModelGet($scope);
+
+                // if scope model value and ngModel value are out of sync
+                if (ctrl.$modelValue !== value) {
+
+                    var formatters = ctrl.$formatters,
+                        idx = formatters.length;
+
+                    ctrl.$modelValue = value;
+                    while(idx--) {
+                        value = formatters[idx](value);
+                    }
+
+                    if (ctrl.$viewValue !== value) {
+                        ctrl.$viewValue = value;
+                        ctrl.$render();
+                    }
+                }
+
+                return value;
+            });
+        }];
+
+
+    /**
+     * @ngdoc directive
+     * @name ngModel
+     *
+     * @element input
+     *
+     * @description
+     * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
+     * property on the scope using {@link ngModel.NgModelController NgModelController},
+     * which is created and exposed by this directive.
+     *
+     * `ngModel` is responsible for:
+     *
+     * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
+     *   require.
+     * - Providing validation behavior (i.e. required, number, email, url).
+     * - Keeping the state of the control (valid/invalid, dirty/pristine, validation errors).
+     * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`) including animations.
+     * - Registering the control with its parent {@link ng.directive:form form}.
+     *
+     * Note: `ngModel` will try to bind to the property given by evaluating the expression on the
+     * current scope. If the property doesn't already exist on this scope, it will be created
+     * implicitly and added to the scope.
+     *
+     * For best practices on using `ngModel`, see:
+     *
+     *  - [https://github.com/angular/angular.js/wiki/Understanding-Scopes]
+     *
+     * For basic examples, how to use `ngModel`, see:
+     *
+     *  - {@link ng.directive:input input}
+     *    - {@link input[text] text}
+     *    - {@link input[checkbox] checkbox}
+     *    - {@link input[radio] radio}
+     *    - {@link input[number] number}
+     *    - {@link input[email] email}
+     *    - {@link input[url] url}
+     *  - {@link ng.directive:select select}
+     *  - {@link ng.directive:textarea textarea}
+     *
+     * # CSS classes
+     * The following CSS classes are added and removed on the associated input/select/textarea element
+     * depending on the validity of the model.
+     *
+     *  - `ng-valid` is set if the model is valid.
+     *  - `ng-invalid` is set if the model is invalid.
+     *  - `ng-pristine` is set if the model is pristine.
+     *  - `ng-dirty` is set if the model is dirty.
+     *
+     * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+     *
+     * ## Animation Hooks
+     *
+     * Animations within models are triggered when any of the associated CSS classes are added and removed
+     * on the input element which is attached to the model. These classes are: `.ng-pristine`, `.ng-dirty`,
+     * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
+     * The animations that are triggered within ngModel are similar to how they work in ngClass and
+     * animations can be hooked into using CSS transitions, keyframes as well as JS animations.
+     *
+     * The following example shows a simple way to utilize CSS transitions to style an input element
+     * that has been rendered as invalid after it has been validated:
+     *
+     * <pre>
+     * //be sure to include ngAnimate as a module to hook into more
+     * //advanced animations
+     * .my-input {
+ *   transition:0.5s linear all;
+ *   background: white;
+ * }
+     * .my-input.ng-invalid {
+ *   background: red;
+ *   color:white;
+ * }
+     * </pre>
+     *
+     * @example
+     * <example deps="angular-animate.js" animations="true" fixBase="true">
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+          $scope.val = '1';
+        }
+     </script>
+     <style>
+     .my-input {
+           -webkit-transition:all linear 0.5s;
+           transition:all linear 0.5s;
+           background: transparent;
+         }
+     .my-input.ng-invalid {
+           color:white;
+           background: red;
+         }
+     </style>
+     Update input to see transitions when valid/invalid.
+     Integer is a valid value.
+     <form name="testForm" ng-controller="Ctrl">
+     <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" />
+     </form>
+     </file>
+     * </example>
+     */
+    var ngModelDirective = function() {
+        return {
+            require: ['ngModel', '^?form'],
+            controller: NgModelController,
+            link: function(scope, element, attr, ctrls) {
+                // notify others, especially parent forms
+
+                var modelCtrl = ctrls[0],
+                    formCtrl = ctrls[1] || nullFormCtrl;
+
+                formCtrl.$addControl(modelCtrl);
+
+                scope.$on('$destroy', function() {
+                    formCtrl.$removeControl(modelCtrl);
+                });
+            }
+        };
+    };
+
+
+    /**
+     * @ngdoc directive
+     * @name ngChange
+     *
+     * @description
+     * Evaluate the given expression when the user changes the input.
+     * The expression is evaluated immediately, unlike the JavaScript onchange event
+     * which only triggers at the end of a change (usually, when the user leaves the
+     * form element or presses the return key).
+     * The expression is not evaluated when the value change is coming from the model.
+     *
+     * Note, this directive requires `ngModel` to be present.
+     *
+     * @element input
+     * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
+     * in input value.
+     *
+     * @example
+     * <example name="ngChange-directive">
+     *   <file name="index.html">
+     *     <script>
+     *       function Controller($scope) {
+ *         $scope.counter = 0;
+ *         $scope.change = function() {
+ *           $scope.counter++;
+ *         };
+ *       }
+     *     </script>
+     *     <div ng-controller="Controller">
+     *       <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
+     *       <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
+     *       <label for="ng-change-example2">Confirmed</label><br />
+     *       <tt>debug = {{confirmed}}</tt><br/>
+     *       <tt>counter = {{counter}}</tt><br/>
+     *     </div>
+     *   </file>
+     *   <file name="protractor.js" type="protractor">
+     *     var counter = element(by.binding('counter'));
+     *     var debug = element(by.binding('confirmed'));
+     *
+     *     it('should evaluate the expression if changing from view', function() {
+ *       expect(counter.getText()).toContain('0');
+ *
+ *       element(by.id('ng-change-example1')).click();
+ *
+ *       expect(counter.getText()).toContain('1');
+ *       expect(debug.getText()).toContain('true');
+ *     });
+     *
+     *     it('should not evaluate the expression if changing from model', function() {
+ *       element(by.id('ng-change-example2')).click();
+
+ *       expect(counter.getText()).toContain('0');
+ *       expect(debug.getText()).toContain('true');
+ *     });
+     *   </file>
+     * </example>
+     */
+    var ngChangeDirective = valueFn({
+        require: 'ngModel',
+        link: function(scope, element, attr, ctrl) {
+            ctrl.$viewChangeListeners.push(function() {
+                scope.$eval(attr.ngChange);
+            });
+        }
+    });
+
+
+    var requiredDirective = function() {
+        return {
+            require: '?ngModel',
+            link: function(scope, elm, attr, ctrl) {
+                if (!ctrl) return;
+                attr.required = true; // force truthy in case we are on non input element
+
+                var validator = function(value) {
+                    if (attr.required && ctrl.$isEmpty(value)) {
+                        ctrl.$setValidity('required', false);
+                        return;
+                    } else {
+                        ctrl.$setValidity('required', true);
+                        return value;
+                    }
+                };
+
+                ctrl.$formatters.push(validator);
+                ctrl.$parsers.unshift(validator);
+
+                attr.$observe('required', function() {
+                    validator(ctrl.$viewValue);
+                });
+            }
+        };
+    };
+
+
+    /**
+     * @ngdoc directive
+     * @name ngList
+     *
+     * @description
+     * Text input that converts between a delimited string and an array of strings. The delimiter
+     * can be a fixed string (by default a comma) or a regular expression.
+     *
+     * @element input
+     * @param {string=} ngList optional delimiter that should be used to split the value. If
+     *   specified in form `/something/` then the value will be converted into a regular expression.
+     *
+     * @example
+     <example name="ngList-directive">
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.names = ['igor', 'misko', 'vojta'];
+         }
+     </script>
+     <form name="myForm" ng-controller="Ctrl">
+     List: <input name="namesInput" ng-model="names" ng-list required>
+     <span class="error" ng-show="myForm.namesInput.$error.required">
+     Required!</span>
+     <br>
+     <tt>names = {{names}}</tt><br/>
+     <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
+     <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
+     <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+     <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+     </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+     var listInput = element(by.model('names'));
+     var names = element(by.binding('{{names}}'));
+     var valid = element(by.binding('myForm.namesInput.$valid'));
+     var error = element(by.css('span.error'));
+
+     it('should initialize to model', function() {
+          expect(names.getText()).toContain('["igor","misko","vojta"]');
+          expect(valid.getText()).toContain('true');
+          expect(error.getCssValue('display')).toBe('none');
+        });
+
+     it('should be invalid if empty', function() {
+          listInput.clear();
+          listInput.sendKeys('');
+
+          expect(names.getText()).toContain('');
+          expect(valid.getText()).toContain('false');
+          expect(error.getCssValue('display')).not.toBe('none');        });
+     </file>
+     </example>
+     */
+    var ngListDirective = function() {
+        return {
+            require: 'ngModel',
+            link: function(scope, element, attr, ctrl) {
+                var match = /\/(.*)\//.exec(attr.ngList),
+                    separator = match && new RegExp(match[1]) || attr.ngList || ',';
+
+                var parse = function(viewValue) {
+                    // If the viewValue is invalid (say required but empty) it will be `undefined`
+                    if (isUndefined(viewValue)) return;
+
+                    var list = [];
+
+                    if (viewValue) {
+                        forEach(viewValue.split(separator), function(value) {
+                            if (value) list.push(trim(value));
+                        });
+                    }
+
+                    return list;
+                };
+
+                ctrl.$parsers.push(parse);
+                ctrl.$formatters.push(function(value) {
+                    if (isArray(value)) {
+                        return value.join(', ');
+                    }
+
+                    return undefined;
+                });
+
+                // Override the standard $isEmpty because an empty array means the input is empty.
+                ctrl.$isEmpty = function(value) {
+                    return !value || !value.length;
+                };
+            }
+        };
+    };
+
+
+    var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
+    /**
+     * @ngdoc directive
+     * @name ngValue
+     *
+     * @description
+     * Binds the given expression to the value of `input[select]` or `input[radio]`, so
+     * that when the element is selected, the `ngModel` of that element is set to the
+     * bound value.
+     *
+     * `ngValue` is useful when dynamically generating lists of radio buttons using `ng-repeat`, as
+     * shown below.
+     *
+     * @element input
+     * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
+     *   of the `input` element
+     *
+     * @example
+     <example name="ngValue-directive">
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+            $scope.names = ['pizza', 'unicorns', 'robots'];
+            $scope.my = { favorite: 'unicorns' };
+          }
+     </script>
+     <form ng-controller="Ctrl">
+     <h2>Which is your favorite?</h2>
+     <label ng-repeat="name in names" for="{{name}}">
+     {{name}}
+     <input type="radio"
+     ng-model="my.favorite"
+     ng-value="name"
+     id="{{name}}"
+     name="favorite">
+     </label>
+     <div>You chose {{my.favorite}}</div>
+     </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+     var favorite = element(by.binding('my.favorite'));
+
+     it('should initialize to model', function() {
+          expect(favorite.getText()).toContain('unicorns');
+        });
+     it('should bind the values to the inputs', function() {
+          element.all(by.model('my.favorite')).get(0).click();
+          expect(favorite.getText()).toContain('pizza');
+        });
+     </file>
+     </example>
+     */
+    var ngValueDirective = function() {
+        return {
+            priority: 100,
+            compile: function(tpl, tplAttr) {
+                if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
+                    return function ngValueConstantLink(scope, elm, attr) {
+                        attr.$set('value', scope.$eval(attr.ngValue));
+                    };
+                } else {
+                    return function ngValueLink(scope, elm, attr) {
+                        scope.$watch(attr.ngValue, function valueWatchAction(value) {
+                            attr.$set('value', value);
+                        });
+                    };
+                }
+            }
+        };
+    };
+
+    /**
+     * @ngdoc directive
+     * @name ngBind
+     * @restrict AC
+     *
+     * @description
+     * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
+     * with the value of a given expression, and to update the text content when the value of that
+     * expression changes.
+     *
+     * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
+     * `{{ expression }}` which is similar but less verbose.
+     *
+     * It is preferable to use `ngBind` instead of `{{ expression }}` when a template is momentarily
+     * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
+     * element attribute, it makes the bindings invisible to the user while the page is loading.
+     *
+     * An alternative solution to this problem would be using the
+     * {@link ng.directive:ngCloak ngCloak} directive.
+     *
+     *
+     * @element ANY
+     * @param {expression} ngBind {@link guide/expression Expression} to evaluate.
+     *
+     * @example
+     * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.name = 'Whirled';
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     Enter name: <input type="text" ng-model="name"><br>
+     Hello <span ng-bind="name"></span>!
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-bind', function() {
+         var nameInput = element(by.model('name'));
+
+         expect(element(by.binding('name')).getText()).toBe('Whirled');
+         nameInput.clear();
+         nameInput.sendKeys('world');
+         expect(element(by.binding('name')).getText()).toBe('world');
+       });
+     </file>
+     </example>
+     */
+    var ngBindDirective = ngDirective(function(scope, element, attr) {
+        element.addClass('ng-binding').data('$binding', attr.ngBind);
+        scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
+            // We are purposefully using == here rather than === because we want to
+            // catch when value is "null or undefined"
+            // jshint -W041
+            element.text(value == undefined ? '' : value);
+        });
+    });
+
+
+    /**
+     * @ngdoc directive
+     * @name ngBindTemplate
+     *
+     * @description
+     * The `ngBindTemplate` directive specifies that the element
+     * text content should be replaced with the interpolation of the template
+     * in the `ngBindTemplate` attribute.
+     * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
+     * expressions. This directive is needed since some HTML elements
+     * (such as TITLE and OPTION) cannot contain SPAN elements.
+     *
+     * @element ANY
+     * @param {string} ngBindTemplate template of form
+     *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
+     *
+     * @example
+     * Try it here: enter text in text box and watch the greeting change.
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.salutation = 'Hello';
+           $scope.name = 'World';
+         }
+     </script>
+     <div ng-controller="Ctrl">
+     Salutation: <input type="text" ng-model="salutation"><br>
+     Name: <input type="text" ng-model="name"><br>
+     <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-bind', function() {
+         var salutationElem = element(by.binding('salutation'));
+         var salutationInput = element(by.model('salutation'));
+         var nameInput = element(by.model('name'));
+
+         expect(salutationElem.getText()).toBe('Hello World!');
+
+         salutationInput.clear();
+         salutationInput.sendKeys('Greetings');
+         nameInput.clear();
+         nameInput.sendKeys('user');
+
+         expect(salutationElem.getText()).toBe('Greetings user!');
+       });
+     </file>
+     </example>
+     */
+    var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
+        return function(scope, element, attr) {
+            // TODO: move this to scenario runner
+            var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
+            element.addClass('ng-binding').data('$binding', interpolateFn);
+            attr.$observe('ngBindTemplate', function(value) {
+                element.text(value);
+            });
+        };
+    }];
+
+
+    /**
+     * @ngdoc directive
+     * @name ngBindHtml
+     *
+     * @description
+     * Creates a binding that will innerHTML the result of evaluating the `expression` into the current
+     * element in a secure way.  By default, the innerHTML-ed content will be sanitized using the {@link
+        * ngSanitize.$sanitize $sanitize} service.  To utilize this functionality, ensure that `$sanitize`
+     * is available, for example, by including {@link ngSanitize} in your module's dependencies (not in
+     * core Angular.)  You may also bypass sanitization for values you know are safe. To do so, bind to
+     * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example
+     * under {@link ng.$sce#Example Strict Contextual Escaping (SCE)}.
+     *
+     * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you
+     * will have an exception (instead of an exploit.)
+     *
+     * @element ANY
+     * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+     *
+     * @example
+     Try it here: enter text in text box and watch the greeting change.
+
+     <example module="ngBindHtmlExample" deps="angular-sanitize.js">
+     <file name="index.html">
+     <div ng-controller="ngBindHtmlCtrl">
+     <p ng-bind-html="myHTML"></p>
+     </div>
+     </file>
+
+     <file name="script.js">
+     angular.module('ngBindHtmlExample', ['ngSanitize'])
+
+     .controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
+         $scope.myHTML =
+            'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
+       }]);
+     </file>
+
+     <file name="protractor.js" type="protractor">
+     it('should check ng-bind-html', function() {
+         expect(element(by.binding('myHTML')).getText()).toBe(
+             'I am an HTMLstring with links! and other stuff');
+       });
+     </file>
+     </example>
+     */
+    var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
+        return function(scope, element, attr) {
+            element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
+
+            var parsed = $parse(attr.ngBindHtml);
+            function getStringValue() { return (parsed(scope) || '').toString(); }
+
+            scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) {
+                element.html($sce.getTrustedHtml(parsed(scope)) || '');
+            });
+        };
+    }];
+
+    function classDirective(name, selector) {
+        name = 'ngClass' + name;
+        return ['$animate', function($animate) {
+            return {
+                restrict: 'AC',
+                link: function(scope, element, attr) {
+                    var oldVal;
+
+                    scope.$watch(attr[name], ngClassWatchAction, true);
+
+                    attr.$observe('class', function(value) {
+                        ngClassWatchAction(scope.$eval(attr[name]));
+                    });
+
+
+                    if (name !== 'ngClass') {
+                        scope.$watch('$index', function($index, old$index) {
+                            // jshint bitwise: false
+                            var mod = $index & 1;
+                            if (mod !== old$index & 1) {
+                                var classes = arrayClasses(scope.$eval(attr[name]));
+                                mod === selector ?
+                                    addClasses(classes) :
+                                    removeClasses(classes);
+                            }
+                        });
+                    }
+
+                    function addClasses(classes) {
+                        var newClasses = digestClassCounts(classes, 1);
+                        attr.$addClass(newClasses);
+                    }
+
+                    function removeClasses(classes) {
+                        var newClasses = digestClassCounts(classes, -1);
+                        attr.$removeClass(newClasses);
+                    }
+
+                    function digestClassCounts (classes, count) {
+                        var classCounts = element.data('$classCounts') || {};
+                        var classesToUpdate = [];
+                        forEach(classes, function (className) {
+                            if (count > 0 || classCounts[className]) {
+                                classCounts[className] = (classCounts[className] || 0) + count;
+                                if (classCounts[className] === +(count > 0)) {
+                                    classesToUpdate.push(className);
+                                }
+                            }
+                        });
+                        element.data('$classCounts', classCounts);
+                        return classesToUpdate.join(' ');
+                    }
+
+                    function updateClasses (oldClasses, newClasses) {
+                        var toAdd = arrayDifference(newClasses, oldClasses);
+                        var toRemove = arrayDifference(oldClasses, newClasses);
+                        toRemove = digestClassCounts(toRemove, -1);
+                        toAdd = digestClassCounts(toAdd, 1);
+
+                        if (toAdd.length === 0) {
+                            $animate.removeClass(element, toRemove);
+                        } else if (toRemove.length === 0) {
+                            $animate.addClass(element, toAdd);
+                        } else {
+                            $animate.setClass(element, toAdd, toRemove);
+                        }
+                    }
+
+                    function ngClassWatchAction(newVal) {
+                        if (selector === true || scope.$index % 2 === selector) {
+                            var newClasses = arrayClasses(newVal || []);
+                            if (!oldVal) {
+                                addClasses(newClasses);
+                            } else if (!equals(newVal,oldVal)) {
+                                var oldClasses = arrayClasses(oldVal);
+                                updateClasses(oldClasses, newClasses);
+                            }
+                        }
+                        oldVal = copy(newVal);
+                    }
+                }
+            };
+
+            function arrayDifference(tokens1, tokens2) {
+                var values = [];
+
+                outer:
+                    for(var i = 0; i < tokens1.length; i++) {
+                        var token = tokens1[i];
+                        for(var j = 0; j < tokens2.length; j++) {
+                            if(token == tokens2[j]) continue outer;
+                        }
+                        values.push(token);
+                    }
+                return values;
+            }
+
+            function arrayClasses (classVal) {
+                if (isArray(classVal)) {
+                    return classVal;
+                } else if (isString(classVal)) {
+                    return classVal.split(' ');
+                } else if (isObject(classVal)) {
+                    var classes = [], i = 0;
+                    forEach(classVal, function(v, k) {
+                        if (v) {
+                            classes.push(k);
+                        }
+                    });
+                    return classes;
+                }
+                return classVal;
+            }
+        }];
+    }
+
+    /**
+     * @ngdoc directive
+     * @name ngClass
+     * @restrict AC
+     *
+     * @description
+     * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
+     * an expression that represents all classes to be added.
+     *
+     * The directive operates in three different ways, depending on which of three types the expression
+     * evaluates to:
+     *
+     * 1. If the expression evaluates to a string, the string should be one or more space-delimited class
+     * names.
+     *
+     * 2. If the expression evaluates to an array, each element of the array should be a string that is
+     * one or more space-delimited class names.
+     *
+     * 3. If the expression evaluates to an object, then for each key-value pair of the
+     * object with a truthy value the corresponding key is used as a class name.
+     *
+     * The directive won't add duplicate classes if a particular class was already set.
+     *
+     * When the expression changes, the previously added classes are removed and only then the
+     * new classes are added.
+     *
+     * @animations
+     * add - happens just before the class is applied to the element
+     * remove - happens just before the class is removed from the element
+     *
+     * @element ANY
+     * @param {expression} ngClass {@link guide/expression Expression} to eval. The result
+     *   of the evaluation can be a string representing space delimited class
+     *   names, an array, or a map of class names to boolean values. In the case of a map, the
+     *   names of the properties whose values are truthy will be added as css classes to the
+     *   element.
+     *
+     * @example Example that demonstrates basic bindings via ngClass directive.
+     <example>
+     <file name="index.html">
+     <p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
+     <input type="checkbox" ng-model="deleted"> deleted (apply "strike" class)<br>
+     <input type="checkbox" ng-model="important"> important (apply "bold" class)<br>
+     <input type="checkbox" ng-model="error"> error (apply "red" class)
+     <hr>
+     <p ng-class="style">Using String Syntax</p>
+     <input type="text" ng-model="style" placeholder="Type: bold strike red">
+     <hr>
+     <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
+     <input ng-model="style1" placeholder="Type: bold, strike or red"><br>
+     <input ng-model="style2" placeholder="Type: bold, strike or red"><br>
+     <input ng-model="style3" placeholder="Type: bold, strike or red"><br>
+     </file>
+     <file name="style.css">
+     .strike {
+         text-decoration: line-through;
+       }
+     .bold {
+           font-weight: bold;
+       }
+     .red {
+           color: red;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var ps = element.all(by.css('p'));
+
+     it('should let you toggle the class', function() {
+
+         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
+         expect(ps.first().getAttribute('class')).not.toMatch(/red/);
+
+         element(by.model('important')).click();
+         expect(ps.first().getAttribute('class')).toMatch(/bold/);
+
+         element(by.model('error')).click();
+         expect(ps.first().getAttribute('class')).toMatch(/red/);
+       });
+
+     it('should let you toggle string example', function() {
+         expect(ps.get(1).getAttribute('class')).toBe('');
+         element(by.model('style')).clear();
+         element(by.model('style')).sendKeys('red');
+         expect(ps.get(1).getAttribute('class')).toBe('red');
+       });
+
+     it('array example should have 3 classes', function() {
+         expect(ps.last().getAttribute('class')).toBe('');
+         element(by.model('style1')).sendKeys('bold');
+         element(by.model('style2')).sendKeys('strike');
+         element(by.model('style3')).sendKeys('red');
+         expect(ps.last().getAttribute('class')).toBe('bold strike red');
+       });
+     </file>
+     </example>
+
+     ## Animations
+
+     The example below demonstrates how to perform animations using ngClass.
+
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
+     <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
+     <br>
+     <span class="base-class" ng-class="myVar">Sample Text</span>
+     </file>
+     <file name="style.css">
+     .base-class {
+         -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+       }
+
+     .base-class.my-class {
+         color: red;
+         font-size:3em;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-class', function() {
+         expect(element(by.css('.base-class')).getAttribute('class')).not.
+           toMatch(/my-class/);
+
+         element(by.id('setbtn')).click();
+
+         expect(element(by.css('.base-class')).getAttribute('class')).
+           toMatch(/my-class/);
+
+         element(by.id('clearbtn')).click();
+
+         expect(element(by.css('.base-class')).getAttribute('class')).not.
+           toMatch(/my-class/);
+       });
+     </file>
+     </example>
+
+
+     ## ngClass and pre-existing CSS3 Transitions/Animations
+     The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
+     Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
+     any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
+     to view the step by step details of {@link ngAnimate.$animate#addclass $animate.addClass} and
+     {@link ngAnimate.$animate#removeclass $animate.removeClass}.
+     */
+    var ngClassDirective = classDirective('', true);
+
+    /**
+     * @ngdoc directive
+     * @name ngClassOdd
+     * @restrict AC
+     *
+     * @description
+     * The `ngClassOdd` and `ngClassEven` directives work exactly as
+     * {@link ng.directive:ngClass ngClass}, except they work in
+     * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+     *
+     * This directive can be applied only within the scope of an
+     * {@link ng.directive:ngRepeat ngRepeat}.
+     *
+     * @element ANY
+     * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
+     *   of the evaluation can be a string representing space delimited class names or an array.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+     <li ng-repeat="name in names">
+     <span ng-class-odd="'odd'" ng-class-even="'even'">
+     {{name}}
+     </span>
+     </li>
+     </ol>
+     </file>
+     <file name="style.css">
+     .odd {
+         color: red;
+       }
+     .even {
+         color: blue;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-class-odd and ng-class-even', function() {
+         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+           toMatch(/odd/);
+         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+           toMatch(/even/);
+       });
+     </file>
+     </example>
+     */
+    var ngClassOddDirective = classDirective('Odd', 0);
+
+    /**
+     * @ngdoc directive
+     * @name ngClassEven
+     * @restrict AC
+     *
+     * @description
+     * The `ngClassOdd` and `ngClassEven` directives work exactly as
+     * {@link ng.directive:ngClass ngClass}, except they work in
+     * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+     *
+     * This directive can be applied only within the scope of an
+     * {@link ng.directive:ngRepeat ngRepeat}.
+     *
+     * @element ANY
+     * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
+     *   result of the evaluation can be a string representing space delimited class names or an array.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+     <li ng-repeat="name in names">
+     <span ng-class-odd="'odd'" ng-class-even="'even'">
+     {{name}} &nbsp; &nbsp; &nbsp;
+     </span>
+     </li>
+     </ol>
+     </file>
+     <file name="style.css">
+     .odd {
+         color: red;
+       }
+     .even {
+         color: blue;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-class-odd and ng-class-even', function() {
+         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+           toMatch(/odd/);
+         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+           toMatch(/even/);
+       });
+     </file>
+     </example>
+     */
+    var ngClassEvenDirective = classDirective('Even', 1);
+
+    /**
+     * @ngdoc directive
+     * @name ngCloak
+     * @restrict AC
+     *
+     * @description
+     * The `ngCloak` directive is used to prevent the Angular html template from being briefly
+     * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
+     * directive to avoid the undesirable flicker effect caused by the html template display.
+     *
+     * The directive can be applied to the `<body>` element, but the preferred usage is to apply
+     * multiple `ngCloak` directives to small portions of the page to permit progressive rendering
+     * of the browser view.
+     *
+     * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and
+     * `angular.min.js`.
+     * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+     *
+     * ```css
+     * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ *   display: none !important;
+ * }
+     * ```
+     *
+     * When this css rule is loaded by the browser, all html elements (including their children) that
+     * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
+     * during the compilation of the template it deletes the `ngCloak` element attribute, making
+     * the compiled element visible.
+     *
+     * For the best result, the `angular.js` script must be loaded in the head section of the html
+     * document; alternatively, the css rule above must be included in the external stylesheet of the
+     * application.
+     *
+     * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they
+     * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css
+     * class `ng-cloak` in addition to the `ngCloak` directive as shown in the example below.
+     *
+     * @element ANY
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <div id="template1" ng-cloak>{{ 'hello' }}</div>
+     <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should remove the template directive and css class', function() {
+         expect($('#template1').getAttribute('ng-cloak')).
+           toBeNull();
+         expect($('#template2').getAttribute('ng-cloak')).
+           toBeNull();
+       });
+     </file>
+     </example>
+     *
+     */
+    var ngCloakDirective = ngDirective({
+        compile: function(element, attr) {
+            attr.$set('ngCloak', undefined);
+            element.removeClass('ng-cloak');
+        }
+    });
+
+    /**
+     * @ngdoc directive
+     * @name ngController
+     *
+     * @description
+     * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular
+     * supports the principles behind the Model-View-Controller design pattern.
+     *
+     * MVC components in angular:
+     *
+     * * Model — The Model is scope properties; scopes are attached to the DOM where scope properties
+     *   are accessed through bindings.
+     * * View — The template (HTML with data bindings) that is rendered into the View.
+     * * Controller — The `ngController` directive specifies a Controller class; the class contains business
+     *   logic behind the application to decorate the scope with functions and values
+     *
+     * Note that you can also attach controllers to the DOM by declaring it in a route definition
+     * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
+     * again using `ng-controller` in the template itself.  This will cause the controller to be attached
+     * and executed twice.
+     *
+     * @element ANY
+     * @scope
+     * @param {expression} ngController Name of a globally accessible constructor function or an
+     *     {@link guide/expression expression} that on the current scope evaluates to a
+     *     constructor function. The controller instance can be published into a scope property
+     *     by specifying `as propertyName`.
+     *
+     * @example
+     * Here is a simple form for editing user contact information. Adding, removing, clearing, and
+     * greeting are methods declared on the controller (see source tab). These methods can
+     * easily be called from the angular markup. Notice that the scope becomes the `this` for the
+     * controller's instance. This allows for easy access to the view data from the controller. Also
+     * notice that any changes to the data are automatically reflected in the View without the need
+     * for a manual update. The example is shown in two different declaration styles you may use
+     * according to preference.
+     <example>
+     <file name="index.html">
+     <script>
+     function SettingsController1() {
+          this.name = "John Smith";
+          this.contacts = [
+            {type: 'phone', value: '408 555 1212'},
+            {type: 'email', value: 'john.smith@example.org'} ];
+     };
+
+     SettingsController1.prototype.greet = function() {
+          alert(this.name);
+        };
+
+     SettingsController1.prototype.addContact = function() {
+          this.contacts.push({type: 'email', value: 'yourname@example.org'});
+     };
+
+     SettingsController1.prototype.removeContact = function(contactToRemove) {
+         var index = this.contacts.indexOf(contactToRemove);
+          this.contacts.splice(index, 1);
+        };
+
+     SettingsController1.prototype.clearContact = function(contact) {
+          contact.type = 'phone';
+          contact.value = '';
+        };
+     </script>
+     <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
+     Name: <input type="text" ng-model="settings.name"/>
+     [ <a href="" ng-click="settings.greet()">greet</a> ]<br/>
+     Contact:
+     <ul>
+     <li ng-repeat="contact in settings.contacts">
+     <select ng-model="contact.type">
+     <option>phone</option>
+     <option>email</option>
+     </select>
+     <input type="text" ng-model="contact.value"/>
+     [ <a href="" ng-click="settings.clearContact(contact)">clear</a>
+     | <a href="" ng-click="settings.removeContact(contact)">X</a> ]
+     </li>
+     <li>[ <a href="" ng-click="settings.addContact()">add</a> ]</li>
+     </ul>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check controller as', function() {
+         var container = element(by.id('ctrl-as-exmpl'));
+
+         expect(container.findElement(by.model('settings.name'))
+             .getAttribute('value')).toBe('John Smith');
+
+         var firstRepeat =
+             container.findElement(by.repeater('contact in settings.contacts').row(0));
+         var secondRepeat =
+             container.findElement(by.repeater('contact in settings.contacts').row(1));
+
+         expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+             .toBe('408 555 1212');
+         expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+             .toBe('john.smith@example.org');
+
+     firstRepeat.findElement(by.linkText('clear')).click();
+
+     expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+     .toBe('');
+
+     container.findElement(by.linkText('add')).click();
+
+     expect(container.findElement(by.repeater('contact in settings.contacts').row(2))
+     .findElement(by.model('contact.value'))
+     .getAttribute('value'))
+     .toBe('yourname@example.org');
+     });
+     </file>
+     </example>
+     <example>
+     <file name="index.html">
+     <script>
+     function SettingsController2($scope) {
+          $scope.name = "John Smith";
+          $scope.contacts = [
+            {type:'phone', value:'408 555 1212'},
+            {type:'email', value:'john.smith@example.org'} ];
+
+     $scope.greet = function() {
+           alert(this.name);
+          };
+
+     $scope.addContact = function() {
+           this.contacts.push({type:'email', value:'yourname@example.org'});
+     };
+
+     $scope.removeContact = function(contactToRemove) {
+           var index = this.contacts.indexOf(contactToRemove);
+           this.contacts.splice(index, 1);
+          };
+
+     $scope.clearContact = function(contact) {
+           contact.type = 'phone';
+           contact.value = '';
+          };
+     }
+     </script>
+     <div id="ctrl-exmpl" ng-controller="SettingsController2">
+     Name: <input type="text" ng-model="name"/>
+     [ <a href="" ng-click="greet()">greet</a> ]<br/>
+     Contact:
+     <ul>
+     <li ng-repeat="contact in contacts">
+     <select ng-model="contact.type">
+     <option>phone</option>
+     <option>email</option>
+     </select>
+     <input type="text" ng-model="contact.value"/>
+     [ <a href="" ng-click="clearContact(contact)">clear</a>
+     | <a href="" ng-click="removeContact(contact)">X</a> ]
+     </li>
+     <li>[ <a href="" ng-click="addContact()">add</a> ]</li>
+     </ul>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check controller', function() {
+         var container = element(by.id('ctrl-exmpl'));
+
+         expect(container.findElement(by.model('name'))
+             .getAttribute('value')).toBe('John Smith');
+
+         var firstRepeat =
+             container.findElement(by.repeater('contact in contacts').row(0));
+         var secondRepeat =
+             container.findElement(by.repeater('contact in contacts').row(1));
+
+         expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+             .toBe('408 555 1212');
+         expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+             .toBe('john.smith@example.org');
+
+     firstRepeat.findElement(by.linkText('clear')).click();
+
+     expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+     .toBe('');
+
+     container.findElement(by.linkText('add')).click();
+
+     expect(container.findElement(by.repeater('contact in contacts').row(2))
+     .findElement(by.model('contact.value'))
+     .getAttribute('value'))
+     .toBe('yourname@example.org');
+     });
+     </file>
+     </example>
+
+     */
+    var ngControllerDirective = [function() {
+        return {
+            scope: true,
+            controller: '@',
+            priority: 500
+        };
+    }];
+
+    /**
+     * @ngdoc directive
+     * @name ngCsp
+     *
+     * @element html
+     * @description
+     * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
+     *
+     * This is necessary when developing things like Google Chrome Extensions.
+     *
+     * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
+     * For us to be compatible, we just need to implement the "getterFn" in $parse without violating
+     * any of these restrictions.
+     *
+     * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp`
+     * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will
+     * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will
+     * be raised.
+     *
+     * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically
+     * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}).
+     * To make those directives work in CSP mode, include the `angular-csp.css` manually.
+     *
+     * In order to use this feature put the `ngCsp` directive on the root element of the application.
+     *
+     * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
+     *
+     * @example
+     * This example shows how to apply the `ngCsp` directive to the `html` tag.
+     ```html
+     <!doctype html>
+     <html ng-app ng-csp>
+     ...
+     ...
+     </html>
+     ```
+     */
+
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap
+// the system (before $parse is instantiated), for this reason we just have a csp() fn that looks for ng-csp attribute
+// anywhere in the current doc
+
+    /**
+     * @ngdoc directive
+     * @name ngClick
+     *
+     * @description
+     * The ngClick directive allows you to specify custom behavior when
+     * an element is clicked.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
+     * click. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-click="count = count + 1" ng-init="count=0">
+     Increment
+     </button>
+     count: {{count}}
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-click', function() {
+         expect(element(by.binding('count')).getText()).toMatch('0');
+         element(by.css('button')).click();
+         expect(element(by.binding('count')).getText()).toMatch('1');
+       });
+     </file>
+     </example>
+     */
+    /*
+     * A directive that allows creation of custom onclick handlers that are defined as angular
+     * expressions and are compiled and executed within the current scope.
+     *
+     * Events that are handled via these handler are always configured not to propagate further.
+     */
+    var ngEventDirectives = {};
+    forEach(
+        'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
+        function(name) {
+            var directiveName = directiveNormalize('ng-' + name);
+            ngEventDirectives[directiveName] = ['$parse', function($parse) {
+                return {
+                    compile: function($element, attr) {
+                        var fn = $parse(attr[directiveName]);
+                        return function(scope, element, attr) {
+                            element.on(lowercase(name), function(event) {
+                                scope.$apply(function() {
+                                    fn(scope, {$event:event});
+                                });
+                            });
+                        };
+                    }
+                };
+            }];
+        }
+    );
+
+    /**
+     * @ngdoc directive
+     * @name ngDblclick
+     *
+     * @description
+     * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
+     * a dblclick. (The Event object is available as `$event`)
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-dblclick="count = count + 1" ng-init="count=0">
+     Increment (on double click)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngMousedown
+     *
+     * @description
+     * The ngMousedown directive allows you to specify custom behavior on mousedown event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
+     * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-mousedown="count = count + 1" ng-init="count=0">
+     Increment (on mouse down)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngMouseup
+     *
+     * @description
+     * Specify custom behavior on mouseup event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
+     * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-mouseup="count = count + 1" ng-init="count=0">
+     Increment (on mouse up)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngMouseover
+     *
+     * @description
+     * Specify custom behavior on mouseover event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
+     * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-mouseover="count = count + 1" ng-init="count=0">
+     Increment (when mouse is over)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngMouseenter
+     *
+     * @description
+     * Specify custom behavior on mouseenter event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
+     * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-mouseenter="count = count + 1" ng-init="count=0">
+     Increment (when mouse enters)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngMouseleave
+     *
+     * @description
+     * Specify custom behavior on mouseleave event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
+     * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-mouseleave="count = count + 1" ng-init="count=0">
+     Increment (when mouse leaves)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngMousemove
+     *
+     * @description
+     * Specify custom behavior on mousemove event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
+     * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <button ng-mousemove="count = count + 1" ng-init="count=0">
+     Increment (when mouse moves)
+     </button>
+     count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngKeydown
+     *
+     * @description
+     * Specify custom behavior on keydown event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
+     * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input ng-keydown="count = count + 1" ng-init="count=0">
+     key down count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngKeyup
+     *
+     * @description
+     * Specify custom behavior on keyup event.
+     *
+     * @element ANY
+     * @priority 0
+     * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
+     * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input ng-keyup="count = count + 1" ng-init="count=0">
+     key up count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngKeypress
+     *
+     * @description
+     * Specify custom behavior on keypress event.
+     *
+     * @element ANY
+     * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
+     * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+     * and can be interrogated for keyCode, altKey, etc.)
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input ng-keypress="count = count + 1" ng-init="count=0">
+     key press count: {{count}}
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc directive
+     * @name ngSubmit
+     *
+     * @description
+     * Enables binding angular expressions to onsubmit events.
+     *
+     * Additionally it prevents the default action (which for form means sending the request to the
+     * server and reloading the current page), but only if the form does not contain `action`,
+     * `data-action`, or `x-action` attributes.
+     *
+     * @element form
+     * @priority 0
+     * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+     * ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+          $scope.list = [];
+          $scope.text = 'hello';
+          $scope.submit = function() {
+            if ($scope.text) {
+              $scope.list.push(this.text);
+              $scope.text = '';
+            }
+          };
+        }
+     </script>
+     <form ng-submit="submit()" ng-controller="Ctrl">
+     Enter text and hit enter:
+     <input type="text" ng-model="text" name="text" />
+     <input type="submit" id="submit" value="Submit" />
+     <pre>list={{list}}</pre>
+     </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-submit', function() {
+         expect(element(by.binding('list')).getText()).toBe('list=[]');
+         element(by.css('#submit')).click();
+         expect(element(by.binding('list')).getText()).toContain('hello');
+         expect(element(by.input('text')).getAttribute('value')).toBe('');
+       });
+     it('should ignore empty strings', function() {
+         expect(element(by.binding('list')).getText()).toBe('list=[]');
+         element(by.css('#submit')).click();
+         element(by.css('#submit')).click();
+         expect(element(by.binding('list')).getText()).toContain('hello');
+        });
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngFocus
+     *
+     * @description
+     * Specify custom behavior on focus event.
+     *
+     * @element window, input, select, textarea, a
+     * @priority 0
+     * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
+     * focus. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     * See {@link ng.directive:ngClick ngClick}
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngBlur
+     *
+     * @description
+     * Specify custom behavior on blur event.
+     *
+     * @element window, input, select, textarea, a
+     * @priority 0
+     * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
+     * blur. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     * See {@link ng.directive:ngClick ngClick}
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngCopy
+     *
+     * @description
+     * Specify custom behavior on copy event.
+     *
+     * @element window, input, select, textarea, a
+     * @priority 0
+     * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
+     * copy. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
+     copied: {{copied}}
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngCut
+     *
+     * @description
+     * Specify custom behavior on cut event.
+     *
+     * @element window, input, select, textarea, a
+     * @priority 0
+     * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
+     * cut. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
+     cut: {{cut}}
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngPaste
+     *
+     * @description
+     * Specify custom behavior on paste event.
+     *
+     * @element window, input, select, textarea, a
+     * @priority 0
+     * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
+     * paste. ({@link guide/expression#-event- Event object is available as `$event`})
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
+     pasted: {{paste}}
+     </file>
+     </example>
+     */
+
+    /**
+     * @ngdoc directive
+     * @name ngIf
+     * @restrict A
+     *
+     * @description
+     * The `ngIf` directive removes or recreates a portion of the DOM tree based on an
+     * {expression}. If the expression assigned to `ngIf` evaluates to a false
+     * value then the element is removed from the DOM, otherwise a clone of the
+     * element is reinserted into the DOM.
+     *
+     * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the
+     * element in the DOM rather than changing its visibility via the `display` css property.  A common
+     * case when this difference is significant is when using css selectors that rely on an element's
+     * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
+     *
+     * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope
+     * is created when the element is restored.  The scope created within `ngIf` inherits from
+     * its parent scope using
+     * [prototypal inheritance](https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance).
+     * An important implication of this is if `ngModel` is used within `ngIf` to bind to
+     * a javascript primitive defined in the parent scope. In this case any modifications made to the
+     * variable within the child scope will override (hide) the value in the parent scope.
+     *
+     * Also, `ngIf` recreates elements using their compiled state. An example of this behavior
+     * is if an element's class attribute is directly modified after it's compiled, using something like
+     * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element
+     * the added class will be lost because the original compiled state is used to regenerate the element.
+     *
+     * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`
+     * and `leave` effects.
+     *
+     * @animations
+     * enter - happens just after the ngIf contents change and a new DOM element is created and injected into the ngIf container
+     * leave - happens just before the ngIf contents are removed from the DOM
+     *
+     * @element ANY
+     * @scope
+     * @priority 600
+     * @param {expression} ngIf If the {@link guide/expression expression} is falsy then
+     *     the element is removed from the DOM tree. If it is truthy a copy of the compiled
+     *     element is added to the DOM tree.
+     *
+     * @example
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/>
+     Show when checked:
+     <span ng-if="checked" class="animate-if">
+     I'm removed when the checkbox is unchecked.
+     </span>
+     </file>
+     <file name="animations.css">
+     .animate-if {
+        background:white;
+        border:1px solid black;
+        padding:10px;
+      }
+
+     .animate-if.ng-enter, .animate-if.ng-leave {
+        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+      }
+
+     .animate-if.ng-enter,
+     .animate-if.ng-leave.ng-leave-active {
+        opacity:0;
+      }
+
+     .animate-if.ng-leave,
+     .animate-if.ng-enter.ng-enter-active {
+        opacity:1;
+      }
+     </file>
+     </example>
+     */
+    var ngIfDirective = ['$animate', function($animate) {
+        return {
+            transclude: 'element',
+            priority: 600,
+            terminal: true,
+            restrict: 'A',
+            $$tlb: true,
+            link: function ($scope, $element, $attr, ctrl, $transclude) {
+                var block, childScope, previousElements;
+                $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
+
+                    if (toBoolean(value)) {
+                        if (!childScope) {
+                            childScope = $scope.$new();
+                            $transclude(childScope, function (clone) {
+                                clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
+                                // Note: We only need the first/last node of the cloned nodes.
+                                // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+                                // by a directive with templateUrl when it's template arrives.
+                                block = {
+                                    clone: clone
+                                };
+                                $animate.enter(clone, $element.parent(), $element);
+                            });
+                        }
+                    } else {
+                        if(previousElements) {
+                            previousElements.remove();
+                            previousElements = null;
+                        }
+                        if(childScope) {
+                            childScope.$destroy();
+                            childScope = null;
+                        }
+                        if(block) {
+                            previousElements = getBlockElements(block.clone);
+                            $animate.leave(previousElements, function() {
+                                previousElements = null;
+                            });
+                            block = null;
+                        }
+                    }
+                });
+            }
+        };
+    }];
+
+    /**
+     * @ngdoc directive
+     * @name ngInclude
+     * @restrict ECA
+     *
+     * @description
+     * Fetches, compiles and includes an external HTML fragment.
+     *
+     * By default, the template URL is restricted to the same domain and protocol as the
+     * application document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols
+     * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or
+     * [wrap them](ng.$sce#trustAsResourceUrl) as trusted values. Refer to Angular's {@link
+        * ng.$sce Strict Contextual Escaping}.
+     *
+     * In addition, the browser's
+     * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+     * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+     * policy may further restrict whether the template is successfully loaded.
+     * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`
+     * access on some browsers.
+     *
+     * @animations
+     * enter - animation is used to bring new content into the browser.
+     * leave - animation is used to animate existing content away.
+     *
+     * The enter and leave animation occur concurrently.
+     *
+     * @scope
+     * @priority 400
+     *
+     * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
+     *                 make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
+     * @param {string=} onload Expression to evaluate when a new partial is loaded.
+     *
+     * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
+ *                  $anchorScroll} to scroll the viewport after the content is loaded.
+     *
+     *                  - If the attribute is not set, disable scrolling.
+     *                  - If the attribute is set without value, enable scrolling.
+     *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.
+     *
+     * @example
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     <div ng-controller="Ctrl">
+     <select ng-model="template" ng-options="t.name for t in templates">
+     <option value="">(blank)</option>
+     </select>
+     url of the template: <tt>{{template.url}}</tt>
+     <hr/>
+     <div class="slide-animate-container">
+     <div class="slide-animate" ng-include="template.url"></div>
+     </div>
+     </div>
+     </file>
+     <file name="script.js">
+     function Ctrl($scope) {
+        $scope.templates =
+          [ { name: 'template1.html', url: 'template1.html'},
+            { name: 'template2.html', url: 'template2.html'} ];
+        $scope.template = $scope.templates[0];
+      }
+     </file>
+     <file name="template1.html">
+     Content of template1.html
+     </file>
+     <file name="template2.html">
+     Content of template2.html
+     </file>
+     <file name="animations.css">
+     .slide-animate-container {
+        position:relative;
+        background:white;
+        border:1px solid black;
+        height:40px;
+        overflow:hidden;
+      }
+
+     .slide-animate {
+        padding:10px;
+      }
+
+     .slide-animate.ng-enter, .slide-animate.ng-leave {
+        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+        position:absolute;
+        top:0;
+        left:0;
+        right:0;
+        bottom:0;
+        display:block;
+        padding:10px;
+      }
+
+     .slide-animate.ng-enter {
+        top:-50px;
+      }
+     .slide-animate.ng-enter.ng-enter-active {
+        top:0;
+      }
+
+     .slide-animate.ng-leave {
+        top:0;
+      }
+     .slide-animate.ng-leave.ng-leave-active {
+        top:50px;
+      }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var templateSelect = element(by.model('template'));
+     var includeElem = element(by.css('[ng-include]'));
+
+     it('should load template1.html', function() {
+        expect(includeElem.getText()).toMatch(/Content of template1.html/);
+      });
+
+     it('should load template2.html', function() {
+        if (browser.params.browser == 'firefox') {
+          // Firefox can't handle using selects
+          // See https://github.com/angular/protractor/issues/480
+          return;
+        }
+        templateSelect.click();
+        templateSelect.element.all(by.css('option')).get(2).click();
+        expect(includeElem.getText()).toMatch(/Content of template2.html/);
+      });
+
+     it('should change to blank', function() {
+        if (browser.params.browser == 'firefox') {
+          // Firefox can't handle using selects
+          return;
+        }
+        templateSelect.click();
+        templateSelect.element.all(by.css('option')).get(0).click();
+        expect(includeElem.isPresent()).toBe(false);
+      });
+     </file>
+     </example>
+     */
+
+
+    /**
+     * @ngdoc event
+     * @name ngInclude#$includeContentRequested
+     * @eventType emit on the scope ngInclude was declared in
+     * @description
+     * Emitted every time the ngInclude content is requested.
+     */
+
+
+    /**
+     * @ngdoc event
+     * @name ngInclude#$includeContentLoaded
+     * @eventType emit on the current ngInclude scope
+     * @description
+     * Emitted every time the ngInclude content is reloaded.
+     */
+    var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate', '$sce',
+        function($http,   $templateCache,   $anchorScroll,   $animate,   $sce) {
+            return {
+                restrict: 'ECA',
+                priority: 400,
+                terminal: true,
+                transclude: 'element',
+                controller: angular.noop,
+                compile: function(element, attr) {
+                    var srcExp = attr.ngInclude || attr.src,
+                        onloadExp = attr.onload || '',
+                        autoScrollExp = attr.autoscroll;
+
+                    return function(scope, $element, $attr, ctrl, $transclude) {
+                        var changeCounter = 0,
+                            currentScope,
+                            previousElement,
+                            currentElement;
+
+                        var cleanupLastIncludeContent = function() {
+                            if(previousElement) {
+                                previousElement.remove();
+                                previousElement = null;
+                            }
+                            if(currentScope) {
+                                currentScope.$destroy();
+                                currentScope = null;
+                            }
+                            if(currentElement) {
+                                $animate.leave(currentElement, function() {
+                                    previousElement = null;
+                                });
+                                previousElement = currentElement;
+                                currentElement = null;
+                            }
+                        };
+
+                        scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) {
+                            var afterAnimation = function() {
+                                if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+                                    $anchorScroll();
+                                }
+                            };
+                            var thisChangeId = ++changeCounter;
+
+                            if (src) {
+                                $http.get(src, {cache: $templateCache}).success(function(response) {
+                                    if (thisChangeId !== changeCounter) return;
+                                    var newScope = scope.$new();
+                                    ctrl.template = response;
+
+                                    // Note: This will also link all children of ng-include that were contained in the original
+                                    // html. If that content contains controllers, ... they could pollute/change the scope.
+                                    // However, using ng-include on an element with additional content does not make sense...
+                                    // Note: We can't remove them in the cloneAttchFn of $transclude as that
+                                    // function is called before linking the content, which would apply child
+                                    // directives to non existing elements.
+                                    var clone = $transclude(newScope, function(clone) {
+                                        cleanupLastIncludeContent();
+                                        $animate.enter(clone, null, $element, afterAnimation);
+                                    });
+
+                                    currentScope = newScope;
+                                    currentElement = clone;
+
+                                    currentScope.$emit('$includeContentLoaded');
+                                    scope.$eval(onloadExp);
+                                }).error(function() {
+                                    if (thisChangeId === changeCounter) cleanupLastIncludeContent();
+                                });
+                                scope.$emit('$includeContentRequested');
+                            } else {
+                                cleanupLastIncludeContent();
+                                ctrl.template = null;
+                            }
+                        });
+                    };
+                }
+            };
+        }];
+
+// This directive is called during the $transclude call of the first `ngInclude` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngInclude
+// is called.
+    var ngIncludeFillContentDirective = ['$compile',
+        function($compile) {
+            return {
+                restrict: 'ECA',
+                priority: -400,
+                require: 'ngInclude',
+                link: function(scope, $element, $attr, ctrl) {
+                    $element.html(ctrl.template);
+                    $compile($element.contents())(scope);
+                }
+            };
+        }];
+
+    /**
+     * @ngdoc directive
+     * @name ngInit
+     * @restrict AC
+     *
+     * @description
+     * The `ngInit` directive allows you to evaluate an expression in the
+     * current scope.
+     *
+     * <div class="alert alert-error">
+     * The only appropriate use of `ngInit` is for aliasing special properties of
+     * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you
+     * should use {@link guide/controller controllers} rather than `ngInit`
+     * to initialize values on a scope.
+     * </div>
+     * <div class="alert alert-warning">
+     * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make
+     * sure you have parenthesis for correct precedence:
+     * <pre class="prettyprint">
+     *   <div ng-init="test1 = (data | orderBy:'name')"></div>
+     * </pre>
+     * </div>
+     *
+     * @priority 450
+     *
+     * @element ANY
+     * @param {expression} ngInit {@link guide/expression Expression} to eval.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+       $scope.list = [['a', 'b'], ['c', 'd']];
+     }
+     </script>
+     <div ng-controller="Ctrl">
+     <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
+     <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
+     <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
+     </div>
+     </div>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should alias index positions', function() {
+         var elements = element.all(by.css('.example-init'));
+         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
+         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
+         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
+         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
+       });
+     </file>
+     </example>
+     */
+    var ngInitDirective = ngDirective({
+        priority: 450,
+        compile: function() {
+            return {
+                pre: function(scope, element, attrs) {
+                    scope.$eval(attrs.ngInit);
+                }
+            };
+        }
+    });
+
+    /**
+     * @ngdoc directive
+     * @name ngNonBindable
+     * @restrict AC
+     * @priority 1000
+     *
+     * @description
+     * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current
+     * DOM element. This is useful if the element contains what appears to be Angular directives and
+     * bindings but which should be ignored by Angular. This could be the case if you have a site that
+     * displays snippets of code, for instance.
+     *
+     * @element ANY
+     *
+     * @example
+     * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
+     * but the one wrapped in `ngNonBindable` is left alone.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <div>Normal: {{1 + 2}}</div>
+     <div ng-non-bindable>Ignored: {{1 + 2}}</div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-non-bindable', function() {
+         expect(element(by.binding('1 + 2')).getText()).toContain('3');
+         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
+       });
+     </file>
+     </example>
+     */
+    var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
+
+    /**
+     * @ngdoc directive
+     * @name ngPluralize
+     * @restrict EA
+     *
+     * @description
+     * `ngPluralize` is a directive that displays messages according to en-US localization rules.
+     * These rules are bundled with angular.js, but can be overridden
+     * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
+     * by specifying the mappings between
+     * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+     * and the strings to be displayed.
+     *
+     * # Plural categories and explicit number rules
+     * There are two
+     * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+     * in Angular's default en-US locale: "one" and "other".
+     *
+     * While a plural category may match many numbers (for example, in en-US locale, "other" can match
+     * any number that is not 1), an explicit number rule can only match one number. For example, the
+     * explicit number rule for "3" matches the number 3. There are examples of plural categories
+     * and explicit number rules throughout the rest of this documentation.
+     *
+     * # Configuring ngPluralize
+     * You configure ngPluralize by providing 2 attributes: `count` and `when`.
+     * You can also provide an optional attribute, `offset`.
+     *
+     * The value of the `count` attribute can be either a string or an {@link guide/expression
+ * Angular expression}; these are evaluated on the current scope for its bound value.
+     *
+     * The `when` attribute specifies the mappings between plural categories and the actual
+     * string to be displayed. The value of the attribute should be a JSON object.
+     *
+     * The following example shows how to configure ngPluralize:
+     *
+     * ```html
+     * <ng-pluralize count="personCount"
+     when="{'0': 'Nobody is viewing.',
+ *                      'one': '1 person is viewing.',
+ *                      'other': '{} people are viewing.'}">
+     * </ng-pluralize>
+     *```
+     *
+     * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
+     * specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
+     * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
+     * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
+     * show "a dozen people are viewing".
+     *
+     * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
+     * into pluralized strings. In the previous example, Angular will replace `{}` with
+     * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
+     * for <span ng-non-bindable>{{numberExpression}}</span>.
+     *
+     * # Configuring ngPluralize with offset
+     * The `offset` attribute allows further customization of pluralized text, which can result in
+     * a better user experience. For example, instead of the message "4 people are viewing this document",
+     * you might display "John, Kate and 2 others are viewing this document".
+     * The offset attribute allows you to offset a number by any desired value.
+     * Let's take a look at an example:
+     *
+     * ```html
+     * <ng-pluralize count="personCount" offset=2
+     *               when="{'0': 'Nobody is viewing.',
+ *                      '1': '{{person1}} is viewing.',
+ *                      '2': '{{person1}} and {{person2}} are viewing.',
+ *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+     * </ng-pluralize>
+     * ```
+     *
+     * Notice that we are still using two plural categories(one, other), but we added
+     * three explicit number rules 0, 1 and 2.
+     * When one person, perhaps John, views the document, "John is viewing" will be shown.
+     * When three people view the document, no explicit number rule is found, so
+     * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
+     * In this case, plural category 'one' is matched and "John, Marry and one other person are viewing"
+     * is shown.
+     *
+     * Note that when you specify offsets, you must provide explicit number rules for
+     * numbers from 0 up to and including the offset. If you use an offset of 3, for example,
+     * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
+     * plural categories "one" and "other".
+     *
+     * @param {string|expression} count The variable to be bound to.
+     * @param {string} when The mapping between plural category to its corresponding strings.
+     * @param {number=} offset Offset to deduct from the total number.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+            $scope.person1 = 'Igor';
+            $scope.person2 = 'Misko';
+            $scope.personCount = 1;
+          }
+     </script>
+     <div ng-controller="Ctrl">
+     Person 1:<input type="text" ng-model="person1" value="Igor" /><br/>
+     Person 2:<input type="text" ng-model="person2" value="Misko" /><br/>
+     Number of People:<input type="text" ng-model="personCount" value="1" /><br/>
+
+     <!--- Example with simple pluralization rules for en locale --->
+     Without Offset:
+     <ng-pluralize count="personCount"
+     when="{'0': 'Nobody is viewing.',
+                               'one': '1 person is viewing.',
+                               'other': '{} people are viewing.'}">
+     </ng-pluralize><br>
+
+     <!--- Example with offset --->
+     With Offset(2):
+     <ng-pluralize count="personCount" offset=2
+     when="{'0': 'Nobody is viewing.',
+                               '1': '{{person1}} is viewing.',
+                               '2': '{{person1}} and {{person2}} are viewing.',
+                               'one': '{{person1}}, {{person2}} and one other person are viewing.',
+                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+     </ng-pluralize>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should show correct pluralized string', function() {
+          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
+          var withOffset = element.all(by.css('ng-pluralize')).get(1);
+          var countInput = element(by.model('personCount'));
+
+          expect(withoutOffset.getText()).toEqual('1 person is viewing.');
+          expect(withOffset.getText()).toEqual('Igor is viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('0');
+
+          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
+          expect(withOffset.getText()).toEqual('Nobody is viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('2');
+
+          expect(withoutOffset.getText()).toEqual('2 people are viewing.');
+          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('3');
+
+          expect(withoutOffset.getText()).toEqual('3 people are viewing.');
+          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('4');
+
+          expect(withoutOffset.getText()).toEqual('4 people are viewing.');
+          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
+        });
+     it('should show data-bound names', function() {
+          var withOffset = element.all(by.css('ng-pluralize')).get(1);
+          var personCount = element(by.model('personCount'));
+          var person1 = element(by.model('person1'));
+          var person2 = element(by.model('person2'));
+          personCount.clear();
+          personCount.sendKeys('4');
+          person1.clear();
+          person1.sendKeys('Di');
+          person2.clear();
+          person2.sendKeys('Vojta');
+          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
+        });
+     </file>
+     </example>
+     */
+    var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) {
+        var BRACE = /{}/g;
+        return {
+            restrict: 'EA',
+            link: function(scope, element, attr) {
+                var numberExp = attr.count,
+                    whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs
+                    offset = attr.offset || 0,
+                    whens = scope.$eval(whenExp) || {},
+                    whensExpFns = {},
+                    startSymbol = $interpolate.startSymbol(),
+                    endSymbol = $interpolate.endSymbol(),
+                    isWhen = /^when(Minus)?(.+)$/;
+
+                forEach(attr, function(expression, attributeName) {
+                    if (isWhen.test(attributeName)) {
+                        whens[lowercase(attributeName.replace('when', '').replace('Minus', '-'))] =
+                            element.attr(attr.$attr[attributeName]);
+                    }
+                });
+                forEach(whens, function(expression, key) {
+                    whensExpFns[key] =
+                        $interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
+                        offset + endSymbol));
+                });
+
+                scope.$watch(function ngPluralizeWatch() {
+                    var value = parseFloat(scope.$eval(numberExp));
+
+                    if (!isNaN(value)) {
+                        //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,
+                        //check it against pluralization rules in $locale service
+                        if (!(value in whens)) value = $locale.pluralCat(value - offset);
+                        return whensExpFns[value](scope, element, true);
+                    } else {
+                        return '';
+                    }
+                }, function ngPluralizeWatchAction(newVal) {
+                    element.text(newVal);
+                });
+            }
+        };
+    }];
+
+    /**
+     * @ngdoc directive
+     * @name ngRepeat
+     *
+     * @description
+     * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
+     * instance gets its own scope, where the given loop variable is set to the current collection item,
+     * and `$index` is set to the item index or key.
+     *
+     * Special properties are exposed on the local scope of each template instance, including:
+     *
+     * | Variable  | Type            | Details                                                                     |
+     * |-----------|-----------------|-----------------------------------------------------------------------------|
+     * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |
+     * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |
+     * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
+     * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |
+     * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |
+     * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |
+     *
+     * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.
+     * This may be useful when, for instance, nesting ngRepeats.
+     *
+     * # Special repeat start and end points
+     * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
+     * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
+     * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
+     * up to and including the ending HTML tag where **ng-repeat-end** is placed.
+     *
+     * The example below makes use of this feature:
+     * ```html
+     *   <header ng-repeat-start="item in items">
+     *     Header {{ item }}
+     *   </header>
+     *   <div class="body">
+     *     Body {{ item }}
+     *   </div>
+     *   <footer ng-repeat-end>
+     *     Footer {{ item }}
+     *   </footer>
+     * ```
+     *
+     * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
+     * ```html
+     *   <header>
+     *     Header A
+     *   </header>
+     *   <div class="body">
+     *     Body A
+     *   </div>
+     *   <footer>
+     *     Footer A
+     *   </footer>
+     *   <header>
+     *     Header B
+     *   </header>
+     *   <div class="body">
+     *     Body B
+     *   </div>
+     *   <footer>
+     *     Footer B
+     *   </footer>
+     * ```
+     *
+     * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
+     * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
+     *
+     * @animations
+     * **.enter** - when a new item is added to the list or when an item is revealed after a filter
+     *
+     * **.leave** - when an item is removed from the list or when an item is filtered out
+     *
+     * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered
+     *
+     * @element ANY
+     * @scope
+     * @priority 1000
+     * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These
+     *   formats are currently supported:
+     *
+     *   * `variable in expression` – where variable is the user defined loop variable and `expression`
+     *     is a scope expression giving the collection to enumerate.
+     *
+     *     For example: `album in artist.albums`.
+     *
+     *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
+     *     and `expression` is the scope expression giving the collection to enumerate.
+     *
+     *     For example: `(name, age) in {'adam':10, 'amalie':12}`.
+     *
+     *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking function
+     *     which can be used to associate the objects in the collection with the DOM elements. If no tracking function
+     *     is specified the ng-repeat associates elements by identity in the collection. It is an error to have
+     *     more than one tracking function to resolve to the same key. (This would mean that two distinct objects are
+     *     mapped to the same DOM element, which is not possible.)  Filters should be applied to the expression,
+     *     before specifying a tracking expression.
+     *
+     *     For example: `item in items` is equivalent to `item in items track by $id(item)'. This implies that the DOM elements
+     *     will be associated by item identity in the array.
+     *
+     *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
+     *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
+     *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM
+     *     element in the same way in the DOM.
+     *
+     *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
+     *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`
+     *     property is same.
+     *
+     *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
+     *     to items in conjunction with a tracking expression.
+     *
+     * @example
+     * This example initializes the scope to a list of names and
+     * then uses `ngRepeat` to display every person:
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     <div ng-init="friends = [
+     {name:'John', age:25, gender:'boy'},
+     {name:'Jessie', age:30, gender:'girl'},
+     {name:'Johanna', age:28, gender:'girl'},
+     {name:'Joy', age:15, gender:'girl'},
+     {name:'Mary', age:28, gender:'girl'},
+     {name:'Peter', age:95, gender:'boy'},
+     {name:'Sebastian', age:50, gender:'boy'},
+     {name:'Erika', age:27, gender:'girl'},
+     {name:'Patrick', age:40, gender:'boy'},
+     {name:'Samantha', age:60, gender:'girl'}
+     ]">
+     I have {{friends.length}} friends. They are:
+     <input type="search" ng-model="q" placeholder="filter friends..." />
+     <ul class="example-animate-container">
+     <li class="animate-repeat" ng-repeat="friend in friends | filter:q">
+     [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
+     </li>
+     </ul>
+     </div>
+     </file>
+     <file name="animations.css">
+     .example-animate-container {
+        background:white;
+        border:1px solid black;
+        list-style:none;
+        margin:0;
+        padding:0 10px;
+      }
+
+     .animate-repeat {
+        line-height:40px;
+        list-style:none;
+        box-sizing:border-box;
+      }
+
+     .animate-repeat.ng-move,
+     .animate-repeat.ng-enter,
+     .animate-repeat.ng-leave {
+        -webkit-transition:all linear 0.5s;
+        transition:all linear 0.5s;
+      }
+
+     .animate-repeat.ng-leave.ng-leave-active,
+     .animate-repeat.ng-move,
+     .animate-repeat.ng-enter {
+        opacity:0;
+        max-height:0;
+      }
+
+     .animate-repeat.ng-leave,
+     .animate-repeat.ng-move.ng-move-active,
+     .animate-repeat.ng-enter.ng-enter-active {
+        opacity:1;
+        max-height:40px;
+      }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var friends = element.all(by.repeater('friend in friends'));
+
+     it('should render initial data set', function() {
+        expect(friends.count()).toBe(10);
+        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
+        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
+        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
+        expect(element(by.binding('friends.length')).getText())
+            .toMatch("I have 10 friends. They are:");
+      });
+
+     it('should update repeater when filter predicate changes', function() {
+         expect(friends.count()).toBe(10);
+
+         element(by.model('q')).sendKeys('ma');
+
+         expect(friends.count()).toBe(2);
+         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
+         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
+       });
+     </file>
+     </example>
+     */
+    var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
+        var NG_REMOVED = '$$NG_REMOVED';
+        var ngRepeatMinErr = minErr('ngRepeat');
+        return {
+            transclude: 'element',
+            priority: 1000,
+            terminal: true,
+            $$tlb: true,
+            link: function($scope, $element, $attr, ctrl, $transclude){
+                var expression = $attr.ngRepeat;
+                var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),
+                    trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn,
+                    lhs, rhs, valueIdentifier, keyIdentifier,
+                    hashFnLocals = {$id: hashKey};
+
+                if (!match) {
+                    throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
+                        expression);
+                }
+
+                lhs = match[1];
+                rhs = match[2];
+                trackByExp = match[3];
+
+                if (trackByExp) {
+                    trackByExpGetter = $parse(trackByExp);
+                    trackByIdExpFn = function(key, value, index) {
+                        // assign key, value, and $index to the locals so that they can be used in hash functions
+                        if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
+                        hashFnLocals[valueIdentifier] = value;
+                        hashFnLocals.$index = index;
+                        return trackByExpGetter($scope, hashFnLocals);
+                    };
+                } else {
+                    trackByIdArrayFn = function(key, value) {
+                        return hashKey(value);
+                    };
+                    trackByIdObjFn = function(key) {
+                        return key;
+                    };
+                }
+
+                match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);
+                if (!match) {
+                    throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
+                        lhs);
+                }
+                valueIdentifier = match[3] || match[1];
+                keyIdentifier = match[2];
+
+                // Store a list of elements from previous run. This is a hash where key is the item from the
+                // iterator, and the value is objects with following properties.
+                //   - scope: bound scope
+                //   - element: previous element.
+                //   - index: position
+                var lastBlockMap = {};
+
+                //watch props
+                $scope.$watchCollection(rhs, function ngRepeatAction(collection){
+                    var index, length,
+                        previousNode = $element[0],     // current position of the node
+                        nextNode,
+                    // Same as lastBlockMap but it has the current state. It will become the
+                    // lastBlockMap on the next iteration.
+                        nextBlockMap = {},
+                        arrayLength,
+                        childScope,
+                        key, value, // key/value of iteration
+                        trackById,
+                        trackByIdFn,
+                        collectionKeys,
+                        block,       // last object information {scope, element, id}
+                        nextBlockOrder = [],
+                        elementsToRemove;
+
+
+                    if (isArrayLike(collection)) {
+                        collectionKeys = collection;
+                        trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
+                    } else {
+                        trackByIdFn = trackByIdExpFn || trackByIdObjFn;
+                        // if object, extract keys, sort them and use to determine order of iteration over obj props
+                        collectionKeys = [];
+                        for (key in collection) {
+                            if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {
+                                collectionKeys.push(key);
+                            }
+                        }
+                        collectionKeys.sort();
+                    }
+
+                    arrayLength = collectionKeys.length;
+
+                    // locate existing items
+                    length = nextBlockOrder.length = collectionKeys.length;
+                    for(index = 0; index < length; index++) {
+                        key = (collection === collectionKeys) ? index : collectionKeys[index];
+                        value = collection[key];
+                        trackById = trackByIdFn(key, value, index);
+                        assertNotHasOwnProperty(trackById, '`track by` id');
+                        if(lastBlockMap.hasOwnProperty(trackById)) {
+                            block = lastBlockMap[trackById];
+                            delete lastBlockMap[trackById];
+                            nextBlockMap[trackById] = block;
+                            nextBlockOrder[index] = block;
+                        } else if (nextBlockMap.hasOwnProperty(trackById)) {
+                            // restore lastBlockMap
+                            forEach(nextBlockOrder, function(block) {
+                                if (block && block.scope) lastBlockMap[block.id] = block;
+                            });
+                            // This is a duplicate and we need to throw an error
+                            throw ngRepeatMinErr('dupes', "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",
+                                expression,       trackById);
+                        } else {
+                            // new never before seen block
+                            nextBlockOrder[index] = { id: trackById };
+                            nextBlockMap[trackById] = false;
+                        }
+                    }
+
+                    // remove existing items
+                    for (key in lastBlockMap) {
+                        // lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn
+                        if (lastBlockMap.hasOwnProperty(key)) {
+                            block = lastBlockMap[key];
+                            elementsToRemove = getBlockElements(block.clone);
+                            $animate.leave(elementsToRemove);
+                            forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; });
+                            block.scope.$destroy();
+                        }
+                    }
+
+                    // we are not using forEach for perf reasons (trying to avoid #call)
+                    for (index = 0, length = collectionKeys.length; index < length; index++) {
+                        key = (collection === collectionKeys) ? index : collectionKeys[index];
+                        value = collection[key];
+                        block = nextBlockOrder[index];
+                        if (nextBlockOrder[index - 1]) previousNode = getBlockEnd(nextBlockOrder[index - 1]);
+
+                        if (block.scope) {
+                            // if we have already seen this object, then we need to reuse the
+                            // associated scope/element
+                            childScope = block.scope;
+
+                            nextNode = previousNode;
+                            do {
+                                nextNode = nextNode.nextSibling;
+                            } while(nextNode && nextNode[NG_REMOVED]);
+
+                            if (getBlockStart(block) != nextNode) {
+                                // existing item which got moved
+                                $animate.move(getBlockElements(block.clone), null, jqLite(previousNode));
+                            }
+                            previousNode = getBlockEnd(block);
+                        } else {
+                            // new item which we don't know about
+                            childScope = $scope.$new();
+                        }
+
+                        childScope[valueIdentifier] = value;
+                        if (keyIdentifier) childScope[keyIdentifier] = key;
+                        childScope.$index = index;
+                        childScope.$first = (index === 0);
+                        childScope.$last = (index === (arrayLength - 1));
+                        childScope.$middle = !(childScope.$first || childScope.$last);
+                        // jshint bitwise: false
+                        childScope.$odd = !(childScope.$even = (index&1) === 0);
+                        // jshint bitwise: true
+
+                        if (!block.scope) {
+                            $transclude(childScope, function(clone) {
+                                clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');
+                                $animate.enter(clone, null, jqLite(previousNode));
+                                previousNode = clone;
+                                block.scope = childScope;
+                                // Note: We only need the first/last node of the cloned nodes.
+                                // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+                                // by a directive with templateUrl when it's template arrives.
+                                block.clone = clone;
+                                nextBlockMap[block.id] = block;
+                            });
+                        }
+                    }
+                    lastBlockMap = nextBlockMap;
+                });
+            }
+        };
+
+        function getBlockStart(block) {
+            return block.clone[0];
+        }
+
+        function getBlockEnd(block) {
+            return block.clone[block.clone.length - 1];
+        }
+    }];
+
+    /**
+     * @ngdoc directive
+     * @name ngShow
+     *
+     * @description
+     * The `ngShow` directive shows or hides the given HTML element based on the expression
+     * provided to the ngShow attribute. The element is shown or hidden by removing or adding
+     * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+     * in AngularJS and sets the display style to none (using an !important flag).
+     * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+     *
+     * ```html
+     * <!-- when $scope.myValue is truthy (element is visible) -->
+     * <div ng-show="myValue"></div>
+     *
+     * <!-- when $scope.myValue is falsy (element is hidden) -->
+     * <div ng-show="myValue" class="ng-hide"></div>
+     * ```
+     *
+     * When the ngShow expression evaluates to false then the ng-hide CSS class is added to the class attribute
+     * on the element causing it to become hidden. When true, the ng-hide CSS class is removed
+     * from the element causing the element not to appear hidden.
+     *
+     * ## Why is !important used?
+     *
+     * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector
+     * can be easily overridden by heavier selectors. For example, something as simple
+     * as changing the display style on a HTML list item would make hidden elements appear visible.
+     * This also becomes a bigger issue when dealing with CSS frameworks.
+     *
+     * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+     * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+     * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+     *
+     * ### Overriding .ng-hide
+     *
+     * If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by
+     * restating the styles for the .ng-hide class in CSS:
+     * ```css
+     * .ng-hide {
+ *   //!annotate CSS Specificity|Not to worry, this will override the AngularJS default...
+ *   display:block!important;
+ *
+ *   //this is just another form of hiding an element
+ *   position:absolute;
+ *   top:-9999px;
+ *   left:-9999px;
+ * }
+     * ```
+     *
+     * Just remember to include the important flag so the CSS override will function.
+     *
+     * <div class="alert alert-warning">
+     * **Note:** Here is a list of values that ngShow will consider as a falsy value (case insensitive):<br />
+     * "f" / "0" / "false" / "no" / "n" / "[]"
+     * </div>
+     *
+     * ## A note about animations with ngShow
+     *
+     * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+     * is true and false. This system works like the animation system present with ngClass except that
+     * you must also include the !important flag to override the display property
+     * so that you can perform an animation when the element is hidden during the time of the animation.
+     *
+     * ```css
+     * //
+     * //a working example can be found at the bottom of this page
+     * //
+     * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ *   transition:0.5s linear all;
+ *   display:block!important;
+ * }
+     *
+     * .my-element.ng-hide-add { ... }
+     * .my-element.ng-hide-add.ng-hide-add-active { ... }
+     * .my-element.ng-hide-remove { ... }
+     * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+     * ```
+     *
+     * @animations
+     * addClass: .ng-hide - happens after the ngShow expression evaluates to a truthy value and the just before contents are set to visible
+     * removeClass: .ng-hide - happens after the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden
+     *
+     * @element ANY
+     * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+     *     then the element is shown or hidden respectively.
+     *
+     * @example
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     Click me: <input type="checkbox" ng-model="checked"><br/>
+     <div>
+     Show:
+     <div class="check-element animate-show" ng-show="checked">
+     <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+     </div>
+     </div>
+     <div>
+     Hide:
+     <div class="check-element animate-show" ng-hide="checked">
+     <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+     </div>
+     </div>
+     </file>
+     <file name="glyphicons.css">
+     @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);
+     </file>
+     <file name="animations.css">
+     .animate-show {
+        -webkit-transition:all linear 0.5s;
+        transition:all linear 0.5s;
+        line-height:20px;
+        opacity:1;
+        padding:10px;
+        border:1px solid black;
+        background:white;
+      }
+
+     .animate-show.ng-hide-add,
+     .animate-show.ng-hide-remove {
+        display:block!important;
+      }
+
+     .animate-show.ng-hide {
+        line-height:0;
+        opacity:0;
+        padding:0 10px;
+      }
+
+     .check-element {
+        padding:10px;
+        border:1px solid black;
+        background:white;
+      }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+     var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+     it('should check ng-show / ng-hide', function() {
+        expect(thumbsUp.isDisplayed()).toBeFalsy();
+        expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+        element(by.model('checked')).click();
+
+        expect(thumbsUp.isDisplayed()).toBeTruthy();
+        expect(thumbsDown.isDisplayed()).toBeFalsy();
+      });
+     </file>
+     </example>
+     */
+    var ngShowDirective = ['$animate', function($animate) {
+        return function(scope, element, attr) {
+            scope.$watch(attr.ngShow, function ngShowWatchAction(value){
+                $animate[toBoolean(value) ? 'removeClass' : 'addClass'](element, 'ng-hide');
+            });
+        };
+    }];
+
+
+    /**
+     * @ngdoc directive
+     * @name ngHide
+     *
+     * @description
+     * The `ngHide` directive shows or hides the given HTML element based on the expression
+     * provided to the ngHide attribute. The element is shown or hidden by removing or adding
+     * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+     * in AngularJS and sets the display style to none (using an !important flag).
+     * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+     *
+     * ```html
+     * <!-- when $scope.myValue is truthy (element is hidden) -->
+     * <div ng-hide="myValue"></div>
+     *
+     * <!-- when $scope.myValue is falsy (element is visible) -->
+     * <div ng-hide="myValue" class="ng-hide"></div>
+     * ```
+     *
+     * When the ngHide expression evaluates to true then the .ng-hide CSS class is added to the class attribute
+     * on the element causing it to become hidden. When false, the ng-hide CSS class is removed
+     * from the element causing the element not to appear hidden.
+     *
+     * ## Why is !important used?
+     *
+     * You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector
+     * can be easily overridden by heavier selectors. For example, something as simple
+     * as changing the display style on a HTML list item would make hidden elements appear visible.
+     * This also becomes a bigger issue when dealing with CSS frameworks.
+     *
+     * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+     * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+     * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+     *
+     * ### Overriding .ng-hide
+     *
+     * If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by
+     * restating the styles for the .ng-hide class in CSS:
+     * ```css
+     * .ng-hide {
+ *   //!annotate CSS Specificity|Not to worry, this will override the AngularJS default...
+ *   display:block!important;
+ *
+ *   //this is just another form of hiding an element
+ *   position:absolute;
+ *   top:-9999px;
+ *   left:-9999px;
+ * }
+     * ```
+     *
+     * Just remember to include the important flag so the CSS override will function.
+     *
+     * <div class="alert alert-warning">
+     * **Note:** Here is a list of values that ngHide will consider as a falsy value (case insensitive):<br />
+     * "f" / "0" / "false" / "no" / "n" / "[]"
+     * </div>
+     *
+     * ## A note about animations with ngHide
+     *
+     * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+     * is true and false. This system works like the animation system present with ngClass, except that
+     * you must also include the !important flag to override the display property so
+     * that you can perform an animation when the element is hidden during the time of the animation.
+     *
+     * ```css
+     * //
+     * //a working example can be found at the bottom of this page
+     * //
+     * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ *   transition:0.5s linear all;
+ *   display:block!important;
+ * }
+     *
+     * .my-element.ng-hide-add { ... }
+     * .my-element.ng-hide-add.ng-hide-add-active { ... }
+     * .my-element.ng-hide-remove { ... }
+     * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+     * ```
+     *
+     * @animations
+     * removeClass: .ng-hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden
+     * addClass: .ng-hide - happens after the ngHide expression evaluates to a non truthy value and just before the contents are set to visible
+     *
+     * @element ANY
+     * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+     *     the element is shown or hidden respectively.
+     *
+     * @example
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     Click me: <input type="checkbox" ng-model="checked"><br/>
+     <div>
+     Show:
+     <div class="check-element animate-hide" ng-show="checked">
+     <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+     </div>
+     </div>
+     <div>
+     Hide:
+     <div class="check-element animate-hide" ng-hide="checked">
+     <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+     </div>
+     </div>
+     </file>
+     <file name="glyphicons.css">
+     @import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);
+     </file>
+     <file name="animations.css">
+     .animate-hide {
+        -webkit-transition:all linear 0.5s;
+        transition:all linear 0.5s;
+        line-height:20px;
+        opacity:1;
+        padding:10px;
+        border:1px solid black;
+        background:white;
+      }
+
+     .animate-hide.ng-hide-add,
+     .animate-hide.ng-hide-remove {
+        display:block!important;
+      }
+
+     .animate-hide.ng-hide {
+        line-height:0;
+        opacity:0;
+        padding:0 10px;
+      }
+
+     .check-element {
+        padding:10px;
+        border:1px solid black;
+        background:white;
+      }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+     var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+     it('should check ng-show / ng-hide', function() {
+        expect(thumbsUp.isDisplayed()).toBeFalsy();
+        expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+        element(by.model('checked')).click();
+
+        expect(thumbsUp.isDisplayed()).toBeTruthy();
+        expect(thumbsDown.isDisplayed()).toBeFalsy();
+      });
+     </file>
+     </example>
+     */
+    var ngHideDirective = ['$animate', function($animate) {
+        return function(scope, element, attr) {
+            scope.$watch(attr.ngHide, function ngHideWatchAction(value){
+                $animate[toBoolean(value) ? 'addClass' : 'removeClass'](element, 'ng-hide');
+            });
+        };
+    }];
+
+    /**
+     * @ngdoc directive
+     * @name ngStyle
+     * @restrict AC
+     *
+     * @description
+     * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
+     *
+     * @element ANY
+     * @param {expression} ngStyle {@link guide/expression Expression} which evals to an
+     *      object whose keys are CSS style names and values are corresponding values for those CSS
+     *      keys.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <input type="button" value="set" ng-click="myStyle={color:'red'}">
+     <input type="button" value="clear" ng-click="myStyle={}">
+     <br/>
+     <span ng-style="myStyle">Sample Text</span>
+     <pre>myStyle={{myStyle}}</pre>
+     </file>
+     <file name="style.css">
+     span {
+         color: black;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var colorSpan = element(by.css('span'));
+
+     it('should check ng-style', function() {
+         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+         element(by.css('input[value=set]')).click();
+         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
+         element(by.css('input[value=clear]')).click();
+         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+       });
+     </file>
+     </example>
+     */
+    var ngStyleDirective = ngDirective(function(scope, element, attr) {
+        scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
+            if (oldStyles && (newStyles !== oldStyles)) {
+                forEach(oldStyles, function(val, style) { element.css(style, '');});
+            }
+            if (newStyles) element.css(newStyles);
+        }, true);
+    });
+
+    /**
+     * @ngdoc directive
+     * @name ngSwitch
+     * @restrict EA
+     *
+     * @description
+     * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
+     * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
+     * as specified in the template.
+     *
+     * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
+     * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
+     * matches the value obtained from the evaluated expression. In other words, you define a container element
+     * (where you place the directive), place an expression on the **`on="..."` attribute**
+     * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
+     * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
+     * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
+     * attribute is displayed.
+     *
+     * <div class="alert alert-info">
+     * Be aware that the attribute values to match against cannot be expressions. They are interpreted
+     * as literal string values to match against.
+     * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
+     * value of the expression `$scope.someVal`.
+     * </div>
+
+     * @animations
+     * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
+     * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
+     *
+     * @usage
+     * <ANY ng-switch="expression">
+     *   <ANY ng-switch-when="matchValue1">...</ANY>
+     *   <ANY ng-switch-when="matchValue2">...</ANY>
+     *   <ANY ng-switch-default>...</ANY>
+     * </ANY>
+     *
+     *
+     * @scope
+     * @priority 800
+     * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
+     * On child elements add:
+     *
+     * * `ngSwitchWhen`: the case statement to match against. If match then this
+     *   case will be displayed. If the same match appears multiple times, all the
+     *   elements will be displayed.
+     * * `ngSwitchDefault`: the default case when no other case match. If there
+     *   are multiple default cases, all of them will be displayed when no other
+     *   case match.
+     *
+     *
+     * @example
+     <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+     <div ng-controller="Ctrl">
+     <select ng-model="selection" ng-options="item for item in items">
+     </select>
+     <tt>selection={{selection}}</tt>
+     <hr/>
+     <div class="animate-switch-container"
+     ng-switch on="selection">
+     <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
+     <div class="animate-switch" ng-switch-when="home">Home Span</div>
+     <div class="animate-switch" ng-switch-default>default</div>
+     </div>
+     </div>
+     </file>
+     <file name="script.js">
+     function Ctrl($scope) {
+        $scope.items = ['settings', 'home', 'other'];
+        $scope.selection = $scope.items[0];
+      }
+     </file>
+     <file name="animations.css">
+     .animate-switch-container {
+        position:relative;
+        background:white;
+        border:1px solid black;
+        height:40px;
+        overflow:hidden;
+      }
+
+     .animate-switch {
+        padding:10px;
+      }
+
+     .animate-switch.ng-animate {
+        -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+        position:absolute;
+        top:0;
+        left:0;
+        right:0;
+        bottom:0;
+      }
+
+     .animate-switch.ng-leave.ng-leave-active,
+     .animate-switch.ng-enter {
+        top:-50px;
+      }
+     .animate-switch.ng-leave,
+     .animate-switch.ng-enter.ng-enter-active {
+        top:0;
+      }
+     </file>
+     <file name="protractor.js" type="protractor">
+     var switchElem = element(by.css('[ng-switch]'));
+     var select = element(by.model('selection'));
+
+     it('should start in settings', function() {
+        expect(switchElem.getText()).toMatch(/Settings Div/);
+      });
+     it('should change to home', function() {
+        select.element.all(by.css('option')).get(1).click();
+        expect(switchElem.getText()).toMatch(/Home Span/);
+      });
+     it('should select default', function() {
+        select.element.all(by.css('option')).get(2).click();
+        expect(switchElem.getText()).toMatch(/default/);
+      });
+     </file>
+     </example>
+     */
+    var ngSwitchDirective = ['$animate', function($animate) {
+        return {
+            restrict: 'EA',
+            require: 'ngSwitch',
+
+            // asks for $scope to fool the BC controller module
+            controller: ['$scope', function ngSwitchController() {
+                this.cases = {};
+            }],
+            link: function(scope, element, attr, ngSwitchController) {
+                var watchExpr = attr.ngSwitch || attr.on,
+                    selectedTranscludes,
+                    selectedElements,
+                    previousElements,
+                    selectedScopes = [];
+
+                scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
+                    var i, ii = selectedScopes.length;
+                    if(ii > 0) {
+                        if(previousElements) {
+                            for (i = 0; i < ii; i++) {
+                                previousElements[i].remove();
+                            }
+                            previousElements = null;
+                        }
+
+                        previousElements = [];
+                        for (i= 0; i<ii; i++) {
+                            var selected = selectedElements[i];
+                            selectedScopes[i].$destroy();
+                            previousElements[i] = selected;
+                            $animate.leave(selected, function() {
+                                previousElements.splice(i, 1);
+                                if(previousElements.length === 0) {
+                                    previousElements = null;
+                                }
+                            });
+                        }
+                    }
+
+                    selectedElements = [];
+                    selectedScopes = [];
+
+                    if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
+                        scope.$eval(attr.change);
+                        forEach(selectedTranscludes, function(selectedTransclude) {
+                            var selectedScope = scope.$new();
+                            selectedScopes.push(selectedScope);
+                            selectedTransclude.transclude(selectedScope, function(caseElement) {
+                                var anchor = selectedTransclude.element;
+
+                                selectedElements.push(caseElement);
+                                $animate.enter(caseElement, anchor.parent(), anchor);
+                            });
+                        });
+                    }
+                });
+            }
+        };
+    }];
+
+    var ngSwitchWhenDirective = ngDirective({
+        transclude: 'element',
+        priority: 800,
+        require: '^ngSwitch',
+        link: function(scope, element, attrs, ctrl, $transclude) {
+            ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+            ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
+        }
+    });
+
+    var ngSwitchDefaultDirective = ngDirective({
+        transclude: 'element',
+        priority: 800,
+        require: '^ngSwitch',
+        link: function(scope, element, attr, ctrl, $transclude) {
+            ctrl.cases['?'] = (ctrl.cases['?'] || []);
+            ctrl.cases['?'].push({ transclude: $transclude, element: element });
+        }
+    });
+
+    /**
+     * @ngdoc directive
+     * @name ngTransclude
+     * @restrict AC
+     *
+     * @description
+     * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
+     *
+     * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.
+     *
+     * @element ANY
+     *
+     * @example
+     <example module="transclude">
+     <file name="index.html">
+     <script>
+     function Ctrl($scope) {
+           $scope.title = 'Lorem Ipsum';
+           $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+         }
+
+     angular.module('transclude', [])
+     .directive('pane', function(){
+             return {
+               restrict: 'E',
+               transclude: true,
+               scope: { title:'@' },
+     template: '<div style="border: 1px solid black;">' +
+     '<div style="background-color: gray">{{title}}</div>' +
+     '<div ng-transclude></div>' +
+     '</div>'
+     };
+     });
+     </script>
+     <div ng-controller="Ctrl">
+     <input ng-model="title"><br>
+     <textarea ng-model="text"></textarea> <br/>
+     <pane title="{{title}}">{{text}}</pane>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should have transcluded', function() {
+          var titleElement = element(by.model('title'));
+          titleElement.clear();
+          titleElement.sendKeys('TITLE');
+          var textElement = element(by.model('text'));
+          textElement.clear();
+          textElement.sendKeys('TEXT');
+          expect(element(by.binding('title')).getText()).toEqual('TITLE');
+          expect(element(by.binding('text')).getText()).toEqual('TEXT');
+        });
+     </file>
+     </example>
+     *
+     */
+    var ngTranscludeDirective = ngDirective({
+        link: function($scope, $element, $attrs, controller, $transclude) {
+            if (!$transclude) {
+                throw minErr('ngTransclude')('orphan',
+                    'Illegal use of ngTransclude directive in the template! ' +
+                    'No parent directive that requires a transclusion found. ' +
+                    'Element: {0}',
+                    startingTag($element));
+            }
+
+            $transclude(function(clone) {
+                $element.empty();
+                $element.append(clone);
+            });
+        }
+    });
+
+    /**
+     * @ngdoc directive
+     * @name script
+     * @restrict E
+     *
+     * @description
+     * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the
+     * template can be used by {@link ng.directive:ngInclude `ngInclude`},
+     * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
+     * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
+     * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
+     *
+     * @param {string} type Must be set to `'text/ng-template'`.
+     * @param {string} id Cache name of the template.
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script type="text/ng-template" id="/tpl.html">
+     Content of the template.
+     </script>
+
+     <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
+     <div id="tpl-content" ng-include src="currentTpl"></div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should load template defined inside script tag', function() {
+        element(by.css('#tpl-link')).click();
+        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
+      });
+     </file>
+     </example>
+     */
+    var scriptDirective = ['$templateCache', function($templateCache) {
+        return {
+            restrict: 'E',
+            terminal: true,
+            compile: function(element, attr) {
+                if (attr.type == 'text/ng-template') {
+                    var templateUrl = attr.id,
+                    // IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent
+                        text = element[0].text;
+
+                    $templateCache.put(templateUrl, text);
+                }
+            }
+        };
+    }];
+
+    var ngOptionsMinErr = minErr('ngOptions');
+    /**
+     * @ngdoc directive
+     * @name select
+     * @restrict E
+     *
+     * @description
+     * HTML `SELECT` element with angular data-binding.
+     *
+     * # `ngOptions`
+     *
+     * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
+     * elements for the `<select>` element using the array or object obtained by evaluating the
+     * `ngOptions` comprehension_expression.
+     *
+     * When an item in the `<select>` menu is selected, the array element or object property
+     * represented by the selected option will be bound to the model identified by the `ngModel`
+     * directive.
+     *
+     * <div class="alert alert-warning">
+     * **Note:** `ngModel` compares by reference, not value. This is important when binding to an
+     * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/).
+     * </div>
+     *
+     * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+     * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+     * option. See example below for demonstration.
+     *
+     * <div class="alert alert-warning">
+     * **Note:** `ngOptions` provides an iterator facility for the `<option>` element which should be used instead
+     * of {@link ng.directive:ngRepeat ngRepeat} when you want the
+     * `select` model to be bound to a non-string value. This is because an option element can only
+     * be bound to string values at present.
+     * </div>
+     *
+     * @param {string} ngModel Assignable angular expression to data-bind to.
+     * @param {string=} name Property name of the form under which the control is published.
+     * @param {string=} required The control is considered valid only if value is entered.
+     * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+     *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+     *    `required` when you want to data-bind to the `required` attribute.
+     * @param {comprehension_expression=} ngOptions in one of the following forms:
+     *
+     *   * for array data sources:
+     *     * `label` **`for`** `value` **`in`** `array`
+     *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`
+     *     * `label`  **`group by`** `group` **`for`** `value` **`in`** `array`
+     *     * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+     *   * for object data sources:
+     *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+     *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+     *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+     *     * `select` **`as`** `label` **`group by`** `group`
+     *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+     *
+     * Where:
+     *
+     *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.
+     *   * `value`: local variable which will refer to each item in the `array` or each property value
+     *      of `object` during iteration.
+     *   * `key`: local variable which will refer to a property name in `object` during iteration.
+     *   * `label`: The result of this expression will be the label for `<option>` element. The
+     *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
+     *   * `select`: The result of this expression will be bound to the model of the parent `<select>`
+     *      element. If not specified, `select` expression will default to `value`.
+     *   * `group`: The result of this expression will be used to group options using the `<optgroup>`
+     *      DOM element.
+     *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be
+     *      used to identify the objects in the array. The `trackexpr` will most likely refer to the
+     *     `value` variable (e.g. `value.propertyName`).
+     *
+     * @example
+     <example>
+     <file name="index.html">
+     <script>
+     function MyCntrl($scope) {
+          $scope.colors = [
+            {name:'black', shade:'dark'},
+            {name:'white', shade:'light'},
+            {name:'red', shade:'dark'},
+            {name:'blue', shade:'dark'},
+            {name:'yellow', shade:'light'}
+          ];
+          $scope.color = $scope.colors[2]; // red
+        }
+     </script>
+     <div ng-controller="MyCntrl">
+     <ul>
+     <li ng-repeat="color in colors">
+     Name: <input ng-model="color.name">
+     [<a href ng-click="colors.splice($index, 1)">X</a>]
+     </li>
+     <li>
+     [<a href ng-click="colors.push({})">add</a>]
+     </li>
+     </ul>
+     <hr/>
+     Color (null not allowed):
+     <select ng-model="color" ng-options="c.name for c in colors"></select><br>
+
+     Color (null allowed):
+     <span  class="nullable">
+     <select ng-model="color" ng-options="c.name for c in colors">
+     <option value="">-- choose color --</option>
+     </select>
+     </span><br/>
+
+     Color grouped by shade:
+     <select ng-model="color" ng-options="c.name group by c.shade for c in colors">
+     </select><br/>
+
+
+     Select <a href ng-click="color={name:'not in list'}">bogus</a>.<br>
+     <hr/>
+     Currently selected: {{ {selected_color:color}  }}
+     <div style="border:solid 1px black; height:20px"
+     ng-style="{'background-color':color.name}">
+     </div>
+     </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+     it('should check ng-options', function() {
+           expect(element(by.binding('{selected_color:color}')).getText()).toMatch('red');
+           element.all(by.select('color')).first().click();
+           element.all(by.css('select[ng-model="color"] option')).first().click();
+           expect(element(by.binding('{selected_color:color}')).getText()).toMatch('black');
+           element(by.css('.nullable select[ng-model="color"]')).click();
+           element.all(by.css('.nullable select[ng-model="color"] option')).first().click();
+           expect(element(by.binding('{selected_color:color}')).getText()).toMatch('null');
+         });
+     </file>
+     </example>
+     */
+
+    var ngOptionsDirective = valueFn({ terminal: true });
+// jshint maxlen: false
+    var selectDirective = ['$compile', '$parse', function($compile,   $parse) {
+        //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888
+        var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
+            nullModelCtrl = {$setViewValue: noop};
+// jshint maxlen: 100
+
+        return {
+            restrict: 'E',
+            require: ['select', '?ngModel'],
+            controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
+                var self = this,
+                    optionsMap = {},
+                    ngModelCtrl = nullModelCtrl,
+                    nullOption,
+                    unknownOption;
+
+
+                self.databound = $attrs.ngModel;
+
+
+                self.init = function(ngModelCtrl_, nullOption_, unknownOption_) {
+                    ngModelCtrl = ngModelCtrl_;
+                    nullOption = nullOption_;
+                    unknownOption = unknownOption_;
+                };
+
+
+                self.addOption = function(value) {
+                    assertNotHasOwnProperty(value, '"option value"');
+                    optionsMap[value] = true;
+
+                    if (ngModelCtrl.$viewValue == value) {
+                        $element.val(value);
+                        if (unknownOption.parent()) unknownOption.remove();
+                    }
+                };
+
+
+                self.removeOption = function(value) {
+                    if (this.hasOption(value)) {
+                        delete optionsMap[value];
+                        if (ngModelCtrl.$viewValue == value) {
+                            this.renderUnknownOption(value);
+                        }
+                    }
+                };
+
+
+                self.renderUnknownOption = function(val) {
+                    var unknownVal = '? ' + hashKey(val) + ' ?';
+                    unknownOption.val(unknownVal);
+                    $element.prepend(unknownOption);
+                    $element.val(unknownVal);
+                    unknownOption.prop('selected', true); // needed for IE
+                };
+
+
+                self.hasOption = function(value) {
+                    return optionsMap.hasOwnProperty(value);
+                };
+
+                $scope.$on('$destroy', function() {
+                    // disable unknown option so that we don't do work when the whole select is being destroyed
+                    self.renderUnknownOption = noop;
+                });
+            }],
+
+            link: function(scope, element, attr, ctrls) {
+                // if ngModel is not defined, we don't need to do anything
+                if (!ctrls[1]) return;
+
+                var selectCtrl = ctrls[0],
+                    ngModelCtrl = ctrls[1],
+                    multiple = attr.multiple,
+                    optionsExp = attr.ngOptions,
+                    nullOption = false, // if false, user will not be able to select it (used by ngOptions)
+                    emptyOption,
+                // we can't just jqLite('<option>') since jqLite is not smart enough
+                // to create it in <select> and IE barfs otherwise.
+                    optionTemplate = jqLite(document.createElement('option')),
+                    optGroupTemplate =jqLite(document.createElement('optgroup')),
+                    unknownOption = optionTemplate.clone();
+
+                // find "null" option
+                for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) {
+                    if (children[i].value === '') {
+                        emptyOption = nullOption = children.eq(i);
+                        break;
+                    }
+                }
+
+                selectCtrl.init(ngModelCtrl, nullOption, unknownOption);
+
+                // required validator
+                if (multiple) {
+                    ngModelCtrl.$isEmpty = function(value) {
+                        return !value || value.length === 0;
+                    };
+                }
+
+                if (optionsExp) setupAsOptions(scope, element, ngModelCtrl);
+                else if (multiple) setupAsMultiple(scope, element, ngModelCtrl);
+                else setupAsSingle(scope, element, ngModelCtrl, selectCtrl);
+
+
+                ////////////////////////////
+
+
+
+                function setupAsSingle(scope, selectElement, ngModelCtrl, selectCtrl) {
+                    ngModelCtrl.$render = function() {
+                        var viewValue = ngModelCtrl.$viewValue;
+
+                        if (selectCtrl.hasOption(viewValue)) {
+                            if (unknownOption.parent()) unknownOption.remove();
+                            selectElement.val(viewValue);
+                            if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy
+                        } else {
+                            if (isUndefined(viewValue) && emptyOption) {
+                                selectElement.val('');
+                            } else {
+                                selectCtrl.renderUnknownOption(viewValue);
+                            }
+                        }
+                    };
+
+                    selectElement.on('change', function() {
+                        scope.$apply(function() {
+                            if (unknownOption.parent()) unknownOption.remove();
+                            ngModelCtrl.$setViewValue(selectElement.val());
+                        });
+                    });
+                }
+
+                function setupAsMultiple(scope, selectElement, ctrl) {
+                    var lastView;
+                    ctrl.$render = function() {
+                        var items = new HashMap(ctrl.$viewValue);
+                        forEach(selectElement.find('option'), function(option) {
+                            option.selected = isDefined(items.get(option.value));
+                        });
+                    };
+
+                    // we have to do it on each watch since ngModel watches reference, but
+                    // we need to work of an array, so we need to see if anything was inserted/removed
+                    scope.$watch(function selectMultipleWatch() {
+                        if (!equals(lastView, ctrl.$viewValue)) {
+                            lastView = copy(ctrl.$viewValue);
+                            ctrl.$render();
+                        }
+                    });
+
+                    selectElement.on('change', function() {
+                        scope.$apply(function() {
+                            var array = [];
+                            forEach(selectElement.find('option'), function(option) {
+                                if (option.selected) {
+                                    array.push(option.value);
+                                }
+                            });
+                            ctrl.$setViewValue(array);
+                        });
+                    });
+                }
+
+                function setupAsOptions(scope, selectElement, ctrl) {
+                    var match;
+
+                    if (!(match = optionsExp.match(NG_OPTIONS_REGEXP))) {
+                        throw ngOptionsMinErr('iexp',
+                            "Expected expression in form of " +
+                            "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+                            " but got '{0}'. Element: {1}",
+                            optionsExp, startingTag(selectElement));
+                    }
+
+                    var displayFn = $parse(match[2] || match[1]),
+                        valueName = match[4] || match[6],
+                        keyName = match[5],
+                        groupByFn = $parse(match[3] || ''),
+                        valueFn = $parse(match[2] ? match[1] : valueName),
+                        valuesFn = $parse(match[7]),
+                        track = match[8],
+                        trackFn = track ? $parse(match[8]) : null,
+                    // This is an array of array of existing option groups in DOM.
+                    // We try to reuse these if possible
+                    // - optionGroupsCache[0] is the options with no option group
+                    // - optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element
+                        optionGroupsCache = [[{element: selectElement, label:''}]];
+
+                    if (nullOption) {
+                        // compile the element since there might be bindings in it
+                        $compile(nullOption)(scope);
+
+                        // remove the class, which is added automatically because we recompile the element and it
+                        // becomes the compilation root
+                        nullOption.removeClass('ng-scope');
+
+                        // we need to remove it before calling selectElement.empty() because otherwise IE will
+                        // remove the label from the element. wtf?
+                        nullOption.remove();
+                    }
+
+                    // clear contents, we'll add what's needed based on the model
+                    selectElement.empty();
+
+                    selectElement.on('change', function() {
+                        scope.$apply(function() {
+                            var optionGroup,
+                                collection = valuesFn(scope) || [],
+                                locals = {},
+                                key, value, optionElement, index, groupIndex, length, groupLength, trackIndex;
+
+                            if (multiple) {
+                                value = [];
+                                for (groupIndex = 0, groupLength = optionGroupsCache.length;
+                                     groupIndex < groupLength;
+                                     groupIndex++) {
+                                    // list of options for that group. (first item has the parent)
+                                    optionGroup = optionGroupsCache[groupIndex];
+
+                                    for(index = 1, length = optionGroup.length; index < length; index++) {
+                                        if ((optionElement = optionGroup[index].element)[0].selected) {
+                                            key = optionElement.val();
+                                            if (keyName) locals[keyName] = key;
+                                            if (trackFn) {
+                                                for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {
+                                                    locals[valueName] = collection[trackIndex];
+                                                    if (trackFn(scope, locals) == key) break;
+                                                }
+                                            } else {
+                                                locals[valueName] = collection[key];
+                                            }
+                                            value.push(valueFn(scope, locals));
+                                        }
+                                    }
+                                }
+                            } else {
+                                key = selectElement.val();
+                                if (key == '?') {
+                                    value = undefined;
+                                } else if (key === ''){
+                                    value = null;
+                                } else {
+                                    if (trackFn) {
+                                        for (trackIndex = 0; trackIndex < collection.length; trackIndex++) {
+                                            locals[valueName] = collection[trackIndex];
+                                            if (trackFn(scope, locals) == key) {
+                                                value = valueFn(scope, locals);
+                                                break;
+                                            }
+                                        }
+                                    } else {
+                                        locals[valueName] = collection[key];
+                                        if (keyName) locals[keyName] = key;
+                                        value = valueFn(scope, locals);
+                                    }
+                                }
+                                // Update the null option's selected property here so $render cleans it up correctly
+                                if (optionGroupsCache[0].length > 1) {
+                                    if (optionGroupsCache[0][1].id !== key) {
+                                        optionGroupsCache[0][1].selected = false;
+                                    }
+                                }
+                            }
+                            ctrl.$setViewValue(value);
+                        });
+                    });
+
+                    ctrl.$render = render;
+
+                    // TODO(vojta): can't we optimize this ?
+                    scope.$watch(render);
+
+                    function render() {
+                        // Temporary location for the option groups before we render them
+                        var optionGroups = {'':[]},
+                            optionGroupNames = [''],
+                            optionGroupName,
+                            optionGroup,
+                            option,
+                            existingParent, existingOptions, existingOption,
+                            modelValue = ctrl.$modelValue,
+                            values = valuesFn(scope) || [],
+                            keys = keyName ? sortedKeys(values) : values,
+                            key,
+                            groupLength, length,
+                            groupIndex, index,
+                            locals = {},
+                            selected,
+                            selectedSet = false, // nothing is selected yet
+                            lastElement,
+                            element,
+                            label;
+
+                        if (multiple) {
+                            if (trackFn && isArray(modelValue)) {
+                                selectedSet = new HashMap([]);
+                                for (var trackIndex = 0; trackIndex < modelValue.length; trackIndex++) {
+                                    locals[valueName] = modelValue[trackIndex];
+                                    selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]);
+                                }
+                            } else {
+                                selectedSet = new HashMap(modelValue);
+                            }
+                        }
+
+                        // We now build up the list of options we need (we merge later)
+                        for (index = 0; length = keys.length, index < length; index++) {
+
+                            key = index;
+                            if (keyName) {
+                                key = keys[index];
+                                if ( key.charAt(0) === '$' ) continue;
+                                locals[keyName] = key;
+                            }
+
+                            locals[valueName] = values[key];
+
+                            optionGroupName = groupByFn(scope, locals) || '';
+                            if (!(optionGroup = optionGroups[optionGroupName])) {
+                                optionGroup = optionGroups[optionGroupName] = [];
+                                optionGroupNames.push(optionGroupName);
+                            }
+                            if (multiple) {
+                                selected = isDefined(
+                                    selectedSet.remove(trackFn ? trackFn(scope, locals) : valueFn(scope, locals))
+                                );
+                            } else {
+                                if (trackFn) {
+                                    var modelCast = {};
+                                    modelCast[valueName] = modelValue;
+                                    selected = trackFn(scope, modelCast) === trackFn(scope, locals);
+                                } else {
+                                    selected = modelValue === valueFn(scope, locals);
+                                }
+                                selectedSet = selectedSet || selected; // see if at least one item is selected
+                            }
+                            label = displayFn(scope, locals); // what will be seen by the user
+
+                            // doing displayFn(scope, locals) || '' overwrites zero values
+                            label = isDefined(label) ? label : '';
+                            optionGroup.push({
+                                // either the index into array or key from object
+                                id: trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index),
+                                label: label,
+                                selected: selected                   // determine if we should be selected
+                            });
+                        }
+                        if (!multiple) {
+                            if (nullOption || modelValue === null) {
+                                // insert null option if we have a placeholder, or the model is null
+                                optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});
+                            } else if (!selectedSet) {
+                                // option could not be found, we have to insert the undefined item
+                                optionGroups[''].unshift({id:'?', label:'', selected:true});
+                            }
+                        }
+
+                        // Now we need to update the list of DOM nodes to match the optionGroups we computed above
+                        for (groupIndex = 0, groupLength = optionGroupNames.length;
+                             groupIndex < groupLength;
+                             groupIndex++) {
+                            // current option group name or '' if no group
+                            optionGroupName = optionGroupNames[groupIndex];
+
+                            // list of options for that group. (first item has the parent)
+                            optionGroup = optionGroups[optionGroupName];
+
+                            if (optionGroupsCache.length <= groupIndex) {
+                                // we need to grow the optionGroups
+                                existingParent = {
+                                    element: optGroupTemplate.clone().attr('label', optionGroupName),
+                                    label: optionGroup.label
+                                };
+                                existingOptions = [existingParent];
+                                optionGroupsCache.push(existingOptions);
+                                selectElement.append(existingParent.element);
+                            } else {
+                                existingOptions = optionGroupsCache[groupIndex];
+                                existingParent = existingOptions[0];  // either SELECT (no group) or OPTGROUP element
+
+                                // update the OPTGROUP label if not the same.
+                                if (existingParent.label != optionGroupName) {
+                                    existingParent.element.attr('label', existingParent.label = optionGroupName);
+                                }
+                            }
+
+                            lastElement = null;  // start at the beginning
+                            for(index = 0, length = optionGroup.length; index < length; index++) {
+                                option = optionGroup[index];
+                                if ((existingOption = existingOptions[index+1])) {
+                                    // reuse elements
+                                    lastElement = existingOption.element;
+                                    if (existingOption.label !== option.label) {
+                                        lastElement.text(existingOption.label = option.label);
+                                    }
+                                    if (existingOption.id !== option.id) {
+                                        lastElement.val(existingOption.id = option.id);
+                                    }
+                                    // lastElement.prop('selected') provided by jQuery has side-effects
+                                    if (existingOption.selected !== option.selected) {
+                                        lastElement.prop('selected', (existingOption.selected = option.selected));
+                                    }
+                                } else {
+                                    // grow elements
+
+                                    // if it's a null option
+                                    if (option.id === '' && nullOption) {
+                                        // put back the pre-compiled element
+                                        element = nullOption;
+                                    } else {
+                                        // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but
+                                        // in this version of jQuery on some browser the .text() returns a string
+                                        // rather then the element.
+                                        (element = optionTemplate.clone())
+                                            .val(option.id)
+                                            .attr('selected', option.selected)
+                                            .text(option.label);
+                                    }
+
+                                    existingOptions.push(existingOption = {
+                                        element: element,
+                                        label: option.label,
+                                        id: option.id,
+                                        selected: option.selected
+                                    });
+                                    if (lastElement) {
+                                        lastElement.after(element);
+                                    } else {
+                                        existingParent.element.append(element);
+                                    }
+                                    lastElement = element;
+                                }
+                            }
+                            // remove any excessive OPTIONs in a group
+                            index++; // increment since the existingOptions[0] is parent element not OPTION
+                            while(existingOptions.length > index) {
+                                existingOptions.pop().element.remove();
+                            }
+                        }
+                        // remove any excessive OPTGROUPs from select
+                        while(optionGroupsCache.length > groupIndex) {
+                            optionGroupsCache.pop()[0].element.remove();
+                        }
+                    }
+                }
+            }
+        };
+    }];
+
+    var optionDirective = ['$interpolate', function($interpolate) {
+        var nullSelectCtrl = {
+            addOption: noop,
+            removeOption: noop
+        };
+
+        return {
+            restrict: 'E',
+            priority: 100,
+            compile: function(element, attr) {
+                if (isUndefined(attr.value)) {
+                    var interpolateFn = $interpolate(element.text(), true);
+                    if (!interpolateFn) {
+                        attr.$set('value', element.text());
+                    }
+                }
+
+                return function (scope, element, attr) {
+                    var selectCtrlName = '$selectController',
+                        parent = element.parent(),
+                        selectCtrl = parent.data(selectCtrlName) ||
+                            parent.parent().data(selectCtrlName); // in case we are in optgroup
+
+                    if (selectCtrl && selectCtrl.databound) {
+                        // For some reason Opera defaults to true and if not overridden this messes up the repeater.
+                        // We don't want the view to drive the initialization of the model anyway.
+                        element.prop('selected', false);
+                    } else {
+                        selectCtrl = nullSelectCtrl;
+                    }
+
+                    if (interpolateFn) {
+                        scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) {
+                            attr.$set('value', newVal);
+                            if (newVal !== oldVal) selectCtrl.removeOption(oldVal);
+                            selectCtrl.addOption(newVal);
+                        });
+                    } else {
+                        selectCtrl.addOption(attr.value);
+                    }
+
+                    element.on('$destroy', function() {
+                        selectCtrl.removeOption(attr.value);
+                    });
+                };
+            }
+        };
+    }];
+
+    var styleDirective = valueFn({
+        restrict: 'E',
+        terminal: true
+    });
+
+    if (window.angular.bootstrap) {
+        //AngularJS is already loaded, so we can return here...
+        console.log('WARNING: Tried to load angular more than once.');
+        return;
+    }
+
+    //try to bind to jquery now so that one can write angular.element().read()
+    //but we will rebind on bootstrap again.
+    bindJQuery();
+
+    publishExternalAPI(angular);
+
+    jqLite(document).ready(function() {
+        angularInit(document, bootstrap);
+    });
+
+})(window, document);
+
+!angular.$$csp() && angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}</style>');
\ No newline at end of file
diff --git a/setup/pub/angular/angular.min.js b/setup/pub/angular/angular.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..c7d2ea7388e3351a76e94752becba2ca6751c29e
--- /dev/null
+++ b/setup/pub/angular/angular.min.js
@@ -0,0 +1,212 @@
+/*
+ AngularJS v1.2.17-build.178+sha.2406084
+ (c) 2010-2014 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(P,U,s){'use strict';function u(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.17-build.178+sha.2406084/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function bb(b){if(null==
+b||Da(b))return!1;var a=b.length;return 1===b.nodeType&&a?!0:C(b)||L(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function q(b,a,c){var d;if(b)if(Q(b))for(d in b)"prototype"==d||("length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d))||a.call(c,b[d],d);else if(b.forEach&&b.forEach!==q)b.forEach(a,c);else if(bb(b))for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function Ub(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}
+function Sc(b,a,c){for(var d=Ub(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function Vb(b){return function(a,c){b(c,a)}}function cb(){for(var b=ka.length,a;b;){b--;a=ka[b].charCodeAt(0);if(57==a)return ka[b]="A",ka.join("");if(90==a)ka[b]="0";else return ka[b]=String.fromCharCode(a+1),ka.join("")}ka.unshift("0");return ka.join("")}function Wb(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function E(b){var a=b.$$hashKey;q(arguments,function(a){a!==b&&q(a,function(a,c){b[c]=a})});Wb(b,a);return b}
+function Y(b){return parseInt(b,10)}function Xb(b,a){return E(new (E(function(){},{prototype:b})),a)}function w(){}function Ea(b){return b}function aa(b){return function(){return b}}function H(b){return"undefined"===typeof b}function z(b){return"undefined"!==typeof b}function X(b){return null!=b&&"object"===typeof b}function C(b){return"string"===typeof b}function yb(b){return"number"===typeof b}function Ma(b){return"[object Date]"===wa.call(b)}function L(b){return"[object Array]"===wa.call(b)}function Q(b){return"function"===
+typeof b}function db(b){return"[object RegExp]"===wa.call(b)}function Da(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Tc(b){return!(!b||!(b.nodeName||b.prop&&b.attr&&b.find))}function Uc(b,a,c){var d=[];q(b,function(b,g,f){d.push(a.call(c,b,g,f))});return d}function eb(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Na(b,a){var c=eb(b,a);0<=c&&b.splice(c,1);return a}function ca(b,a){if(Da(b)||b&&b.$evalAsync&&b.$watch)throw Oa("cpws");
+if(a){if(b===a)throw Oa("cpi");if(L(b))for(var c=a.length=0;c<b.length;c++)a.push(ca(b[c]));else{c=a.$$hashKey;q(a,function(b,c){delete a[c]});for(var d in b)a[d]=ca(b[d]);Wb(a,c)}}else(a=b)&&(L(b)?a=ca(b,[]):Ma(b)?a=new Date(b.getTime()):db(b)?a=RegExp(b.source):X(b)&&(a=ca(b,{})));return a}function Yb(b,a){a=a||{};for(var c in b)!b.hasOwnProperty(c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(a[c]=b[c]);return a}function xa(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;
+var c=typeof b,d;if(c==typeof a&&"object"==c)if(L(b)){if(!L(a))return!1;if((c=b.length)==a.length){for(d=0;d<c;d++)if(!xa(b[d],a[d]))return!1;return!0}}else{if(Ma(b))return Ma(a)&&b.getTime()==a.getTime();if(db(b)&&db(a))return b.toString()==a.toString();if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||Da(b)||Da(a)||L(a))return!1;c={};for(d in b)if("$"!==d.charAt(0)&&!Q(b[d])){if(!xa(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c.hasOwnProperty(d)&&"$"!==d.charAt(0)&&a[d]!==s&&!Q(a[d]))return!1;
+return!0}return!1}function Zb(){return U.securityPolicy&&U.securityPolicy.isActive||U.querySelector&&!(!U.querySelector("[ng-csp]")&&!U.querySelector("[data-ng-csp]"))}function fb(b,a){var c=2<arguments.length?ya.call(arguments,2):[];return!Q(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?a.apply(b,c.concat(ya.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}function Vc(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)?c=
+s:Da(a)?c="$WINDOW":a&&U===a?c="$DOCUMENT":a&&(a.$evalAsync&&a.$watch)&&(c="$SCOPE");return c}function qa(b,a){return"undefined"===typeof b?s:JSON.stringify(b,Vc,a?"  ":null)}function $b(b){return C(b)?JSON.parse(b):b}function Pa(b){"function"===typeof b?b=!0:b&&0!==b.length?(b=J(""+b),b=!("f"==b||"0"==b||"false"==b||"no"==b||"n"==b||"[]"==b)):b=!1;return b}function ia(b){b=y(b).clone();try{b.empty()}catch(a){}var c=y("<div>").append(b).html();try{return 3===b[0].nodeType?J(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,
+function(a,b){return"<"+J(b)})}catch(d){return J(c)}}function ac(b){try{return decodeURIComponent(b)}catch(a){}}function bc(b){var a={},c,d;q((b||"").split("&"),function(b){b&&(c=b.split("="),d=ac(c[0]),z(d)&&(b=z(c[1])?ac(c[1]):!0,a[d]?L(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function zb(b){var a=[];q(b,function(b,d){L(b)?q(b,function(b){a.push(za(d,!0)+(!0===b?"":"="+za(b,!0)))}):a.push(za(d,!0)+(!0===b?"":"="+za(b,!0)))});return a.length?a.join("&"):""}function gb(b){return za(b,
+!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function za(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Wc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,f=["ng:app","ng-app","x-ng-app","data-ng-app"],h=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;q(f,function(a){f[a]=!0;c(U.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(q(b.querySelectorAll("."+a),c),q(b.querySelectorAll("."+
+a+"\\:"),c),q(b.querySelectorAll("["+a+"]"),c))});q(d,function(a){if(!e){var b=h.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):q(a.attributes,function(b){!e&&f[b.name]&&(e=a,g=b.value)})}});e&&a(e,g?[g]:[])}function cc(b,a){var c=function(){b=y(b);if(b.injector()){var c=b[0]===U?"document":ia(b);throw Oa("btstrpd",c);}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=dc(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",
+function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(P&&!d.test(P.name))return c();P.name=P.name.replace(d,"");Qa.resumeBootstrap=function(b){q(b,function(b){a.push(b)});c()}}function hb(b,a){a=a||"_";return b.replace(Xc,function(b,d){return(d?a:"")+b.toLowerCase()})}function Ab(b,a,c){if(!b)throw Oa("areq",a||"?",c||"required");return b}function Ra(b,a,c){c&&L(b)&&(b=b[b.length-1]);Ab(Q(b),a,"not a function, got "+(b&&"object"==typeof b?
+b.constructor.name||"Object":typeof b));return b}function Aa(b,a){if("hasOwnProperty"===b)throw Oa("badname",a);}function ec(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,g=a.length,f=0;f<g;f++)d=a[f],b&&(b=(e=b)[d]);return!c&&Q(b)?fb(e,b):b}function Bb(b){var a=b[0];b=b[b.length-1];if(a===b)return y(a);var c=[a];do{a=a.nextSibling;if(!a)break;c.push(a)}while(a!==b);return y(c)}function Yc(b){var a=u("$injector"),c=u("ng");b=b.angular||(b.angular={});b.$$minErr=b.$$minErr||u;return b.module||
+(b.module=function(){var b={};return function(e,g,f){if("hasOwnProperty"===e)throw c("badname","module");g&&b.hasOwnProperty(e)&&(b[e]=null);return b[e]||(b[e]=function(){function b(a,d,e){return function(){c[e||"push"]([a,d,arguments]);return n}}if(!g)throw a("nomod",e);var c=[],d=[],l=b("$injector","invoke"),n={_invokeQueue:c,_runBlocks:d,requires:g,name:e,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:b("$provide","value"),constant:b("$provide",
+"constant","unshift"),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),config:l,run:function(a){d.push(a);return this}};f&&l(f);return n}())}}())}function Zc(b){E(b,{bootstrap:cc,copy:ca,extend:E,equals:xa,element:y,forEach:q,injector:dc,noop:w,bind:fb,toJson:qa,fromJson:$b,identity:Ea,isUndefined:H,isDefined:z,isString:C,isFunction:Q,isObject:X,isNumber:yb,isElement:Tc,isArray:L,
+version:$c,isDate:Ma,lowercase:J,uppercase:Fa,callbacks:{counter:0},$$minErr:u,$$csp:Zb});Sa=Yc(P);try{Sa("ngLocale")}catch(a){Sa("ngLocale",[]).provider("$locale",ad)}Sa("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:bd});a.provider("$compile",fc).directive({a:cd,input:gc,textarea:gc,form:dd,script:ed,select:fd,style:gd,option:hd,ngBind:id,ngBindHtml:jd,ngBindTemplate:kd,ngClass:ld,ngClassEven:md,ngClassOdd:nd,ngCloak:od,ngController:pd,ngForm:qd,ngHide:rd,ngIf:sd,ngInclude:td,
+ngInit:ud,ngNonBindable:vd,ngPluralize:wd,ngRepeat:xd,ngShow:yd,ngStyle:zd,ngSwitch:Ad,ngSwitchWhen:Bd,ngSwitchDefault:Cd,ngOptions:Dd,ngTransclude:Ed,ngModel:Fd,ngList:Gd,ngChange:Hd,required:hc,ngRequired:hc,ngValue:Id}).directive({ngInclude:Jd}).directive(Cb).directive(ic);a.provider({$anchorScroll:Kd,$animate:Ld,$browser:Md,$cacheFactory:Nd,$controller:Od,$document:Pd,$exceptionHandler:Qd,$filter:jc,$interpolate:Rd,$interval:Sd,$http:Td,$httpBackend:Ud,$location:Vd,$log:Wd,$parse:Xd,$rootScope:Yd,
+$q:Zd,$sce:$d,$sceDelegate:ae,$sniffer:be,$templateCache:ce,$timeout:de,$window:ee,$$rAF:fe,$$asyncCallback:ge})}])}function Ta(b){return b.replace(he,function(a,b,d,e){return e?d.toUpperCase():d}).replace(ie,"Moz$1")}function Db(b,a,c,d){function e(b){var e=c&&b?[this.filter(b)]:[this],m=a,k,l,n,p,r,A;if(!d||null!=b)for(;e.length;)for(k=e.shift(),l=0,n=k.length;l<n;l++)for(p=y(k[l]),m?p.triggerHandler("$destroy"):m=!m,r=0,p=(A=p.children()).length;r<p;r++)e.push(Ba(A[r]));return g.apply(this,arguments)}
+var g=Ba.fn[b],g=g.$original||g;e.$original=g;Ba.fn[b]=e}function M(b){if(b instanceof M)return b;C(b)&&(b=ba(b));if(!(this instanceof M)){if(C(b)&&"<"!=b.charAt(0))throw Eb("nosel");return new M(b)}if(C(b)){var a=b;b=U;var c;if(c=je.exec(a))b=[b.createElement(c[1])];else{var d=b,e;b=d.createDocumentFragment();c=[];if(Fb.test(a)){d=b.appendChild(d.createElement("div"));e=(ke.exec(a)||["",""])[1].toLowerCase();e=ea[e]||ea._default;d.innerHTML="<div>&#160;</div>"+e[1]+a.replace(le,"<$1></$2>")+e[2];
+d.removeChild(d.firstChild);for(a=e[0];a--;)d=d.lastChild;a=0;for(e=d.childNodes.length;a<e;++a)c.push(d.childNodes[a]);d=b.firstChild;d.textContent=""}else c.push(d.createTextNode(a));b.textContent="";b.innerHTML="";b=c}Gb(this,b);y(U.createDocumentFragment()).append(this)}else Gb(this,b)}function Hb(b){return b.cloneNode(!0)}function Ga(b){kc(b);var a=0;for(b=b.childNodes||[];a<b.length;a++)Ga(b[a])}function lc(b,a,c,d){if(z(d))throw Eb("offargs");var e=la(b,"events");la(b,"handle")&&(H(a)?q(e,
+function(a,c){Ua(b,c,a);delete e[c]}):q(a.split(" "),function(a){H(c)?(Ua(b,a,e[a]),delete e[a]):Na(e[a]||[],c)}))}function kc(b,a){var c=b[ib],d=Va[c];d&&(a?delete Va[c].data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),lc(b)),delete Va[c],b[ib]=s))}function la(b,a,c){var d=b[ib],d=Va[d||-1];if(z(c))d||(b[ib]=d=++me,d=Va[d]={}),d[a]=c;else return d&&d[a]}function mc(b,a,c){var d=la(b,"data"),e=z(c),g=!e&&z(a),f=g&&!X(a);d||f||la(b,"data",d={});if(e)d[a]=c;else if(g){if(f)return d&&d[a];
+E(d,a)}else return d}function Ib(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function jb(b,a){a&&b.setAttribute&&q(a.split(" "),function(a){b.setAttribute("class",ba((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+ba(a)+" "," ")))})}function kb(b,a){if(a&&b.setAttribute){var c=(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");q(a.split(" "),function(a){a=ba(a);-1===c.indexOf(" "+a+" ")&&
+(c+=a+" ")});b.setAttribute("class",ba(c))}}function Gb(b,a){if(a){a=a.nodeName||!z(a.length)||Da(a)?[a]:a;for(var c=0;c<a.length;c++)b.push(a[c])}}function nc(b,a){return lb(b,"$"+(a||"ngController")+"Controller")}function lb(b,a,c){b=y(b);9==b[0].nodeType&&(b=b.find("html"));for(a=L(a)?a:[a];b.length;){for(var d=b[0],e=0,g=a.length;e<g;e++)if((c=b.data(a[e]))!==s)return c;b=y(d.parentNode||11===d.nodeType&&d.host)}}function oc(b){for(var a=0,c=b.childNodes;a<c.length;a++)Ga(c[a]);for(;b.firstChild;)b.removeChild(b.firstChild)}
+function pc(b,a){var c=mb[a.toLowerCase()];return c&&qc[b.nodeName]&&c}function ne(b,a){var c=function(c,e){c.preventDefault||(c.preventDefault=function(){c.returnValue=!1});c.stopPropagation||(c.stopPropagation=function(){c.cancelBubble=!0});c.target||(c.target=c.srcElement||U);if(H(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented||!1===c.returnValue};var f=Yb(a[e||
+c.type]||[]);q(f,function(a){a.call(b,c)});8>=S?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function Ha(b){var a=typeof b,c;"object"==a&&null!==b?"function"==typeof(c=b.$$hashKey)?c=b.$$hashKey():c===s&&(c=b.$$hashKey=cb()):c=b;return a+":"+c}function Wa(b){q(b,this.put,this)}function rc(b){var a,c;"function"==typeof b?(a=b.$inject)||(a=[],b.length&&(c=b.toString().replace(oe,
+""),c=c.match(pe),q(c[1].split(qe),function(b){b.replace(re,function(b,c,d){a.push(d)})})),b.$inject=a):L(b)?(c=b.length-1,Ra(b[c],"fn"),a=b.slice(0,c)):Ra(b,"fn",!0);return a}function dc(b){function a(a){return function(b,c){if(X(b))q(b,Vb(a));else return a(b,c)}}function c(a,b){Aa(a,"service");if(Q(b)||L(b))b=n.instantiate(b);if(!b.$get)throw Xa("pget",a);return l[a+h]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[],c,d,g,h;q(a,function(a){if(!k.get(a)){k.put(a,!0);try{if(C(a))for(c=
+Sa(a),b=b.concat(e(c.requires)).concat(c._runBlocks),d=c._invokeQueue,g=0,h=d.length;g<h;g++){var f=d[g],m=n.get(f[0]);m[f[1]].apply(m,f[2])}else Q(a)?b.push(n.invoke(a)):L(a)?b.push(n.invoke(a)):Ra(a,"module")}catch(l){throw L(a)&&(a=a[a.length-1]),l.message&&(l.stack&&-1==l.stack.indexOf(l.message))&&(l=l.message+"\n"+l.stack),Xa("modulerr",a,l.stack||l.message||l);}}});return b}function g(a,b){function c(d){if(a.hasOwnProperty(d)){if(a[d]===f)throw Xa("cdep",m.join(" <- "));return a[d]}try{return m.unshift(d),
+a[d]=f,a[d]=b(d)}catch(e){throw a[d]===f&&delete a[d],e;}finally{m.shift()}}function d(a,b,e){var g=[],h=rc(a),f,m,k;m=0;for(f=h.length;m<f;m++){k=h[m];if("string"!==typeof k)throw Xa("itkn",k);g.push(e&&e.hasOwnProperty(k)?e[k]:c(k))}a.$inject||(a=a[f]);return a.apply(b,g)}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(L(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return X(e)||Q(e)?e:c},get:c,annotate:rc,has:function(b){return l.hasOwnProperty(b+h)||a.hasOwnProperty(b)}}}
+var f={},h="Provider",m=[],k=new Wa,l={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,aa(b))}),constant:a(function(a,b){Aa(a,"constant");l[a]=b;p[a]=b}),decorator:function(a,b){var c=n.get(a+h),d=c.$get;c.$get=function(){var a=r.invoke(d,c);return r.invoke(b,null,{$delegate:a})}}}},n=l.$injector=g(l,function(){throw Xa("unpr",m.join(" <- "));}),p={},r=p.$injector=g(p,function(a){a=n.get(a+
+h);return r.invoke(a.$get,a)});q(e(b),function(a){r.invoke(a||w)});return r}function Kd(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;q(a,function(a){b||"a"!==J(a.nodeName)||(b=a)});return b}function g(){var b=c.hash(),d;b?(d=f.getElementById(b))?d.scrollIntoView():(d=e(f.getElementsByName(b)))?d.scrollIntoView():"top"===b&&a.scrollTo(0,0):a.scrollTo(0,0)}var f=a.document;b&&d.$watch(function(){return c.hash()},
+function(){d.$evalAsync(g)});return g}]}function ge(){this.$get=["$$rAF","$timeout",function(b,a){return b.supported?function(a){return b(a)}:function(b){return a(b,0,!1)}}]}function se(b,a,c,d){function e(a){try{a.apply(null,ya.call(arguments,1))}finally{if(A--,0===A)for(;D.length;)try{D.pop()()}catch(b){c.error(b)}}}function g(a,b){(function T(){q(x,function(a){a()});t=b(T,a)})()}function f(){v=null;N!=h.url()&&(N=h.url(),q(ma,function(a){a(h.url())}))}var h=this,m=a[0],k=b.location,l=b.history,
+n=b.setTimeout,p=b.clearTimeout,r={};h.isMock=!1;var A=0,D=[];h.$$completeOutstandingRequest=e;h.$$incOutstandingRequestCount=function(){A++};h.notifyWhenNoOutstandingRequests=function(a){q(x,function(a){a()});0===A?a():D.push(a)};var x=[],t;h.addPollFn=function(a){H(t)&&g(100,n);x.push(a);return a};var N=k.href,B=a.find("base"),v=null;h.url=function(a,c){k!==b.location&&(k=b.location);l!==b.history&&(l=b.history);if(a){if(N!=a)return N=a,d.history?c?l.replaceState(null,"",a):(l.pushState(null,"",
+a),B.attr("href",B.attr("href"))):(v=a,c?k.replace(a):k.href=a),h}else return v||k.href.replace(/%27/g,"'")};var ma=[],K=!1;h.onUrlChange=function(a){if(!K){if(d.history)y(b).on("popstate",f);if(d.hashchange)y(b).on("hashchange",f);else h.addPollFn(f);K=!0}ma.push(a);return a};h.baseHref=function(){var a=B.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var O={},da="",F=h.baseHref();h.cookies=function(a,b){var d,e,g,h;if(a)b===s?m.cookie=escape(a)+"=;path="+F+";expires=Thu, 01 Jan 1970 00:00:00 GMT":
+C(b)&&(d=(m.cookie=escape(a)+"="+escape(b)+";path="+F).length+1,4096<d&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"));else{if(m.cookie!==da)for(da=m.cookie,d=da.split("; "),O={},g=0;g<d.length;g++)e=d[g],h=e.indexOf("="),0<h&&(a=unescape(e.substring(0,h)),O[a]===s&&(O[a]=unescape(e.substring(h+1))));return O}};h.defer=function(a,b){var c;A++;c=n(function(){delete r[c];e(a)},b||0);r[c]=!0;return c};h.defer.cancel=function(a){return r[a]?(delete r[a],
+p(a),e(w),!0):!1}}function Md(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new se(b,d,a,c)}]}function Nd(){this.$get=function(){function b(b,d){function e(a){a!=n&&(p?p==a&&(p=a.n):p=a,g(a.n,a.p),g(a,n),n=a,n.n=null)}function g(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw u("$cacheFactory")("iid",b);var f=0,h=E({},d,{id:b}),m={},k=d&&d.capacity||Number.MAX_VALUE,l={},n=null,p=null;return a[b]={put:function(a,b){if(k<Number.MAX_VALUE){var c=l[a]||(l[a]={key:a});
+e(c)}if(!H(b))return a in m||f++,m[a]=b,f>k&&this.remove(p.key),b},get:function(a){if(k<Number.MAX_VALUE){var b=l[a];if(!b)return;e(b)}return m[a]},remove:function(a){if(k<Number.MAX_VALUE){var b=l[a];if(!b)return;b==n&&(n=b.p);b==p&&(p=b.n);g(b.n,b.p);delete l[a]}delete m[a];f--},removeAll:function(){m={};f=0;l={};n=p=null},destroy:function(){l=h=m=null;delete a[b]},info:function(){return E({},h,{size:f})}}}var a={};b.info=function(){var b={};q(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};
+return b}}function ce(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function fc(b,a){var c={},d="Directive",e=/^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,g=/(([\d\w_\-]+)(?:\:([^;]+))?;?)/,f=/^(on[a-z]+|formaction)$/;this.directive=function m(a,e){Aa(a,"directive");C(a)?(Ab(e,"directiveFactory"),c.hasOwnProperty(a)||(c[a]=[],b.factory(a+d,["$injector","$exceptionHandler",function(b,d){var e=[];q(c[a],function(c,g){try{var f=b.invoke(c);Q(f)?f={compile:aa(f)}:!f.compile&&f.link&&(f.compile=
+aa(f.link));f.priority=f.priority||0;f.index=g;f.name=f.name||a;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(m){d(m)}});return e}])),c[a].push(e)):q(a,Vb(m));return this};this.aHrefSanitizationWhitelist=function(b){return z(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return z(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};this.$get=["$injector","$interpolate",
+"$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,l,n,p,r,A,D,x,t,N,B){function v(a,b,c,d,e){a instanceof y||(a=y(a));q(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=y(b).wrap("<span></span>").parent()[0])});var g=K(a,b,a,c,d,e);ma(a,"ng-scope");return function(b,c,d){Ab(b,"scope");var e=c?Ia.clone.call(a):a;q(d,function(a,b){e.data("$"+b+"Controller",a)});d=0;for(var f=e.length;d<f;d++){var m=
+e[d].nodeType;1!==m&&9!==m||e.eq(d).data("$scope",b)}c&&c(e,b);g&&g(b,e,e);return e}}function ma(a,b){try{a.addClass(b)}catch(c){}}function K(a,b,c,d,e,g){function f(a,c,d,e){var g,k,l,r,n,p,A;g=c.length;var I=Array(g);for(n=0;n<g;n++)I[n]=c[n];A=n=0;for(p=m.length;n<p;A++)k=I[A],c=m[n++],g=m[n++],l=y(k),c?(c.scope?(r=a.$new(),l.data("$scope",r)):r=a,(l=c.transclude)||!e&&b?c(g,r,k,d,O(a,l||b)):c(g,r,k,d,e)):g&&g(a,k.childNodes,s,e)}for(var m=[],k,l,r,n,p=0;p<a.length;p++)k=new Jb,l=da(a[p],[],k,
+0===p?d:s,e),(g=l.length?fa(l,a[p],k,b,c,null,[],[],g):null)&&g.scope&&ma(y(a[p]),"ng-scope"),k=g&&g.terminal||!(r=a[p].childNodes)||!r.length?null:K(r,g?g.transclude:b),m.push(g,k),n=n||g||k,g=null;return n?f:null}function O(a,b){return function(c,d,e){var g=!1;c||(c=a.$new(),g=c.$$transcluded=!0);d=b(c,d,e);if(g)d.on("$destroy",fb(c,c.$destroy));return d}}function da(a,b,c,d,f){var m=c.$attr,k;switch(a.nodeType){case 1:T(b,na(Ja(a).toLowerCase()),"E",d,f);var l,r,n;k=a.attributes;for(var p=0,A=
+k&&k.length;p<A;p++){var x=!1,D=!1;l=k[p];if(!S||8<=S||l.specified){r=l.name;n=na(r);W.test(n)&&(r=hb(n.substr(6),"-"));var N=n.replace(/(Start|End)$/,"");n===N+"Start"&&(x=r,D=r.substr(0,r.length-5)+"end",r=r.substr(0,r.length-6));n=na(r.toLowerCase());m[n]=r;c[n]=l=ba(l.value);pc(a,n)&&(c[n]=!0);M(a,b,l,n);T(b,n,"A",d,f,x,D)}}a=a.className;if(C(a)&&""!==a)for(;k=g.exec(a);)n=na(k[2]),T(b,n,"C",d,f)&&(c[n]=ba(k[3])),a=a.substr(k.index+k[0].length);break;case 3:u(b,a.nodeValue);break;case 8:try{if(k=
+e.exec(a.nodeValue))n=na(k[1]),T(b,n,"M",d,f)&&(c[n]=ba(k[2]))}catch(t){}}b.sort(H);return b}function F(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ja("uterdir",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return y(d)}function R(a,b,c){return function(d,e,g,f,k){e=F(e[0],b,c);return a(d,e,g,f,k)}}function fa(a,c,d,e,g,f,m,n,p){function x(a,b,c,d){if(a){c&&(a=R(a,c,d));a.require=G.require;a.directiveName=
+u;if(O===G||G.$$isolateScope)a=tc(a,{isolateScope:!0});m.push(a)}if(b){c&&(b=R(b,c,d));b.require=G.require;b.directiveName=u;if(O===G||G.$$isolateScope)b=tc(b,{isolateScope:!0});n.push(b)}}function D(a,b,c,d){var e,g="data",f=!1;if(C(b)){for(;"^"==(e=b.charAt(0))||"?"==e;)b=b.substr(1),"^"==e&&(g="inheritedData"),f=f||"?"==e;e=null;d&&"data"===g&&(e=d[b]);e=e||c[g]("$"+b+"Controller");if(!e&&!f)throw ja("ctreq",b,a);}else L(b)&&(e=[],q(b,function(b){e.push(D(a,b,c,d))}));return e}function N(a,e,g,
+f,p){function x(a,b){var c;2>arguments.length&&(b=a,a=s);E&&(c=da);return p(a,b,c)}var t,I,v,B,R,F,da={},nb;t=c===g?d:Yb(d,new Jb(y(g),d.$attr));I=t.$$element;if(O){var T=/^\s*([@=&])(\??)\s*(\w*)\s*$/;f=y(g);F=e.$new(!0);!fa||fa!==O&&fa!==O.$$originalDirective?f.data("$isolateScopeNoTemplate",F):f.data("$isolateScope",F);ma(f,"ng-isolate-scope");q(O.scope,function(a,c){var d=a.match(T)||[],g=d[3]||c,f="?"==d[2],d=d[1],m,l,n,p;F.$$isolateBindings[c]=d+g;switch(d){case "@":t.$observe(g,function(a){F[c]=
+a});t.$$observers[g].$$scope=e;t[g]&&(F[c]=b(t[g])(e));break;case "=":if(f&&!t[g])break;l=r(t[g]);p=l.literal?xa:function(a,b){return a===b};n=l.assign||function(){m=F[c]=l(e);throw ja("nonassign",t[g],O.name);};m=F[c]=l(e);F.$watch(function(){var a=l(e);p(a,F[c])||(p(a,m)?n(e,a=F[c]):F[c]=a);return m=a},null,l.literal);break;case "&":l=r(t[g]);F[c]=function(a){return l(e,a)};break;default:throw ja("iscp",O.name,c,a);}})}nb=p&&x;K&&q(K,function(a){var b={$scope:a===O||a.$$isolateScope?F:e,$element:I,
+$attrs:t,$transclude:nb},c;R=a.controller;"@"==R&&(R=t[a.name]);c=A(R,b);da[a.name]=c;E||I.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});f=0;for(v=m.length;f<v;f++)try{B=m[f],B(B.isolateScope?F:e,I,t,B.require&&D(B.directiveName,B.require,I,da),nb)}catch(G){l(G,ia(I))}f=e;O&&(O.template||null===O.templateUrl)&&(f=F);a&&a(f,g.childNodes,s,p);for(f=n.length-1;0<=f;f--)try{B=n[f],B(B.isolateScope?F:e,I,t,B.require&&D(B.directiveName,B.require,I,da),nb)}catch(z){l(z,ia(I))}}
+p=p||{};for(var t=-Number.MAX_VALUE,B,K=p.controllerDirectives,O=p.newIsolateScopeDirective,fa=p.templateDirective,T=p.nonTlbTranscludeDirective,H=!1,E=p.hasElementTranscludeDirective,Z=d.$$element=y(c),G,u,V,Ya=e,P,M=0,S=a.length;M<S;M++){G=a[M];var ra=G.$$start,W=G.$$end;ra&&(Z=F(c,ra,W));V=s;if(t>G.priority)break;if(V=G.scope)B=B||G,G.templateUrl||(J("new/isolated scope",O,G,Z),X(V)&&(O=G));u=G.name;!G.templateUrl&&G.controller&&(V=G.controller,K=K||{},J("'"+u+"' controller",K[u],G,Z),K[u]=G);
+if(V=G.transclude)H=!0,G.$$tlb||(J("transclusion",T,G,Z),T=G),"element"==V?(E=!0,t=G.priority,V=F(c,ra,W),Z=d.$$element=y(U.createComment(" "+u+": "+d[u]+" ")),c=Z[0],ob(g,y(ya.call(V,0)),c),Ya=v(V,e,t,f&&f.name,{nonTlbTranscludeDirective:T})):(V=y(Hb(c)).contents(),Z.empty(),Ya=v(V,e));if(G.template)if(J("template",fa,G,Z),fa=G,V=Q(G.template)?G.template(Z,d):G.template,V=Y(V),G.replace){f=G;V=Fb.test(V)?y(ba(V)):[];c=V[0];if(1!=V.length||1!==c.nodeType)throw ja("tplrt",u,"");ob(g,Z,c);S={$attr:{}};
+V=da(c,[],S);var $=a.splice(M+1,a.length-(M+1));O&&sc(V);a=a.concat(V).concat($);z(d,S);S=a.length}else Z.html(V);if(G.templateUrl)J("template",fa,G,Z),fa=G,G.replace&&(f=G),N=w(a.splice(M,a.length-M),Z,d,g,Ya,m,n,{controllerDirectives:K,newIsolateScopeDirective:O,templateDirective:fa,nonTlbTranscludeDirective:T}),S=a.length;else if(G.compile)try{P=G.compile(Z,d,Ya),Q(P)?x(null,P,ra,W):P&&x(P.pre,P.post,ra,W)}catch(aa){l(aa,ia(Z))}G.terminal&&(N.terminal=!0,t=Math.max(t,G.priority))}N.scope=B&&!0===
+B.scope;N.transclude=H&&Ya;p.hasElementTranscludeDirective=E;return N}function sc(a){for(var b=0,c=a.length;b<c;b++)a[b]=Xb(a[b],{$$isolateScope:!0})}function T(b,e,g,f,k,r,n){if(e===k)return null;k=null;if(c.hasOwnProperty(e)){var p;e=a.get(e+d);for(var A=0,x=e.length;A<x;A++)try{p=e[A],(f===s||f>p.priority)&&-1!=p.restrict.indexOf(g)&&(r&&(p=Xb(p,{$$start:r,$$end:n})),b.push(p),k=p)}catch(D){l(D)}}return k}function z(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;q(a,function(d,e){"$"!=e.charAt(0)&&
+(b[e]&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,g){"class"==g?(ma(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==g?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==g.charAt(0)||a.hasOwnProperty(g)||(a[g]=b,d[g]=c[g])})}function w(a,b,c,d,e,g,f,k){var m=[],l,r,A=b[0],x=a.shift(),D=E({},x,{templateUrl:null,transclude:null,replace:null,$$originalDirective:x}),N=Q(x.templateUrl)?x.templateUrl(b,c):x.templateUrl;b.empty();n.get(t.getTrustedResourceUrl(N),
+{cache:p}).success(function(n){var p,t;n=Y(n);if(x.replace){n=Fb.test(n)?y(ba(n)):[];p=n[0];if(1!=n.length||1!==p.nodeType)throw ja("tplrt",x.name,N);n={$attr:{}};ob(d,b,p);var v=da(p,[],n);X(x.scope)&&sc(v);a=v.concat(a);z(c,n)}else p=A,b.html(n);a.unshift(D);l=fa(a,p,c,e,b,x,g,f,k);q(d,function(a,c){a==p&&(d[c]=b[0])});for(r=K(b[0].childNodes,e);m.length;){n=m.shift();t=m.shift();var B=m.shift(),R=m.shift(),v=b[0];if(t!==A){var F=t.className;k.hasElementTranscludeDirective&&x.replace||(v=Hb(p));
+ob(B,y(t),v);ma(y(v),F)}t=l.transclude?O(n,l.transclude):R;l(r,n,v,d,t)}m=null}).error(function(a,b,c,d){throw ja("tpload",d.url);});return function(a,b,c,d,e){m?(m.push(b),m.push(c),m.push(d),m.push(e)):l(r,b,c,d,e)}}function H(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function J(a,b,c,d){if(b)throw ja("multidir",b.name,c.name,a,ia(d));}function u(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:aa(function(a,b){var c=b.parent(),e=c.data("$binding")||
+[];e.push(d);ma(c.data("$binding",e),"ng-binding");a.$watch(d,function(a){b[0].nodeValue=a})})})}function P(a,b){if("srcdoc"==b)return t.HTML;var c=Ja(a);if("xlinkHref"==b||"FORM"==c&&"action"==b||"IMG"!=c&&("src"==b||"ngSrc"==b))return t.RESOURCE_URL}function M(a,c,d,e){var g=b(d,!0);if(g){if("multiple"===e&&"SELECT"===Ja(a))throw ja("selmulti",ia(a));c.push({priority:100,compile:function(){return{pre:function(c,d,m){d=m.$$observers||(m.$$observers={});if(f.test(e))throw ja("nodomevents");if(g=b(m[e],
+!0,P(a,e)))m[e]=g(c),(d[e]||(d[e]=[])).$$inter=!0,(m.$$observers&&m.$$observers[e].$$scope||c).$watch(g,function(a,b){"class"===e&&a!=b?m.$updateClass(a,b):m.$set(e,a)})}}}})}}function ob(a,b,c){var d=b[0],e=b.length,g=d.parentNode,f,m;if(a)for(f=0,m=a.length;f<m;f++)if(a[f]==d){a[f++]=c;m=f+e-1;for(var k=a.length;f<k;f++,m++)m<k?a[f]=a[m]:delete a[f];a.length-=e-1;break}g&&g.replaceChild(c,d);a=U.createDocumentFragment();a.appendChild(d);c[y.expando]=d[y.expando];d=1;for(e=b.length;d<e;d++)g=b[d],
+y(g).remove(),a.appendChild(g),delete b[d];b[0]=c;b.length=1}function tc(a,b){return E(function(){return a.apply(null,arguments)},a,b)}var Jb=function(a,b){this.$$element=a;this.$attr=b||{}};Jb.prototype={$normalize:na,$addClass:function(a){a&&0<a.length&&N.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&N.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=uc(a,b),d=uc(b,a);0===c.length?N.removeClass(this.$$element,d):0===d.length?N.addClass(this.$$element,c):N.setClass(this.$$element,
+c,d)},$set:function(a,b,c,d){var e=pc(this.$$element[0],a);e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=hb(a,"-"));e=Ja(this.$$element);if("A"===e&&"href"===a||"IMG"===e&&"src"===a)this[a]=b=B(b,"src"===a);!1!==c&&(null===b||b===s?this.$$element.removeAttr(d):this.$$element.attr(d,b));(c=this.$$observers)&&q(c[a],function(a){try{a(b)}catch(c){l(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);
+D.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var Z=b.startSymbol(),ra=b.endSymbol(),Y="{{"==Z||"}}"==ra?Ea:function(a){return a.replace(/\{\{/g,Z).replace(/}}/g,ra)},W=/^ngAttr[A-Z]/;return v}]}function na(b){return Ta(b.replace(te,""))}function uc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),g=0;a:for(;g<d.length;g++){for(var f=d[g],h=0;h<e.length;h++)if(f==e[h])continue a;c+=(0<c.length?" ":"")+f}return c}function Od(){var b={},a=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,
+d){Aa(a,"controller");X(a)?E(b,a):b[a]=d};this.$get=["$injector","$window",function(c,d){return function(e,g){var f,h,m;C(e)&&(f=e.match(a),h=f[1],m=f[3],e=b.hasOwnProperty(h)?b[h]:ec(g.$scope,h,!0)||ec(d,h,!0),Ra(e,h,!0));f=c.instantiate(e,g);if(m){if(!g||"object"!=typeof g.$scope)throw u("$controller")("noscp",h||e.name,m);g.$scope[m]=f}return f}}]}function Pd(){this.$get=["$window",function(b){return y(b.document)}]}function Qd(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,
+arguments)}}]}function vc(b){var a={},c,d,e;if(!b)return a;q(b.split("\n"),function(b){e=b.indexOf(":");c=J(ba(b.substr(0,e)));d=ba(b.substr(e+1));c&&(a[c]=a[c]?a[c]+(", "+d):d)});return a}function wc(b){var a=X(b)?b:s;return function(c){a||(a=vc(b));return c?a[J(c)]||null:a}}function xc(b,a,c){if(Q(c))return c(b,a);q(c,function(c){b=c(b,a)});return b}function Td(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d={"Content-Type":"application/json;charset=utf-8"},e=this.defaults={transformResponse:[function(d){C(d)&&
+(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=$b(d)));return d}],transformRequest:[function(a){return X(a)&&"[object File]"!==wa.call(a)&&"[object Blob]"!==wa.call(a)?qa(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ca(d),put:ca(d),patch:ca(d)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},g=this.interceptors=[],f=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,d,n,p){function r(a){function c(a){var b=
+E({},a,{data:xc(a.data,a.headers,d.transformResponse)});return 200<=a.status&&300>a.status?b:n.reject(b)}var d={method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse},g=function(a){function b(a){var c;q(a,function(b,d){Q(b)&&(c=b(),null!=c?a[d]=c:delete a[d])})}var c=e.headers,d=E({},a.headers),g,f,c=E({},c.common,c[J(a.method)]);b(c);b(d);a:for(g in c){a=J(g);for(f in d)if(J(f)===a)continue a;d[g]=c[g]}return d}(a);E(d,a);d.headers=g;d.method=Fa(d.method);(a=Kb(d.url)?
+b.cookies()[d.xsrfCookieName||e.xsrfCookieName]:s)&&(g[d.xsrfHeaderName||e.xsrfHeaderName]=a);var f=[function(a){g=a.headers;var b=xc(a.data,wc(g),a.transformRequest);H(a.data)&&q(g,function(a,b){"content-type"===J(b)&&delete g[b]});H(a.withCredentials)&&!H(e.withCredentials)&&(a.withCredentials=e.withCredentials);return A(a,b,g).then(c,c)},s],h=n.when(d);for(q(t,function(a){(a.request||a.requestError)&&f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=
+f.shift();var k=f.shift(),h=h.then(a,k)}h.success=function(a){h.then(function(b){a(b.data,b.status,b.headers,d)});return h};h.error=function(a){h.then(null,function(b){a(b.data,b.status,b.headers,d)});return h};return h}function A(b,c,g){function f(a,b,c,e){t&&(200<=a&&300>a?t.put(s,[a,b,vc(c),e]):t.remove(s));m(b,a,c,e);d.$$phase||d.$apply()}function m(a,c,d,e){c=Math.max(c,0);(200<=c&&300>c?p.resolve:p.reject)({data:a,status:c,headers:wc(d),config:b,statusText:e})}function k(){var a=eb(r.pendingRequests,
+b);-1!==a&&r.pendingRequests.splice(a,1)}var p=n.defer(),A=p.promise,t,q,s=D(b.url,b.params);r.pendingRequests.push(b);A.then(k,k);(b.cache||e.cache)&&(!1!==b.cache&&"GET"==b.method)&&(t=X(b.cache)?b.cache:X(e.cache)?e.cache:x);if(t)if(q=t.get(s),z(q)){if(q.then)return q.then(k,k),q;L(q)?m(q[1],q[0],ca(q[2]),q[3]):m(q,200,{},"OK")}else t.put(s,A);H(q)&&a(b.method,s,c,f,g,b.timeout,b.withCredentials,b.responseType);return A}function D(a,b){if(!b)return a;var c=[];Sc(b,function(a,b){null===a||H(a)||
+(L(a)||(a=[a]),q(a,function(a){X(a)&&(a=qa(a));c.push(za(b)+"="+za(a))}))});0<c.length&&(a+=(-1==a.indexOf("?")?"?":"&")+c.join("&"));return a}var x=c("$http"),t=[];q(g,function(a){t.unshift(C(a)?p.get(a):p.invoke(a))});q(f,function(a,b){var c=C(a)?p.get(a):p.invoke(a);t.splice(b,0,{response:function(a){return c(n.when(a))},responseError:function(a){return c(n.reject(a))}})});r.pendingRequests=[];(function(a){q(arguments,function(a){r[a]=function(b,c){return r(E(c||{},{method:a,url:b}))}})})("get",
+"delete","head","jsonp");(function(a){q(arguments,function(a){r[a]=function(b,c,d){return r(E(d||{},{method:a,url:b,data:c}))}})})("post","put");r.defaults=e;return r}]}function ue(b){if(8>=S&&(!b.match(/^(get|post|head|put|delete|options)$/i)||!P.XMLHttpRequest))return new P.ActiveXObject("Microsoft.XMLHTTP");if(P.XMLHttpRequest)return new P.XMLHttpRequest;throw u("$httpBackend")("noxhr");}function Ud(){this.$get=["$browser","$window","$document",function(b,a,c){return ve(b,ue,b.defer,a.angular.callbacks,
+c[0])}]}function ve(b,a,c,d,e){function g(a,b,c){var g=e.createElement("script"),f=null;g.type="text/javascript";g.src=a;g.async=!0;f=function(a){Ua(g,"load",f);Ua(g,"error",f);e.body.removeChild(g);g=null;var h=-1,A="unknown";a&&("load"!==a.type||d[b].called||(a={type:"error"}),A=a.type,h="error"===a.type?404:200);c&&c(h,A)};pb(g,"load",f);pb(g,"error",f);8>=S&&(g.onreadystatechange=function(){C(g.readyState)&&/loaded|complete/.test(g.readyState)&&(g.onreadystatechange=null,f({type:"load"}))});e.body.appendChild(g);
+return f}var f=-1;return function(e,m,k,l,n,p,r,A){function D(){t=f;B&&B();v&&v.abort()}function x(a,d,e,g,f){K&&c.cancel(K);B=v=null;0===d&&(d=e?200:"file"==sa(m).protocol?404:0);a(1223===d?204:d,e,g,f||"");b.$$completeOutstandingRequest(w)}var t;b.$$incOutstandingRequestCount();m=m||b.url();if("jsonp"==J(e)){var N="_"+(d.counter++).toString(36);d[N]=function(a){d[N].data=a;d[N].called=!0};var B=g(m.replace("JSON_CALLBACK","angular.callbacks."+N),N,function(a,b){x(l,a,d[N].data,"",b);d[N]=w})}else{var v=
+a(e);v.open(e,m,!0);q(n,function(a,b){z(a)&&v.setRequestHeader(b,a)});v.onreadystatechange=function(){if(v&&4==v.readyState){var a=null,b=null;t!==f&&(a=v.getAllResponseHeaders(),b="response"in v?v.response:v.responseText);x(l,t||v.status,b,a,v.statusText||"")}};r&&(v.withCredentials=!0);if(A)try{v.responseType=A}catch(s){if("json"!==A)throw s;}v.send(k||null)}if(0<p)var K=c(D,p);else p&&p.then&&p.then(D)}}function Rd(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=
+function(b){return b?(a=b,this):a};this.$get=["$parse","$exceptionHandler","$sce",function(c,d,e){function g(g,k,l){for(var n,p,r=0,A=[],D=g.length,x=!1,t=[];r<D;)-1!=(n=g.indexOf(b,r))&&-1!=(p=g.indexOf(a,n+f))?(r!=n&&A.push(g.substring(r,n)),A.push(r=c(x=g.substring(n+f,p))),r.exp=x,r=p+h,x=!0):(r!=D&&A.push(g.substring(r)),r=D);(D=A.length)||(A.push(""),D=1);if(l&&1<A.length)throw yc("noconcat",g);if(!k||x)return t.length=D,r=function(a){try{for(var b=0,c=D,f;b<c;b++){if("function"==typeof(f=A[b]))if(f=
+f(a),f=l?e.getTrusted(l,f):e.valueOf(f),null==f)f="";else switch(typeof f){case "string":break;case "number":f=""+f;break;default:f=qa(f)}t[b]=f}return t.join("")}catch(h){a=yc("interr",g,h.toString()),d(a)}},r.exp=g,r.parts=A,r}var f=b.length,h=a.length;g.startSymbol=function(){return b};g.endSymbol=function(){return a};return g}]}function Sd(){this.$get=["$rootScope","$window","$q",function(b,a,c){function d(d,f,h,m){var k=a.setInterval,l=a.clearInterval,n=c.defer(),p=n.promise,r=0,A=z(m)&&!m;h=
+z(h)?h:0;p.then(null,null,d);p.$$intervalId=k(function(){n.notify(r++);0<h&&r>=h&&(n.resolve(r),l(p.$$intervalId),delete e[p.$$intervalId]);A||b.$apply()},f);e[p.$$intervalId]=n;return p}var e={};d.cancel=function(a){return a&&a.$$intervalId in e?(e[a.$$intervalId].reject("canceled"),clearInterval(a.$$intervalId),delete e[a.$$intervalId],!0):!1};return d}]}function ad(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",
+posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM",
+"PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function Lb(b){b=b.split("/");for(var a=b.length;a--;)b[a]=gb(b[a]);return b.join("/")}function zc(b,a,c){b=sa(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=Y(b.port)||we[b.protocol]||null}function Ac(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=
+sa(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=bc(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function oa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Za(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function Mb(b){return b.substr(0,Za(b).lastIndexOf("/")+1)}function Bc(b,a){this.$$html5=!0;a=a||"";var c=Mb(b);zc(b,this,b);this.$$parse=function(a){var e=
+oa(c,a);if(!C(e))throw Nb("ipthprfx",a,c);Ac(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=zb(this.$$search),b=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Lb(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e;if((e=oa(b,d))!==s)return d=e,(e=oa(a,e))!==s?c+(oa("/",e)||e):b+d;if((e=oa(c,d))!==s)return c+e;if(c==d+"/")return c}}function Ob(b,a){var c=Mb(b);zc(b,this,b);this.$$parse=function(d){var e=oa(b,
+d)||oa(c,d),e="#"==e.charAt(0)?oa(a,e):this.$$html5?e:"";if(!C(e))throw Nb("ihshprfx",d,a);Ac(e,this,b);d=this.$$path;var g=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));g.exec(e)||(d=(e=g.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=zb(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Lb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(Za(b)==Za(a))return a}}function Pb(b,a){this.$$html5=
+!0;Ob.apply(this,arguments);var c=Mb(b);this.$$rewrite=function(d){var e;if(b==Za(d))return d;if(e=oa(c,d))return b+a+e;if(c===d+"/")return c};this.$$compose=function(){var c=zb(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Lb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function qb(b){return function(){return this[b]}}function Cc(b,a){return function(c){if(H(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Vd(){var b="",a=!1;this.hashPrefix=function(a){return z(a)?
+(b=a,this):b};this.html5Mode=function(b){return z(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function f(a){c.$broadcast("$locationChangeSuccess",h.absUrl(),a)}var h,m,k=d.baseHref(),l=d.url(),n;a?(n=l.substring(0,l.indexOf("/",l.indexOf("//")+2))+(k||"/"),m=e.history?Bc:Pb):(n=Za(l),m=Ob);h=new m(n,"#"+b);h.$$parse(h.$$rewrite(l));g.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var e=y(a.target);"a"!==J(e[0].nodeName);)if(e[0]===
+g[0]||!(e=e.parent())[0])return;var f=e.prop("href");X(f)&&"[object SVGAnimatedString]"===f.toString()&&(f=sa(f.animVal).href);if(m===Pb){var k=e.attr("href")||e.attr("xlink:href");if(0>k.indexOf("://"))if(f="#"+b,"/"==k[0])f=n+f+k;else if("#"==k[0])f=n+f+(h.path()||"/")+k;else{for(var l=h.path().split("/"),k=k.split("/"),p=0;p<k.length;p++)"."!=k[p]&&(".."==k[p]?l.pop():k[p].length&&l.push(k[p]));f=n+f+l.join("/")}}l=h.$$rewrite(f);f&&(!e.attr("target")&&l&&!a.isDefaultPrevented())&&(a.preventDefault(),
+l!=d.url()&&(h.$$parse(l),c.$apply(),P.angular["ff-684208-preventDefault"]=!0))}});h.absUrl()!=l&&d.url(h.absUrl(),!0);d.onUrlChange(function(a){h.absUrl()!=a&&(c.$evalAsync(function(){var b=h.absUrl();h.$$parse(a);c.$broadcast("$locationChangeStart",a,b).defaultPrevented?(h.$$parse(b),d.url(b)):f(b)}),c.$$phase||c.$digest())});var p=0;c.$watch(function(){var a=d.url(),b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",h.absUrl(),a).defaultPrevented?h.$$parse(a):
+(d.url(h.absUrl(),b),f(a))}));h.$$replace=!1;return p});return h}]}function Wd(){var b=!0,a=this;this.debugEnabled=function(a){return z(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||w;a=!1;try{a=!!e.apply}catch(m){}return a?function(){var a=[];q(arguments,
+function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function ga(b,a){if("constructor"===b)throw Ca("isecfld",a);return b}function $a(b,a){if(b){if(b.constructor===b)throw Ca("isecfn",a);if(b.document&&b.location&&b.alert&&b.setInterval)throw Ca("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw Ca("isecdom",
+a);}return b}function rb(b,a,c,d,e){e=e||{};a=a.split(".");for(var g,f=0;1<a.length;f++){g=ga(a.shift(),d);var h=b[g];h||(h={},b[g]=h);b=h;b.then&&e.unwrapPromises&&(ta(d),"$$v"in b||function(a){a.then(function(b){a.$$v=b})}(b),b.$$v===s&&(b.$$v={}),b=b.$$v)}g=ga(a.shift(),d);return b[g]=c}function Dc(b,a,c,d,e,g,f){ga(b,g);ga(a,g);ga(c,g);ga(d,g);ga(e,g);return f.unwrapPromises?function(f,m){var k=m&&m.hasOwnProperty(b)?m:f,l;if(null==k)return k;(k=k[b])&&k.then&&(ta(g),"$$v"in k||(l=k,l.$$v=s,l.then(function(a){l.$$v=
+a})),k=k.$$v);if(!a)return k;if(null==k)return s;(k=k[a])&&k.then&&(ta(g),"$$v"in k||(l=k,l.$$v=s,l.then(function(a){l.$$v=a})),k=k.$$v);if(!c)return k;if(null==k)return s;(k=k[c])&&k.then&&(ta(g),"$$v"in k||(l=k,l.$$v=s,l.then(function(a){l.$$v=a})),k=k.$$v);if(!d)return k;if(null==k)return s;(k=k[d])&&k.then&&(ta(g),"$$v"in k||(l=k,l.$$v=s,l.then(function(a){l.$$v=a})),k=k.$$v);if(!e)return k;if(null==k)return s;(k=k[e])&&k.then&&(ta(g),"$$v"in k||(l=k,l.$$v=s,l.then(function(a){l.$$v=a})),k=k.$$v);
+return k}:function(g,f){var k=f&&f.hasOwnProperty(b)?f:g;if(null==k)return k;k=k[b];if(!a)return k;if(null==k)return s;k=k[a];if(!c)return k;if(null==k)return s;k=k[c];if(!d)return k;if(null==k)return s;k=k[d];return e?null==k?s:k=k[e]:k}}function xe(b,a){ga(b,a);return function(a,d){return null==a?s:(d&&d.hasOwnProperty(b)?d:a)[b]}}function ye(b,a,c){ga(b,c);ga(a,c);return function(c,e){if(null==c)return s;c=(e&&e.hasOwnProperty(b)?e:c)[b];return null==c?s:c[a]}}function Ec(b,a,c){if(Qb.hasOwnProperty(b))return Qb[b];
+var d=b.split("."),e=d.length,g;if(a.unwrapPromises||1!==e)if(a.unwrapPromises||2!==e)if(a.csp)g=6>e?Dc(d[0],d[1],d[2],d[3],d[4],c,a):function(b,g){var f=0,h;do h=Dc(d[f++],d[f++],d[f++],d[f++],d[f++],c,a)(b,g),g=s,b=h;while(f<e);return h};else{var f="var p;\n";q(d,function(b,d){ga(b,c);f+="if(s == null) return undefined;\ns="+(d?"s":'((k&&k.hasOwnProperty("'+b+'"))?k:s)')+'["'+b+'"];\n'+(a.unwrapPromises?'if (s && s.then) {\n pw("'+c.replace(/(["\r\n])/g,"\\$1")+'");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n':
+"")});var f=f+"return s;",h=new Function("s","k","pw",f);h.toString=aa(f);g=a.unwrapPromises?function(a,b){return h(a,b,ta)}:h}else g=ye(d[0],d[1],c);else g=xe(d[0],c);"hasOwnProperty"!==b&&(Qb[b]=g);return g}function Xd(){var b={},a={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0};this.unwrapPromises=function(b){return z(b)?(a.unwrapPromises=!!b,this):a.unwrapPromises};this.logPromiseWarnings=function(b){return z(b)?(a.logPromiseWarnings=b,this):a.logPromiseWarnings};this.$get=["$filter","$sniffer",
+"$log",function(c,d,e){a.csp=d.csp;ta=function(b){a.logPromiseWarnings&&!Fc.hasOwnProperty(b)&&(Fc[b]=!0,e.warn("[$parse] Promise found in the expression `"+b+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))};return function(d){var e;switch(typeof d){case "string":if(b.hasOwnProperty(d))return b[d];e=new Rb(a);e=(new ab(e,c,a)).parse(d,!1);"hasOwnProperty"!==d&&(b[d]=e);return e;case "function":return d;default:return w}}}]}function Zd(){this.$get=["$rootScope","$exceptionHandler",
+function(b,a){return ze(function(a){b.$evalAsync(a)},a)}]}function ze(b,a){function c(a){return a}function d(a){return f(a)}var e=function(){var f=[],k,l;return l={resolve:function(a){if(f){var c=f;f=s;k=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],k.then(a[0],a[1],a[2])})}},reject:function(a){l.resolve(h(a))},notify:function(a){if(f){var c=f;f.length&&b(function(){for(var b,d=0,e=c.length;d<e;d++)b=c[d],b[2](a)})}},promise:{then:function(b,g,h){var l=e(),D=function(d){try{l.resolve((Q(b)?
+b:c)(d))}catch(e){l.reject(e),a(e)}},x=function(b){try{l.resolve((Q(g)?g:d)(b))}catch(c){l.reject(c),a(c)}},t=function(b){try{l.notify((Q(h)?h:c)(b))}catch(d){a(d)}};f?f.push([D,x,t]):k.then(D,x,t);return l.promise},"catch":function(a){return this.then(null,a)},"finally":function(a){function b(a,c){var d=e();c?d.resolve(a):d.reject(a);return d.promise}function d(e,g){var f=null;try{f=(a||c)()}catch(h){return b(h,!1)}return f&&Q(f.then)?f.then(function(){return b(e,g)},function(a){return b(a,!1)}):
+b(e,g)}return this.then(function(a){return d(a,!0)},function(a){return d(a,!1)})}}}},g=function(a){return a&&Q(a.then)?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},f=function(a){var b=e();b.reject(a);return b.promise},h=function(c){return{then:function(g,f){var h=e();b(function(){try{h.resolve((Q(f)?f:d)(c))}catch(b){h.reject(b),a(b)}});return h.promise}}};return{defer:e,reject:f,when:function(h,k,l,n){var p=e(),r,A=function(b){try{return(Q(k)?k:c)(b)}catch(d){return a(d),
+f(d)}},D=function(b){try{return(Q(l)?l:d)(b)}catch(c){return a(c),f(c)}},x=function(b){try{return(Q(n)?n:c)(b)}catch(d){a(d)}};b(function(){g(h).then(function(a){r||(r=!0,p.resolve(g(a).then(A,D,x)))},function(a){r||(r=!0,p.resolve(D(a)))},function(a){r||p.notify(x(a))})});return p.promise},all:function(a){var b=e(),c=0,d=L(a)?[]:{};q(a,function(a,e){c++;g(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise}}}
+function fe(){this.$get=["$window","$timeout",function(b,a){var c=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame,d=b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.mozCancelAnimationFrame||b.webkitCancelRequestAnimationFrame,e=!!c,g=e?function(a){var b=c(a);return function(){d(b)}}:function(b){var c=a(b,16.66,!1);return function(){a.cancel(c)}};g.supported=e;return g}]}function Yd(){var b=10,a=u("$rootScope"),c=null;this.digestTtl=function(a){arguments.length&&
+(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(d,e,g,f){function h(){this.$id=cb();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$postDigestQueue=[];this.$$listeners={};this.$$listenerCount={};this.$$isolateBindings={}}function m(b){if(p.$$phase)throw a("inprog",p.$$phase);p.$$phase=b}function k(a,b){var c=g(a);
+Ra(c,b);return c}function l(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function n(){}h.prototype={constructor:h,$new:function(a){a?(a=new h,a.$root=this.$root,a.$$asyncQueue=this.$$asyncQueue,a.$$postDigestQueue=this.$$postDigestQueue):(this.$$childScopeClass||(this.$$childScopeClass=function(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$id=cb();this.$$childScopeClass=
+null},this.$$childScopeClass.prototype=this),a=new this.$$childScopeClass);a["this"]=a;a.$parent=this;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,d){var e=k(a,"watch"),g=this.$$watchers,f={fn:b,last:n,get:e,exp:a,eq:!!d};c=null;if(!Q(b)){var h=k(b||w,"listener");f.fn=function(a,b,c){h(c)}}if("string"==typeof a&&e.constant){var m=f.fn;f.fn=function(a,b,c){m.call(this,a,b,c);Na(g,
+f)}}g||(g=this.$$watchers=[]);g.unshift(f);return function(){Na(g,f);c=null}},$watchCollection:function(a,b){var c=this,d,e,f,h=1<b.length,k=0,m=g(a),l=[],n={},p=!0,q=0;return this.$watch(function(){d=m(c);var a,b;if(X(d))if(bb(d))for(e!==l&&(e=l,q=e.length=0,k++),a=d.length,q!==a&&(k++,e.length=q=a),b=0;b<a;b++)e[b]!==e[b]&&d[b]!==d[b]||e[b]===d[b]||(k++,e[b]=d[b]);else{e!==n&&(e=n={},q=0,k++);a=0;for(b in d)d.hasOwnProperty(b)&&(a++,e.hasOwnProperty(b)?e[b]!==d[b]&&(k++,e[b]=d[b]):(q++,e[b]=d[b],
+k++));if(q>a)for(b in k++,e)e.hasOwnProperty(b)&&!d.hasOwnProperty(b)&&(q--,delete e[b])}else e!==d&&(e=d,k++);return k},function(){p?(p=!1,b(d,d,c)):b(d,f,c);if(h)if(X(d))if(bb(d)){f=Array(d.length);for(var a=0;a<d.length;a++)f[a]=d[a]}else for(a in f={},d)Gc.call(d,a)&&(f[a]=d[a]);else f=d})},$digest:function(){var d,g,f,h,k=this.$$asyncQueue,l=this.$$postDigestQueue,q,v,s=b,K,O=[],y,F,R;m("$digest");c=null;do{v=!1;for(K=this;k.length;){try{R=k.shift(),R.scope.$eval(R.expression)}catch(z){p.$$phase=
+null,e(z)}c=null}a:do{if(h=K.$$watchers)for(q=h.length;q--;)try{if(d=h[q])if((g=d.get(K))!==(f=d.last)&&!(d.eq?xa(g,f):"number"==typeof g&&"number"==typeof f&&isNaN(g)&&isNaN(f)))v=!0,c=d,d.last=d.eq?ca(g):g,d.fn(g,f===n?g:f,K),5>s&&(y=4-s,O[y]||(O[y]=[]),F=Q(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,F+="; newVal: "+qa(g)+"; oldVal: "+qa(f),O[y].push(F));else if(d===c){v=!1;break a}}catch(C){p.$$phase=null,e(C)}if(!(h=K.$$childHead||K!==this&&K.$$nextSibling))for(;K!==this&&!(h=K.$$nextSibling);)K=
+K.$parent}while(K=h);if((v||k.length)&&!s--)throw p.$$phase=null,a("infdig",b,qa(O));}while(v||k.length);for(p.$$phase=null;l.length;)try{l.shift()()}catch(T){e(T)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this!==p&&(q(this.$$listenerCount,fb(null,l,this)),a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),
+this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null,this.$$listeners={},this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=[],this.$destroy=this.$digest=this.$apply=w,this.$on=this.$watch=function(){return w})}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a){p.$$phase||p.$$asyncQueue.length||f.defer(function(){p.$$asyncQueue.length&&p.$digest()});this.$$asyncQueue.push({scope:this,
+expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)},$apply:function(a){try{return m("$apply"),this.$eval(a)}catch(b){e(b)}finally{p.$$phase=null;try{p.$digest()}catch(c){throw e(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){c[eb(c,b)]=null;l(e,1,a)}},$emit:function(a,b){var c=[],d,g=this,f=!1,h={name:a,
+targetScope:g,stopPropagation:function(){f=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=[h].concat(ya.call(arguments,1)),m,l;do{d=g.$$listeners[a]||c;h.currentScope=g;m=0;for(l=d.length;m<l;m++)if(d[m])try{d[m].apply(null,k)}catch(n){e(n)}else d.splice(m,1),m--,l--;if(f)break;g=g.$parent}while(g);return h},$broadcast:function(a,b){for(var c=this,d=this,g={name:a,targetScope:this,preventDefault:function(){g.defaultPrevented=!0},defaultPrevented:!1},f=[g].concat(ya.call(arguments,
+1)),h,k;c=d;){g.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,f)}catch(m){e(m)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}return g}};var p=new h;return p}]}function bd(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*(https?|ftp|file):|data:image\//;this.aHrefSanitizationWhitelist=function(a){return z(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=
+function(b){return z(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,g;if(!S||8<=S)if(g=sa(c).href,""!==g&&!g.match(e))return"unsafe:"+g;return c}}}function Ae(b){if("self"===b)return b;if(C(b)){if(-1<b.indexOf("***"))throw ua("iwcard",b);b=b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08").replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return RegExp("^"+b+"$")}if(db(b))return RegExp("^"+b.source+"$");throw ua("imatcher");}function Hc(b){var a=[];
+z(b)&&q(b,function(b){a.push(Ae(b))});return a}function ae(){this.SCE_CONTEXTS=ha;var b=["self"],a=[];this.resourceUrlWhitelist=function(a){arguments.length&&(b=Hc(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=Hc(b));return a};this.$get=["$injector",function(c){function d(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};
+return b}var e=function(a){throw ua("unsafe");};c.has("$sanitize")&&(e=c.get("$sanitize"));var g=d(),f={};f[ha.HTML]=d(g);f[ha.CSS]=d(g);f[ha.URL]=d(g);f[ha.JS]=d(g);f[ha.RESOURCE_URL]=d(f[ha.URL]);return{trustAs:function(a,b){var c=f.hasOwnProperty(a)?f[a]:null;if(!c)throw ua("icontext",a,b);if(null===b||b===s||""===b)return b;if("string"!==typeof b)throw ua("itype",a);return new c(b)},getTrusted:function(c,d){if(null===d||d===s||""===d)return d;var g=f.hasOwnProperty(c)?f[c]:null;if(g&&d instanceof
+g)return d.$$unwrapTrustedValue();if(c===ha.RESOURCE_URL){var g=sa(d.toString()),l,n,p=!1;l=0;for(n=b.length;l<n;l++)if("self"===b[l]?Kb(g):b[l].exec(g.href)){p=!0;break}if(p)for(l=0,n=a.length;l<n;l++)if("self"===a[l]?Kb(g):a[l].exec(g.href)){p=!1;break}if(p)return d;throw ua("insecurl",d.toString());}if(c===ha.HTML)return e(d);throw ua("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function $d(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};
+this.$get=["$parse","$sniffer","$sceDelegate",function(a,c,d){if(b&&c.msie&&8>c.msieDocumentMode)throw ua("iequirks");var e=ca(ha);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=Ea);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var g=e.parseAs,f=e.getTrusted,h=e.trustAs;q(ha,function(a,b){var c=J(b);e[Ta("parse_as_"+c)]=
+function(b){return g(a,b)};e[Ta("get_trusted_"+c)]=function(b){return f(a,b)};e[Ta("trust_as_"+c)]=function(b){return h(a,b)}});return e}]}function be(){this.$get=["$window","$document",function(b,a){var c={},d=Y((/android (\d+)/.exec(J((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),g=a[0]||{},f=g.documentMode,h,m=/^(Moz|webkit|O|ms)(?=[A-Z])/,k=g.body&&g.body.style,l=!1,n=!1;if(k){for(var p in k)if(l=m.exec(p)){h=l[0];h=h.substr(0,1).toUpperCase()+h.substr(1);
+break}h||(h="WebkitOpacity"in k&&"webkit");l=!!("transition"in k||h+"Transition"in k);n=!!("animation"in k||h+"Animation"in k);!d||l&&n||(l=C(g.body.style.webkitTransition),n=C(g.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!f||7<f),hasEvent:function(a){if("input"==a&&9==S)return!1;if(H(c[a])){var b=g.createElement("div");c[a]="on"+a in b}return c[a]},csp:Zb(),vendorPrefix:h,transitions:l,animations:n,android:d,msie:S,msieDocumentMode:f}}]}
+function de(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,h,m){var k=c.defer(),l=k.promise,n=z(m)&&!m;h=a.defer(function(){try{k.resolve(e())}catch(a){k.reject(a),d(a)}finally{delete g[l.$$timeoutId]}n||b.$apply()},h);l.$$timeoutId=h;g[h]=k;return l}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),delete g[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return e}]}function sa(b,a){var c=b;S&&(W.setAttribute("href",
+c),c=W.href);W.setAttribute("href",c);return{href:W.href,protocol:W.protocol?W.protocol.replace(/:$/,""):"",host:W.host,search:W.search?W.search.replace(/^\?/,""):"",hash:W.hash?W.hash.replace(/^#/,""):"",hostname:W.hostname,port:W.port,pathname:"/"===W.pathname.charAt(0)?W.pathname:"/"+W.pathname}}function Kb(b){b=C(b)?sa(b):b;return b.protocol===Ic.protocol&&b.host===Ic.host}function ee(){this.$get=aa(P)}function jc(b){function a(d,e){if(X(d)){var g={};q(d,function(b,c){g[c]=a(c,b)});return g}return b.factory(d+
+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",Jc);a("date",Kc);a("filter",Be);a("json",Ce);a("limitTo",De);a("lowercase",Ee);a("number",Lc);a("orderBy",Mc);a("uppercase",Fe)}function Be(){return function(b,a,c){if(!L(b))return b;var d=typeof c,e=[];e.check=function(a){for(var b=0;b<e.length;b++)if(!e[b](a))return!1;return!0};"function"!==d&&(c="boolean"===d&&c?function(a,b){return Qa.equals(a,b)}:function(a,b){if(a&&b&&
+"object"===typeof a&&"object"===typeof b){for(var d in a)if("$"!==d.charAt(0)&&Gc.call(a,d)&&c(a[d],b[d]))return!0;return!1}b=(""+b).toLowerCase();return-1<(""+a).toLowerCase().indexOf(b)});var g=function(a,b){if("string"==typeof b&&"!"===b.charAt(0))return!g(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return c(a,b);case "object":switch(typeof b){case "object":return c(a,b);default:for(var d in a)if("$"!==d.charAt(0)&&g(a[d],b))return!0}return!1;case "array":for(d=0;d<
+a.length;d++)if(g(a[d],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var f in a)(function(b){"undefined"!=typeof a[b]&&e.push(function(c){return g("$"==b?c:c&&c[b],a[b])})})(f);break;case "function":e.push(a);break;default:return b}d=[];for(f=0;f<b.length;f++){var h=b[f];e.check(h)&&d.push(h)}return d}}function Jc(b){var a=b.NUMBER_FORMATS;return function(b,d){H(d)&&(d=a.CURRENCY_SYM);return Nc(b,a.PATTERNS[1],a.GROUP_SEP,
+a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Lc(b){var a=b.NUMBER_FORMATS;return function(b,d){return Nc(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Nc(b,a,c,d,e){if(null==b||!isFinite(b)||X(b))return"";var g=0>b;b=Math.abs(b);var f=b+"",h="",m=[],k=!1;if(-1!==f.indexOf("e")){var l=f.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&l[3]>e+1?f="0":(h=f,k=!0)}if(k)0<e&&(-1<b&&1>b)&&(h=b.toFixed(e));else{f=(f.split(Oc)[1]||"").length;H(e)&&(e=Math.min(Math.max(a.minFrac,f),a.maxFrac));f=Math.pow(10,
+e+1);b=Math.floor(b*f+5)/f;b=(""+b).split(Oc);f=b[0];b=b[1]||"";var l=0,n=a.lgSize,p=a.gSize;if(f.length>=n+p)for(l=f.length-n,k=0;k<l;k++)0===(l-k)%p&&0!==k&&(h+=c),h+=f.charAt(k);for(k=l;k<f.length;k++)0===(f.length-k)%n&&0!==k&&(h+=c),h+=f.charAt(k);for(;b.length<e;)b+="0";e&&"0"!==e&&(h+=d+b.substr(0,e))}m.push(g?a.negPre:a.posPre);m.push(h);m.push(g?a.negSuf:a.posSuf);return m.join("")}function Sb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+
+b}function $(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=12);return Sb(e,a,d)}}function sb(b,a){return function(c,d){var e=c["get"+b](),g=Fa(a?"SHORT"+b:b);return d[g][e]}}function Kc(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var g=0,f=0,h=b[8]?a.setUTCFullYear:a.setFullYear,m=b[8]?a.setUTCHours:a.setHours;b[9]&&(g=Y(b[9]+b[10]),f=Y(b[9]+b[11]));h.call(a,Y(b[1]),Y(b[2])-1,Y(b[3]));g=Y(b[4]||0)-g;f=Y(b[5]||0)-f;h=Y(b[6]||0);b=Math.round(1E3*parseFloat("0."+
+(b[7]||0)));m.call(a,g,f,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g="",f=[],h,m;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;C(c)&&(c=Ge.test(c)?Y(c):a(c));yb(c)&&(c=new Date(c));if(!Ma(c))return c;for(;e;)(m=He.exec(e))?(f=f.concat(ya.call(m,1)),e=f.pop()):(f.push(e),e=null);q(f,function(a){h=Ie[a];g+=h?h(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Ce(){return function(b){return qa(b,
+!0)}}function De(){return function(b,a){if(!L(b)&&!C(b))return b;a=Infinity===Math.abs(Number(a))?Number(a):Y(a);if(C(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0<a?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Mc(b){return function(a,c,d){function e(a,b){return Pa(b)?function(b,c){return a(c,b)}:a}function g(a,b){var c=typeof a,d=typeof b;return c==d?("string"==c&&(a=a.toLowerCase(),b=b.toLowerCase()),
+a===b?0:a<b?-1:1):c<d?-1:1}if(!L(a)||!c)return a;c=L(c)?c:[c];c=Uc(c,function(a){var c=!1,d=a||Ea;if(C(a)){if("+"==a.charAt(0)||"-"==a.charAt(0))c="-"==a.charAt(0),a=a.substring(1);d=b(a);if(d.constant){var f=d();return e(function(a,b){return g(a[f],b[f])},c)}}return e(function(a,b){return g(d(a),d(b))},c)});for(var f=[],h=0;h<a.length;h++)f.push(a[h]);return f.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(0!==e)return e}return 0},d))}}function va(b){Q(b)&&(b={link:b});b.restrict=
+b.restrict||"AC";return aa(b)}function Pc(b,a,c,d){function e(a,c){c=c?"-"+hb(c,"-"):"";d.removeClass(b,(a?tb:ub)+c);d.addClass(b,(a?ub:tb)+c)}var g=this,f=b.parent().controller("form")||vb,h=0,m=g.$error={},k=[];g.$name=a.name||a.ngForm;g.$dirty=!1;g.$pristine=!0;g.$valid=!0;g.$invalid=!1;f.$addControl(g);b.addClass(Ka);e(!0);g.$addControl=function(a){Aa(a.$name,"input");k.push(a);a.$name&&(g[a.$name]=a)};g.$removeControl=function(a){a.$name&&g[a.$name]===a&&delete g[a.$name];q(m,function(b,c){g.$setValidity(c,
+!0,a)});Na(k,a)};g.$setValidity=function(a,b,c){var d=m[a];if(b)d&&(Na(d,c),d.length||(h--,h||(e(b),g.$valid=!0,g.$invalid=!1),m[a]=!1,e(!0,a),f.$setValidity(a,!0,g)));else{h||e(b);if(d){if(-1!=eb(d,c))return}else m[a]=d=[],h++,e(!1,a),f.$setValidity(a,!1,g);d.push(c);g.$valid=!1;g.$invalid=!0}};g.$setDirty=function(){d.removeClass(b,Ka);d.addClass(b,wb);g.$dirty=!0;g.$pristine=!1;f.$setDirty()};g.$setPristine=function(){d.removeClass(b,wb);d.addClass(b,Ka);g.$dirty=!1;g.$pristine=!0;q(k,function(a){a.$setPristine()})}}
+function pa(b,a,c,d){b.$setValidity(a,c);return c?d:s}function Je(b,a,c){var d=c.prop("validity");X(d)&&b.$parsers.push(function(c){if(b.$error[a]||!(d.badInput||d.customError||d.typeMismatch)||d.valueMissing)return c;b.$setValidity(a,!1)})}function xb(b,a,c,d,e,g){var f=a.prop("validity"),h=a[0].placeholder,m={};if(!e.android){var k=!1;a.on("compositionstart",function(a){k=!0});a.on("compositionend",function(){k=!1;l()})}var l=function(e){if(!k){var g=a.val();if(S&&"input"===(e||m).type&&a[0].placeholder!==
+h)h=a[0].placeholder;else if(Pa(c.ngTrim||"T")&&(g=ba(g)),d.$viewValue!==g||f&&""===g&&!f.valueMissing)b.$$phase?d.$setViewValue(g):b.$apply(function(){d.$setViewValue(g)})}};if(e.hasEvent("input"))a.on("input",l);else{var n,p=function(){n||(n=g.defer(function(){l();n=null}))};a.on("keydown",function(a){a=a.keyCode;91===a||(15<a&&19>a||37<=a&&40>=a)||p()});if(e.hasEvent("paste"))a.on("paste cut",p)}a.on("change",l);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var r=c.ngPattern;
+r&&((e=r.match(/^\/(.*)\/([gim]*)$/))?(r=RegExp(e[1],e[2]),e=function(a){return pa(d,"pattern",d.$isEmpty(a)||r.test(a),a)}):e=function(c){var e=b.$eval(r);if(!e||!e.test)throw u("ngPattern")("noregexp",r,e,ia(a));return pa(d,"pattern",d.$isEmpty(c)||e.test(c),c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var q=Y(c.ngMinlength);e=function(a){return pa(d,"minlength",d.$isEmpty(a)||a.length>=q,a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var D=Y(c.ngMaxlength);e=
+function(a){return pa(d,"maxlength",d.$isEmpty(a)||a.length<=D,a)};d.$parsers.push(e);d.$formatters.push(e)}}function Tb(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],l=0;l<b.length;l++)if(e==b[l])continue a;c.push(e)}return c}function e(a){if(!L(a)){if(C(a))return a.split(" ");if(X(a)){var b=[];q(a,function(a,c){a&&b.push(c)});return b}}return a}return{restrict:"AC",link:function(g,f,h){function m(a,b){var c=f.data("$classCounts")||
+{},d=[];q(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});f.data("$classCounts",c);return d.join(" ")}function k(b){if(!0===a||g.$index%2===a){var k=e(b||[]);if(!l){var r=m(k,1);h.$addClass(r)}else if(!xa(b,l)){var q=e(l),r=d(k,q),k=d(q,k),k=m(k,-1),r=m(r,1);0===r.length?c.removeClass(f,k):0===k.length?c.addClass(f,r):c.setClass(f,r,k)}}l=ca(b)}var l;g.$watch(h[b],k,!0);h.$observe("class",function(a){k(g.$eval(h[b]))});"ngClass"!==b&&g.$watch("$index",function(c,d){var f=c&
+1;if(f!==(d&1)){var k=e(g.$eval(h[b]));f===a?(f=m(k,1),h.$addClass(f)):(f=m(k,-1),h.$removeClass(f))}})}}}]}var J=function(b){return C(b)?b.toLowerCase():b},Gc=Object.prototype.hasOwnProperty,Fa=function(b){return C(b)?b.toUpperCase():b},S,y,Ba,ya=[].slice,Ke=[].push,wa=Object.prototype.toString,Oa=u("ng"),Qa=P.angular||(P.angular={}),Sa,Ja,ka=["0","0","0"];S=Y((/msie (\d+)/.exec(J(navigator.userAgent))||[])[1]);isNaN(S)&&(S=Y((/trident\/.*; rv:(\d+)/.exec(J(navigator.userAgent))||[])[1]));w.$inject=
+[];Ea.$inject=[];var ba=function(){return String.prototype.trim?function(b){return C(b)?b.trim():b}:function(b){return C(b)?b.replace(/^\s\s*/,"").replace(/\s\s*$/,""):b}}();Ja=9>S?function(b){b=b.nodeName?b:b[0];return b.scopeName&&"HTML"!=b.scopeName?Fa(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var Xc=/[A-Z]/g,$c={full:"1.2.17-build.178+sha.2406084",major:1,minor:2,dot:17,codeName:"snapshot"},Va=M.cache={},ib=M.expando="ng-"+(new Date).getTime(),
+me=1,pb=P.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},Ua=P.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)};M._data=function(b){return this.cache[b[this.expando]]||{}};var he=/([\:\-\_]+(.))/g,ie=/^moz([A-Z])/,Eb=u("jqLite"),je=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Fb=/<|&#?\w+;/,ke=/<([\w:]+)/,le=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ea=
+{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,"",""]};ea.optgroup=ea.option;ea.tbody=ea.tfoot=ea.colgroup=ea.caption=ea.thead;ea.th=ea.td;var Ia=M.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===U.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),M(P).on("load",a))},toString:function(){var b=
+[];q(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?y(this[b]):y(this[this.length+b])},length:0,push:Ke,sort:[].sort,splice:[].splice},mb={};q("multiple selected checked disabled readOnly required open".split(" "),function(b){mb[J(b)]=b});var qc={};q("input select option textarea button form details".split(" "),function(b){qc[Fa(b)]=!0});q({data:mc,inheritedData:lb,scope:function(b){return y(b).data("$scope")||lb(b.parentNode||b,["$isolateScope","$scope"])},
+isolateScope:function(b){return y(b).data("$isolateScope")||y(b).data("$isolateScopeNoTemplate")},controller:nc,injector:function(b){return lb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Ib,css:function(b,a,c){a=Ta(a);if(z(c))b.style[a]=c;else{var d;8>=S&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=S&&(d=""===d?s:d);return d}},attr:function(b,a,c){var d=J(a);if(mb[d])if(z(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));
+else return b[a]||(b.attributes.getNamedItem(a)||w).specified?d:s;else if(z(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?s:b},prop:function(b,a,c){if(z(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(H(d))return e?b[e]:"";b[e]=d}var a=[];9>S?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(H(a)){if("SELECT"===Ja(b)&&b.multiple){var c=[];q(b.options,function(a){a.selected&&
+c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(H(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)Ga(d[c]);b.innerHTML=a},empty:oc},function(b,a){M.prototype[a]=function(a,d){var e,g;if(b!==oc&&(2==b.length&&b!==Ib&&b!==nc?a:d)===s){if(X(a)){for(e=0;e<this.length;e++)if(b===mc)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}e=b.$dv;g=e===s?Math.min(this.length,1):this.length;for(var f=0;f<g;f++){var h=b(this[f],a,d);e=
+e?e+h:h}return e}for(e=0;e<this.length;e++)b(this[e],a,d);return this}});q({removeData:kc,dealoc:Ga,on:function a(c,d,e,g){if(z(g))throw Eb("onargs");var f=la(c,"events"),h=la(c,"handle");f||la(c,"events",f={});h||la(c,"handle",h=ne(c,f));q(d.split(" "),function(d){var g=f[d];if(!g){if("mouseenter"==d||"mouseleave"==d){var l=U.body.contains||U.body.compareDocumentPosition?function(a,c){var d=9===a.nodeType?a.documentElement:a,e=c&&c.parentNode;return a===e||!!(e&&1===e.nodeType&&(d.contains?d.contains(e):
+a.compareDocumentPosition&&a.compareDocumentPosition(e)&16))}:function(a,c){if(c)for(;c=c.parentNode;)if(c===a)return!0;return!1};f[d]=[];a(c,{mouseleave:"mouseout",mouseenter:"mouseover"}[d],function(a){var c=a.relatedTarget;c&&(c===this||l(this,c))||h(a,d)})}else pb(c,d,h),f[d]=[];g=f[d]}g.push(e)})},off:lc,one:function(a,c,d){a=y(a);a.on(c,function g(){a.off(c,d);a.off(c,g)});a.on(c,d)},replaceWith:function(a,c){var d,e=a.parentNode;Ga(a);q(new M(c),function(c){d?e.insertBefore(c,d.nextSibling):
+e.replaceChild(c,a);d=c})},children:function(a){var c=[];q(a.childNodes,function(a){1===a.nodeType&&c.push(a)});return c},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,c){q(new M(c),function(c){1!==a.nodeType&&11!==a.nodeType||a.appendChild(c)})},prepend:function(a,c){if(1===a.nodeType){var d=a.firstChild;q(new M(c),function(c){a.insertBefore(c,d)})}},wrap:function(a,c){c=y(c)[0];var d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){Ga(a);
+var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;q(new M(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:kb,removeClass:jb,toggleClass:function(a,c,d){c&&q(c.split(" "),function(c){var g=d;H(g)&&(g=!Ib(a,c));(g?kb:jb)(a,c)})},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;null!=a&&1!==a.nodeType;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName?
+a.getElementsByTagName(c):[]},clone:Hb,triggerHandler:function(a,c,d){c=(la(a,"events")||{})[c];d=d||[];var e=[{preventDefault:w,stopPropagation:w}];q(c,function(c){c.apply(a,e.concat(d))})}},function(a,c){M.prototype[c]=function(c,e,g){for(var f,h=0;h<this.length;h++)H(f)?(f=a(this[h],c,e,g),z(f)&&(f=y(f))):Gb(f,a(this[h],c,e,g));return z(f)?f:this};M.prototype.bind=M.prototype.on;M.prototype.unbind=M.prototype.off});Wa.prototype={put:function(a,c){this[Ha(a)]=c},get:function(a){return this[Ha(a)]},
+remove:function(a){var c=this[a=Ha(a)];delete this[a];return c}};var pe=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,qe=/,/,re=/^\s*(_?)(\S+?)\1\s*$/,oe=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Xa=u("$injector"),Le=u("$animate"),Ld=["$provide",function(a){this.$$selectors={};this.register=function(c,d){var e=c+"-animation";if(c&&"."!=c.charAt(0))throw Le("notcsel",c);this.$$selectors[c.substr(1)]=e;a.factory(e,d)};this.classNameFilter=function(a){1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?
+a:null);return this.$$classNameFilter};this.$get=["$timeout","$$asyncCallback",function(a,d){return{enter:function(a,c,f,h){f?f.after(a):(c&&c[0]||(c=f.parent()),c.append(a));h&&d(h)},leave:function(a,c){a.remove();c&&d(c)},move:function(a,c,d,h){this.enter(a,c,d,h)},addClass:function(a,c,f){c=C(c)?c:L(c)?c.join(" "):"";q(a,function(a){kb(a,c)});f&&d(f)},removeClass:function(a,c,f){c=C(c)?c:L(c)?c.join(" "):"";q(a,function(a){jb(a,c)});f&&d(f)},setClass:function(a,c,f,h){q(a,function(a){kb(a,c);jb(a,
+f)});h&&d(h)},enabled:w}}]}],ja=u("$compile");fc.$inject=["$provide","$$sanitizeUriProvider"];var te=/^(x[\:\-_]|data[\:\-_])/i,yc=u("$interpolate"),Me=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,we={http:80,https:443,ftp:21},Nb=u("$location");Pb.prototype=Ob.prototype=Bc.prototype={$$html5:!1,$$replace:!1,absUrl:qb("$$absUrl"),url:function(a,c){if(H(a))return this.$$url;var d=Me.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));(d[2]||d[1])&&this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:qb("$$protocol"),
+host:qb("$$host"),port:qb("$$port"),path:Cc("$$path",function(a){return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;case 1:if(C(a))this.$$search=bc(a);else if(X(a))this.$$search=a;else throw Nb("isrcharg");break;default:H(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:Cc("$$hash",Ea),replace:function(){this.$$replace=!0;return this}};var Ca=u("$parse"),Fc={},ta,La={"null":function(){return null},"true":function(){return!0},
+"false":function(){return!1},undefined:w,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return z(d)?z(e)?d+e:d:z(e)?e:s},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(z(d)?d:0)-(z(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":w,"===":function(a,c,d,e){return d(a,c)===e(a,c)},"!==":function(a,c,d,e){return d(a,c)!==e(a,c)},"==":function(a,c,d,e){return d(a,c)==e(a,
+c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Ne={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},
+Rb=function(a){this.options=a};Rb.prototype={constructor:Rb,lex:function(a){this.text=a;this.index=0;this.ch=s;this.lastCh=":";this.tokens=[];var c;for(a=[];this.index<this.text.length;){this.ch=this.text.charAt(this.index);if(this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent(),this.was("{,")&&("{"===a[0]&&(c=this.tokens[this.tokens.length-1]))&&(c.json=-1===c.text.indexOf("."));
+else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch,json:this.was(":[,")&&this.is("{[")||this.is("}]:,")}),this.is("{[")&&a.unshift(this.ch),this.is("}]")&&a.shift(),this.index++;else if(this.isWhitespace(this.ch)){this.index++;continue}else{var d=this.ch+this.peek(),e=d+this.peek(2),g=La[this.ch],f=La[d],h=La[e];h?(this.tokens.push({index:this.index,text:e,fn:h}),this.index+=3):f?(this.tokens.push({index:this.index,text:d,fn:f}),this.index+=2):g?(this.tokens.push({index:this.index,
+text:this.ch,fn:g,json:this.was("[,:")&&this.is("+-")}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}this.lastCh=this.ch}return this.tokens},is:function(a){return-1!==a.indexOf(this.ch)},was:function(a){return-1!==a.indexOf(this.lastCh)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===
+a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=z(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw Ca("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=J(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=
+d;else if(this.isExpOperator(d)&&e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}a*=1;this.tokens.push({index:c,text:a,json:!0,fn:function(){return a}})},readIdent:function(){for(var a=this,c="",d=this.index,e,g,f,h;this.index<this.text.length;){h=this.text.charAt(this.index);if("."===h||this.isIdent(h)||this.isNumber(h))"."===h&&(e=this.index),c+=h;else break;
+this.index++}if(e)for(g=this.index;g<this.text.length;){h=this.text.charAt(g);if("("===h){f=c.substr(e-d+1);c=c.substr(0,e-d);this.index=g;break}if(this.isWhitespace(h))g++;else break}d={index:d,text:c};if(La.hasOwnProperty(c))d.fn=La[c],d.json=La[c];else{var m=Ec(c,this.options,this.text);d.fn=E(function(a,c){return m(a,c)},{assign:function(d,e){return rb(d,c,e,a.text,a.options)}})}this.tokens.push(d);f&&(this.tokens.push({index:e,text:".",json:!1}),this.tokens.push({index:e+1,text:f,json:!1}))},
+readString:function(a){var c=this.index;this.index++;for(var d="",e=a,g=!1;this.index<this.text.length;){var f=this.text.charAt(this.index),e=e+f;if(g)"u"===f?(f=this.text.substring(this.index+1,this.index+5),f.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+=4,d+=String.fromCharCode(parseInt(f,16))):d=(g=Ne[f])?d+g:d+f,g=!1;else if("\\"===f)g=!0;else{if(f===a){this.index++;this.tokens.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});return}d+=
+f}this.index++}this.throwError("Unterminated quote",c)}};var ab=function(a,c,d){this.lexer=a;this.$filter=c;this.options=d};ab.ZERO=E(function(){return 0},{constant:!0});ab.prototype={constructor:ab,parse:function(a,c){this.text=a;this.json=c;this.tokens=this.lexer.lex(a);c&&(this.assignment=this.logicalOR,this.functionCall=this.fieldAccess=this.objectIndex=this.filterChain=function(){this.throwError("is not valid json",{text:a,index:0})});var d=c?this.primary():this.statements();0!==this.tokens.length&&
+this.throwError("is an unexpected token",this.tokens[0]);d.literal=!!d.literal;d.constant=!!d.constant;return d},primary:function(){var a;if(this.expect("("))a=this.filterChain(),this.consume(")");else if(this.expect("["))a=this.arrayDeclaration();else if(this.expect("{"))a=this.object();else{var c=this.expect();(a=c.fn)||this.throwError("not a primary expression",c);c.json&&(a.constant=!0,a.literal=!0)}for(var d;c=this.expect("(","[",".");)"("===c.text?(a=this.functionCall(a,d),d=null):"["===c.text?
+(d=a,a=this.objectIndex(a)):"."===c.text?(d=a,a=this.fieldAccess(a)):this.throwError("IMPOSSIBLE");return a},throwError:function(a,c){throw Ca("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},peekToken:function(){if(0===this.tokens.length)throw Ca("ueoe",this.text);return this.tokens[0]},peek:function(a,c,d,e){if(0<this.tokens.length){var g=this.tokens[0],f=g.text;if(f===a||f===c||f===d||f===e||!(a||c||d||e))return g}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,
+e))?(this.json&&!a.json&&this.throwError("is not valid json",a),this.tokens.shift(),a):!1},consume:function(a){this.expect(a)||this.throwError("is unexpected, expecting ["+a+"]",this.peek())},unaryFn:function(a,c){return E(function(d,e){return a(d,e,c)},{constant:c.constant})},ternaryFn:function(a,c,d){return E(function(e,g){return a(e,g)?c(e,g):d(e,g)},{constant:a.constant&&c.constant&&d.constant})},binaryFn:function(a,c,d){return E(function(e,g){return c(e,g,a,d)},{constant:a.constant&&d.constant})},
+statements:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.filterChain()),!this.expect(";"))return 1===a.length?a[0]:function(c,d){for(var e,g=0;g<a.length;g++){var f=a[g];f&&(e=f(c,d))}return e}},filterChain:function(){for(var a=this.expression(),c;;)if(c=this.expect("|"))a=this.binaryFn(a,c.fn,this.filter());else return a},filter:function(){for(var a=this.expect(),c=this.$filter(a.text),d=[];;)if(a=this.expect(":"))d.push(this.expression());else{var e=
+function(a,e,h){h=[h];for(var m=0;m<d.length;m++)h.push(d[m](a,e));return c.apply(a,h)};return function(){return e}}},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary(),c,d;return(d=this.expect("="))?(a.assign||this.throwError("implies assignment but ["+this.text.substring(0,d.index)+"] can not be assigned to",d),c=this.ternary(),function(d,g){return a.assign(d,c(d,g),g)}):a},ternary:function(){var a=this.logicalOR(),c,d;if(this.expect("?")){c=this.ternary();
+if(d=this.expect(":"))return this.ternaryFn(a,c,this.ternary());this.throwError("expected :",d)}else return a},logicalOR:function(){for(var a=this.logicalAND(),c;;)if(c=this.expect("||"))a=this.binaryFn(a,c.fn,this.logicalAND());else return a},logicalAND:function(){var a=this.equality(),c;if(c=this.expect("&&"))a=this.binaryFn(a,c.fn,this.logicalAND());return a},equality:function(){var a=this.relational(),c;if(c=this.expect("==","!=","===","!=="))a=this.binaryFn(a,c.fn,this.equality());return a},
+relational:function(){var a=this.additive(),c;if(c=this.expect("<",">","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(ab.ZERO,a.fn,
+this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=Ec(d,this.options,this.text);return E(function(c,d,h){return e(h||a(c,d))},{assign:function(e,f,h){return rb(a(e,h),d,f,c.text,c.options)}})},objectIndex:function(a){var c=this,d=this.expression();this.consume("]");return E(function(e,g){var f=a(e,g),h=d(e,g),m;if(!f)return s;(f=$a(f[h],c.text))&&(f.then&&c.options.unwrapPromises)&&(m=f,"$$v"in f||(m.$$v=s,m.then(function(a){m.$$v=
+a})),f=f.$$v);return f},{assign:function(e,g,f){var h=d(e,f);return $a(a(e,f),c.text)[h]=g}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(g,f){for(var h=[],m=c?c(g,f):g,k=0;k<d.length;k++)h.push(d[k](g,f));k=a(g,f,m)||w;$a(m,e.text);$a(k,e.text);h=k.apply?k.apply(m,h):k(h[0],h[1],h[2],h[3],h[4]);return $a(h,e.text)}},arrayDeclaration:function(){var a=[],c=!0;if("]"!==this.peekToken().text){do{if(this.peek("]"))break;
+var d=this.expression();a.push(d);d.constant||(c=!1)}while(this.expect(","))}this.consume("]");return E(function(c,d){for(var f=[],h=0;h<a.length;h++)f.push(a[h](c,d));return f},{literal:!0,constant:c})},object:function(){var a=[],c=!0;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;var d=this.expect(),d=d.string||d.text;this.consume(":");var e=this.expression();a.push({key:d,value:e});e.constant||(c=!1)}while(this.expect(","))}this.consume("}");return E(function(c,d){for(var e={},m=0;m<
+a.length;m++){var k=a[m];e[k.key]=k.value(c,d)}return e},{literal:!0,constant:c})}};var Qb={},ua=u("$sce"),ha={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},W=U.createElement("a"),Ic=sa(P.location.href,!0);jc.$inject=["$provide"];Jc.$inject=["$locale"];Lc.$inject=["$locale"];var Oc=".",Ie={yyyy:$("FullYear",4),yy:$("FullYear",2,0,!0),y:$("FullYear",1),MMMM:sb("Month"),MMM:sb("Month",!0),MM:$("Month",2,1),M:$("Month",1,1),dd:$("Date",2),d:$("Date",1),HH:$("Hours",2),H:$("Hours",
+1),hh:$("Hours",2,-12),h:$("Hours",1,-12),mm:$("Minutes",2),m:$("Minutes",1),ss:$("Seconds",2),s:$("Seconds",1),sss:$("Milliseconds",3),EEEE:sb("Day"),EEE:sb("Day",!0),a:function(a,c){return 12>a.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Sb(Math[0<a?"floor":"ceil"](a/60),2)+Sb(Math.abs(a%60),2))}},He=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,Ge=/^\-?\d+$/;Kc.$inject=["$locale"];var Ee=aa(J),Fe=aa(Fa);Mc.$inject=
+["$parse"];var cd=aa({restrict:"E",compile:function(a,c){8>=S&&(c.href||c.name||c.$set("href",""),a.append(U.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var g="[object SVGAnimatedString]"===wa.call(c.prop("href"))?"xlink:href":"href";c.on("click",function(a){c.attr(g)||a.preventDefault()})}}}),Cb={};q(mb,function(a,c){if("multiple"!=a){var d=na("ng-"+c);Cb[d]=function(){return{priority:100,link:function(a,g,f){a.$watch(f[d],function(a){f.$set(c,!!a)})}}}}});q(["src",
+"srcset","href"],function(a){var c=na("ng-"+a);Cb[c]=function(){return{priority:99,link:function(d,e,g){var f=a,h=a;"href"===a&&"[object SVGAnimatedString]"===wa.call(e.prop("href"))&&(h="xlinkHref",g.$attr[h]="xlink:href",f=null);g.$observe(c,function(a){a&&(g.$set(h,a),S&&f&&e.prop(f,g[h]))})}}}});var vb={$addControl:w,$removeControl:w,$setValidity:w,$setDirty:w,$setPristine:w};Pc.$inject=["$element","$attrs","$scope","$animate"];var Qc=function(a){return["$timeout",function(c){return{name:"form",
+restrict:a?"EAC":"E",controller:Pc,compile:function(){return{pre:function(a,e,g,f){if(!g.action){var h=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};pb(e[0],"submit",h);e.on("$destroy",function(){c(function(){Ua(e[0],"submit",h)},0,!1)})}var m=e.parent().controller("form"),k=g.name||g.ngForm;k&&rb(a,k,f,k);if(m)e.on("$destroy",function(){m.$removeControl(f);k&&rb(a,k,s,k);E(f,vb)})}}}}}]},dd=Qc(),qd=Qc(!0),Oe=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,
+Pe=/^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i,Qe=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Rc={text:xb,number:function(a,c,d,e,g,f){xb(a,c,d,e,g,f);e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||Qe.test(a))return e.$setValidity("number",!0),""===a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return s});Je(e,"number",c);e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=parseFloat(d.min);return pa(e,"min",e.$isEmpty(a)||a>=c,a)},e.$parsers.push(a),
+e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);return pa(e,"max",e.$isEmpty(a)||a<=c,a)},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){return pa(e,"number",e.$isEmpty(a)||yb(a),a)})},url:function(a,c,d,e,g,f){xb(a,c,d,e,g,f);a=function(a){return pa(e,"url",e.$isEmpty(a)||Oe.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,f){xb(a,c,d,e,g,f);a=function(a){return pa(e,"email",e.$isEmpty(a)||Pe.test(a),a)};e.$formatters.push(a);
+e.$parsers.push(a)},radio:function(a,c,d,e){H(d.name)&&c.attr("name",cb());c.on("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,f=d.ngFalseValue;C(g)||(g=!0);C(f)||(f=!1);c.on("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==g};
+e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:f})},hidden:w,button:w,submit:w,reset:w,file:w},gc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,f){f&&(Rc[J(g.type)]||Rc.text)(d,e,g,f,c,a)}}}],ub="ng-valid",tb="ng-invalid",Ka="ng-pristine",wb="ng-dirty",Re=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate",function(a,c,d,e,g,f){function h(a,c){c=c?"-"+hb(c,"-"):"";f.removeClass(e,(a?tb:ub)+c);
+f.addClass(e,(a?ub:tb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var m=g(d.ngModel),k=m.assign;if(!k)throw u("ngModel")("nonassign",d.ngModel,ia(e));this.$render=w;this.$isEmpty=function(a){return H(a)||""===a||null===a||a!==a};var l=e.inheritedData("$formController")||vb,n=0,p=this.$error={};e.addClass(Ka);h(!0);this.$setValidity=function(a,c){p[a]!==
+!c&&(c?(p[a]&&n--,n||(h(!0),this.$valid=!0,this.$invalid=!1)):(h(!1),this.$invalid=!0,this.$valid=!1,n++),p[a]=!c,h(c,a),l.$setValidity(a,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=!0;f.removeClass(e,wb);f.addClass(e,Ka)};this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&(this.$dirty=!0,this.$pristine=!1,f.removeClass(e,Ka),f.addClass(e,wb),l.$setDirty());q(this.$parsers,function(a){d=a(d)});this.$modelValue!==d&&(this.$modelValue=d,k(a,d),q(this.$viewChangeListeners,
+function(a){try{a()}catch(d){c(d)}}))};var r=this;a.$watch(function(){var c=m(a);if(r.$modelValue!==c){var d=r.$formatters,e=d.length;for(r.$modelValue=c;e--;)c=d[e](c);r.$viewValue!==c&&(r.$viewValue=c,r.$render())}return c})}],Fd=function(){return{require:["ngModel","^?form"],controller:Re,link:function(a,c,d,e){var g=e[0],f=e[1]||vb;f.$addControl(g);a.$on("$destroy",function(){f.$removeControl(g)})}}},Hd=aa({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),
+hc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},Gd=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!H(a)){var c=[];a&&q(a.split(g),function(a){a&&
+c.push(ba(a))});return c}});e.$formatters.push(function(a){return L(a)?a.join(", "):s});e.$isEmpty=function(a){return!a||!a.length}}}},Se=/^(true|false|\d+)$/,Id=function(){return{priority:100,compile:function(a,c){return Se.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a)})}}}},id=va(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==s?"":a)})}),kd=["$interpolate",
+function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],jd=["$sce","$parse",function(a,c){return function(d,e,g){e.addClass("ng-binding").data("$binding",g.ngBindHtml);var f=c(g.ngBindHtml);d.$watch(function(){return(f(d)||"").toString()},function(c){e.html(a.getTrustedHtml(f(d))||"")})}}],ld=Tb("",!0),nd=Tb("Odd",0),md=Tb("Even",1),od=va({compile:function(a,c){c.$set("ngCloak",s);a.removeClass("ng-cloak")}}),
+pd=[function(){return{scope:!0,controller:"@",priority:500}}],ic={};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var c=na("ng-"+a);ic[c]=["$parse",function(d){return{compile:function(e,g){var f=d(g[c]);return function(c,d,e){d.on(J(a),function(a){c.$apply(function(){f(c,{$event:a})})})}}}}]});var sd=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",
+$$tlb:!0,link:function(c,d,e,g,f){var h,m,k;c.$watch(e.ngIf,function(g){Pa(g)?m||(m=c.$new(),f(m,function(c){c[c.length++]=U.createComment(" end ngIf: "+e.ngIf+" ");h={clone:c};a.enter(c,d.parent(),d)})):(k&&(k.remove(),k=null),m&&(m.$destroy(),m=null),h&&(k=Bb(h.clone),a.leave(k,function(){k=null}),h=null))})}}}],td=["$http","$templateCache","$anchorScroll","$animate","$sce",function(a,c,d,e,g){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Qa.noop,compile:function(f,
+h){var m=h.ngInclude||h.src,k=h.onload||"",l=h.autoscroll;return function(f,h,q,s,D){var x=0,t,y,B,v=function(){y&&(y.remove(),y=null);t&&(t.$destroy(),t=null);B&&(e.leave(B,function(){y=null}),y=B,B=null)};f.$watch(g.parseAsResourceUrl(m),function(g){var m=function(){!z(l)||l&&!f.$eval(l)||d()},q=++x;g?(a.get(g,{cache:c}).success(function(a){if(q===x){var c=f.$new();s.template=a;a=D(c,function(a){v();e.enter(a,null,h,m)});t=c;B=a;t.$emit("$includeContentLoaded");f.$eval(k)}}).error(function(){q===
+x&&v()}),f.$emit("$includeContentRequested")):(v(),s.template=null)})}}}}],Jd=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,g){d.html(g.template);a(d.contents())(c)}}}],ud=va({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),vd=va({terminal:!0,priority:1E3}),wd=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,f){var h=f.count,m=f.$attr.when&&g.attr(f.$attr.when),k=f.offset||
+0,l=e.$eval(m)||{},n={},p=c.startSymbol(),r=c.endSymbol(),s=/^when(Minus)?(.+)$/;q(f,function(a,c){s.test(c)&&(l[J(c.replace("when","").replace("Minus","-"))]=g.attr(f.$attr[c]))});q(l,function(a,e){n[e]=c(a.replace(d,p+h+"-"+k+r))});e.$watch(function(){var c=parseFloat(e.$eval(h));if(isNaN(c))return"";c in l||(c=a.pluralCat(c-k));return n[c](e,g,!0)},function(a){g.text(a)})}}}],xd=["$parse","$animate",function(a,c){var d=u("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,
+link:function(e,g,f,h,m){var k=f.ngRepeat,l=k.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),n,p,r,s,D,x,t={$id:Ha};if(!l)throw d("iexp",k);f=l[1];h=l[2];(l=l[3])?(n=a(l),p=function(a,c,d){x&&(t[x]=a);t[D]=c;t.$index=d;return n(e,t)}):(r=function(a,c){return Ha(c)},s=function(a){return a});l=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp",f);D=l[3]||l[1];x=l[2];var z={};e.$watchCollection(h,function(a){var f,h,l=g[0],n,t={},F,R,C,w,T,u,
+E=[];if(bb(a))T=a,n=p||r;else{n=p||s;T=[];for(C in a)a.hasOwnProperty(C)&&"$"!=C.charAt(0)&&T.push(C);T.sort()}F=T.length;h=E.length=T.length;for(f=0;f<h;f++)if(C=a===T?f:T[f],w=a[C],w=n(C,w,f),Aa(w,"`track by` id"),z.hasOwnProperty(w))u=z[w],delete z[w],t[w]=u,E[f]=u;else{if(t.hasOwnProperty(w))throw q(E,function(a){a&&a.scope&&(z[a.id]=a)}),d("dupes",k,w);E[f]={id:w};t[w]=!1}for(C in z)z.hasOwnProperty(C)&&(u=z[C],f=Bb(u.clone),c.leave(f),q(f,function(a){a.$$NG_REMOVED=!0}),u.scope.$destroy());
+f=0;for(h=T.length;f<h;f++){C=a===T?f:T[f];w=a[C];u=E[f];E[f-1]&&(l=E[f-1].clone[E[f-1].clone.length-1]);if(u.scope){R=u.scope;n=l;do n=n.nextSibling;while(n&&n.$$NG_REMOVED);u.clone[0]!=n&&c.move(Bb(u.clone),null,y(l));l=u.clone[u.clone.length-1]}else R=e.$new();R[D]=w;x&&(R[x]=C);R.$index=f;R.$first=0===f;R.$last=f===F-1;R.$middle=!(R.$first||R.$last);R.$odd=!(R.$even=0===(f&1));u.scope||m(R,function(a){a[a.length++]=U.createComment(" end ngRepeat: "+k+" ");c.enter(a,null,y(l));l=a;u.scope=R;u.clone=
+a;t[u.id]=u})}z=t})}}}],yd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngShow,function(c){a[Pa(c)?"removeClass":"addClass"](d,"ng-hide")})}}],rd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngHide,function(c){a[Pa(c)?"addClass":"removeClass"](d,"ng-hide")})}}],zd=va(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&q(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Ad=["$animate",function(a){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases=
+{}}],link:function(c,d,e,g){var f=[],h=[],m=[],k=[];c.$watch(e.ngSwitch||e.on,function(d){var n,p;n=0;for(p=m.length;n<p;++n)m[n].remove();n=m.length=0;for(p=k.length;n<p;++n){var r=h[n];k[n].$destroy();m[n]=r;a.leave(r,function(){m.splice(n,1)})}h.length=0;k.length=0;if(f=g.cases["!"+d]||g.cases["?"])c.$eval(e.change),q(f,function(d){var e=c.$new();k.push(e);d.transclude(e,function(c){var e=d.element;h.push(c);a.enter(c,e.parent(),e)})})})}}}],Bd=va({transclude:"element",priority:800,require:"^ngSwitch",
+link:function(a,c,d,e,g){e.cases["!"+d.ngSwitchWhen]=e.cases["!"+d.ngSwitchWhen]||[];e.cases["!"+d.ngSwitchWhen].push({transclude:g,element:c})}}),Cd=va({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,g){e.cases["?"]=e.cases["?"]||[];e.cases["?"].push({transclude:g,element:c})}}),Ed=va({link:function(a,c,d,e,g){if(!g)throw u("ngTransclude")("orphan",ia(c));g(function(a){c.empty();c.append(a)})}}),ed=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,
+d){"text/ng-template"==d.type&&a.put(d.id,c[0].text)}}}],Te=u("ngOptions"),Dd=aa({terminal:!0}),fd=["$compile","$parse",function(a,c){var d=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,e={$setViewValue:w};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var m=this,k={},l=e,n;m.databound=
+d.ngModel;m.init=function(a,c,d){l=a;n=d};m.addOption=function(c){Aa(c,'"option value"');k[c]=!0;l.$viewValue==c&&(a.val(c),n.parent()&&n.remove())};m.removeOption=function(a){this.hasOption(a)&&(delete k[a],l.$viewValue==a&&this.renderUnknownOption(a))};m.renderUnknownOption=function(c){c="? "+Ha(c)+" ?";n.val(c);a.prepend(n);a.val(c);n.prop("selected",!0)};m.hasOption=function(a){return k.hasOwnProperty(a)};c.$on("$destroy",function(){m.renderUnknownOption=w})}],link:function(e,f,h,m){function k(a,
+c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(w.parent()&&w.remove(),c.val(a),""===a&&x.prop("selected",!0)):H(a)&&x?c.val(""):e.renderUnknownOption(a)};c.on("change",function(){a.$apply(function(){w.parent()&&w.remove();d.$setViewValue(c.val())})})}function l(a,c,d){var e;d.$render=function(){var a=new Wa(d.$viewValue);q(c.find("option"),function(c){c.selected=z(a.get(c.value))})};a.$watch(function(){xa(e,d.$viewValue)||(e=ca(d.$viewValue),d.$render())});c.on("change",function(){a.$apply(function(){var a=
+[];q(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function n(e,f,g){function h(){var a={"":[]},c=[""],d,k,s,u,v;u=g.$modelValue;v=y(e)||[];var A=n?Ub(v):v,E,I,B;I={};s=!1;var F,H;if(r)if(w&&L(u))for(s=new Wa([]),B=0;B<u.length;B++)I[m]=u[B],s.put(w(e,I),u[B]);else s=new Wa(u);for(B=0;E=A.length,B<E;B++){k=B;if(n){k=A[B];if("$"===k.charAt(0))continue;I[n]=k}I[m]=v[k];d=p(e,I)||"";(k=a[d])||(k=a[d]=[],c.push(d));r?d=z(s.remove(w?w(e,I):q(e,I))):(w?(d={},d[m]=u,d=
+w(e,d)===w(e,I)):d=u===q(e,I),s=s||d);F=l(e,I);F=z(F)?F:"";k.push({id:w?w(e,I):n?A[B]:B,label:F,selected:d})}r||(D||null===u?a[""].unshift({id:"",label:"",selected:!s}):s||a[""].unshift({id:"?",label:"",selected:!0}));I=0;for(A=c.length;I<A;I++){d=c[I];k=a[d];x.length<=I?(u={element:C.clone().attr("label",d),label:k.label},v=[u],x.push(v),f.append(u.element)):(v=x[I],u=v[0],u.label!=d&&u.element.attr("label",u.label=d));F=null;B=0;for(E=k.length;B<E;B++)s=k[B],(d=v[B+1])?(F=d.element,d.label!==s.label&&
+F.text(d.label=s.label),d.id!==s.id&&F.val(d.id=s.id),d.selected!==s.selected&&F.prop("selected",d.selected=s.selected)):(""===s.id&&D?H=D:(H=t.clone()).val(s.id).attr("selected",s.selected).text(s.label),v.push({element:H,label:s.label,id:s.id,selected:s.selected}),F?F.after(H):u.element.append(H),F=H);for(B++;v.length>B;)v.pop().element.remove()}for(;x.length>I;)x.pop()[0].element.remove()}var k;if(!(k=u.match(d)))throw Te("iexp",u,ia(f));var l=c(k[2]||k[1]),m=k[4]||k[6],n=k[5],p=c(k[3]||""),q=
+c(k[2]?k[1]:m),y=c(k[7]),w=k[8]?c(k[8]):null,x=[[{element:f,label:""}]];D&&(a(D)(e),D.removeClass("ng-scope"),D.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=y(e)||[],d={},h,k,l,p,t,u,v;if(r)for(k=[],p=0,u=x.length;p<u;p++)for(a=x[p],l=1,t=a.length;l<t;l++){if((h=a[l].element)[0].selected){h=h.val();n&&(d[n]=h);if(w)for(v=0;v<c.length&&(d[m]=c[v],w(e,d)!=h);v++);else d[m]=c[h];k.push(q(e,d))}}else{h=f.val();if("?"==h)k=s;else if(""===h)k=null;else if(w)for(v=0;v<c.length;v++){if(d[m]=
+c[v],w(e,d)==h){k=q(e,d);break}}else d[m]=c[h],n&&(d[n]=h),k=q(e,d);1<x[0].length&&x[0][1].id!==h&&(x[0][1].selected=!1)}g.$setViewValue(k)})});g.$render=h;e.$watch(h)}if(m[1]){var p=m[0];m=m[1];var r=h.multiple,u=h.ngOptions,D=!1,x,t=y(U.createElement("option")),C=y(U.createElement("optgroup")),w=t.clone();h=0;for(var v=f.children(),E=v.length;h<E;h++)if(""===v[h].value){x=D=v.eq(h);break}p.init(m,D,w);r&&(m.$isEmpty=function(a){return!a||0===a.length});u?n(e,f,m):r?l(e,f,m):k(e,f,m,p)}}}}],hd=["$interpolate",
+function(a){var c={addOption:w,removeOption:w};return{restrict:"E",priority:100,compile:function(d,e){if(H(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var k=d.parent(),l=k.data("$selectController")||k.parent().data("$selectController");l&&l.databound?d.prop("selected",!1):l=c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&l.removeOption(c);l.addOption(a)}):l.addOption(e.value);d.on("$destroy",function(){l.removeOption(e.value)})}}}}],gd=aa({restrict:"E",
+terminal:!0});P.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):((Ba=P.jQuery)&&Ba.fn.on?(y=Ba,E(Ba.fn,{scope:Ia.scope,isolateScope:Ia.isolateScope,controller:Ia.controller,injector:Ia.injector,inheritedData:Ia.inheritedData}),Db("remove",!0,!0,!1),Db("empty",!1,!1,!1),Db("html",!1,!1,!0)):y=M,Qa.element=y,Zc(Qa),y(U).ready(function(){Wc(U,cc)}))})(window,document);!window.angular.$$csp()&&window.angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}</style>');
+//# sourceMappingURL=angular.min.js.map
diff --git a/setup/pub/angular/angular.min.js.map b/setup/pub/angular/angular.min.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..1f7eb768415b8823710d66c3d5f6a20f04e2ee64
--- /dev/null
+++ b/setup/pub/angular/angular.min.js.map
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"angular.min.js",
+"lineCount":196,
+"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAmBC,CAAnB,CAA8B,CCLvCC,QAAS,EAAM,CAAC,CAAD,CAAS,CAWtB,MAAO,SAAS,EAAG,CAAA,IACb,EAAO,SAAA,CAAU,CAAV,CADM,CAIf,CAJe,CAKjB,EAHW,GAGX,EAHkB,CAAA,CAAS,CAAT,CAAkB,GAAlB,CAAwB,EAG1C,EAHgD,CAGhD,CAAmB,0CAAnB,EAA+D,CAAA,CAAS,CAAT,CAAkB,GAAlB,CAAwB,EAAvF,EAA6F,CAC7F,KAAK,CAAL,CAAS,CAAT,CAAY,CAAZ,CAAgB,SAAA,OAAhB,CAAkC,CAAA,EAAlC,CACE,CAAA,CAAU,CAAV,EAA0B,CAAL,EAAA,CAAA,CAAS,GAAT,CAAe,GAApC,EAA2C,GAA3C,EAAkD,CAAlD,CAAoD,CAApD,EAAyD,GAAzD,CACE,kBAAA,CAjBc,UAAlB,EAAI,MAiB6B,UAAA,CAAU,CAAV,CAjBjC,CAiBiC,SAAA,CAAU,CAAV,CAhBxB,SAAA,EAAA,QAAA,CAAuB,aAAvB,CAAsC,EAAtC,CADT,CAEyB,WAAlB,EAAI,MAesB,UAAA,CAAU,CAAV,CAf1B,CACE,WADF,CAEoB,QAApB,EAAM,MAaoB,UAAA,CAAU,CAAV,CAb1B,CACE,IAAA,UAAA,CAYwB,SAAA,CAAU,CAAV,CAZxB,CADF,CAa0B,SAAA,CAAU,CAAV,CAA7B,CAEJ,OAAW,MAAJ,CAAU,CAAV,CAVU,CAXG,CDgKxBC,QAASA,GAAW,CAACC,CAAD,CAAM,CACxB,GAAW,IAAX,EAAIA,CAAJ,EAAmBC,EAAA,CAASD,CAAT,CAAnB,CACE,MA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H,EAbK,MAcVsB,EAdU,QAeR0C,EAfQ,YAgBJkC,EAhBI,IAiBZtB,EAjBY,MAkBVqH,EAlBU,cAmBFxB,EAnBE,UAoBNsC,EApBM,gBAqBAhoB,EArBA,UAsBNkpB,EAtBM,SAuBPQ,EAvBO,CAAlB,CA5C0B,CADI,CAAlC,CArCkC,CAApCqkB,CAkniBE,CAAmB7gD,EAAnB,CAEAnD,EAAA,CAAOlH,CAAP,CAAAmxC,MAAA,CAAuB,QAAQ,EAAG,CAChC3oC,EAAA,CAAYxI,CAAZ,CAAsByI,EAAtB,CADgC,CAAlC,CA1rlBqC,CAAtC,CAAA,CA8rlBE1I,MA9rlBF,CA8rlBUC,QA9rlBV,CA+rlBDqK,QAAApD,QAAA,CAAgBjH,QAAhB,CAAAkE,KAAA,CAA+B,MAA/B,CAAA6uC,QAAA,CAA+C,wLAA/C;",
+"sources":["angular.js","MINERR_ASSET"],
+"names":["window","document","undefined","minErr","isArrayLike","obj","isWindow","length","nodeType","isString","isArray","forEach","iterator","context","key","isFunction","hasOwnProperty","call","sortedKeys","keys","push","sort","forEachSorted","i","reverseParams","iteratorFn","value","nextUid","index","uid","digit","charCodeAt","join","String","fromCharCode","unshift","setHashKey","h","$$hashKey","extend","dst","arguments","int","str","parseInt","inherit","parent","extra","noop","identity","$","valueFn","isUndefined","isDefined","isObject","isNumber","isDate","toString","apply","isRegExp","location","alert","setInterval","isElement","node","nodeName","on","find","map","results","list","indexOf","array","arrayRemove","splice","copy","source","destination","$evalAsync","$watch","ngMinErr","Date","getTime","RegExp","shallowCopy","src","substr","equals","o1","o2","t1","t2","keySet","charAt","bind","self","fn","curryArgs","slice","startIndex","concat","toJsonReplacer","val","toJson","pretty","JSON","stringify","fromJson","json","parse","toBoolean","v","lowercase","startingTag","element","jqLite","clone","html","e","elemHtml","append","TEXT_NODE","match","replace","tryDecodeURIComponent","decodeURIComponent","parseKeyValue","keyValue","key_value","split","toKeyValue","parts","arrayValue","encodeUriQuery","encodeUriSegment","pctEncodeSpaces","encodeURIComponent","angularInit","bootstrap","elements","appElement","module","names","NG_APP_CLASS_REGEXP","name","getElementById","querySelectorAll","exec","className","attributes","attr","modules","doBootstrap","injector","tag","$provide","createInjector","invoke","scope","compile","animate","$apply","data","enabled","NG_DEFER_BOOTSTRAP","test","angular","resumeBootstrap","angular.resumeBootstrap","extraModules","snake_case","separator","SNAKE_CASE_REGEXP","letter","pos","toLowerCase","assertArg","arg","reason","assertArgFn","acceptArrayAnnotation","constructor","assertNotHasOwnProperty","getter","path","bindFnToScope","lastInstance","len","setupModuleLoader","ensure","factory","$injectorMinErr","Object","requires","configFn","invokeLater","provider","method","insertMethod","invokeQueue","moduleInstance","runBlocks","config","run","block","camelCase","SPECIAL_CHARS_REGEXP","_","offset","toUpperCase","MOZ_HACK_REGEXP","JQLitePatchJQueryRemove","dispatchThis","filterElems","getterIfNoArguments","removePatch","param","filter","fireEvent","set","setIndex","setLength","childIndex","children","shift","triggerHandler","childLength","jQuery","originalJqFn","$original","JQLite","jqLiteMinErr","div","createElement","innerHTML","removeChild","firstChild","JQLiteAddNodes","childNodes","fragment","createDocumentFragment","JQLiteClone","cloneNode","JQLiteDealoc","JQLiteRemoveData","JQLiteOff","type","unsupported","events","JQLiteExpandoStore","handle","eventHandler","removeEventListenerFn","expandoId","jqName","expandoStore","jqCache","$destroy","jqId","JQLiteData","isSetter","keyDefined","isSimpleGetter","JQLiteHasClass","selector","getAttribute","JQLiteRemoveClass","cssClasses","setAttribute","cssClass","trim","JQLiteAddClass","existingClasses","root","JQLiteController","JQLiteInheritedData","getBooleanAttrName","booleanAttr","BOOLEAN_ATTR","BOOLEAN_ELEMENTS","createEventHandler","event","preventDefault","event.preventDefault","returnValue","stopPropagation","event.stopPropagation","cancelBubble","target","srcElement","defaultPrevented","prevent","isDefaultPrevented","event.isDefaultPrevented","msie","elem","hashKey","objType","HashMap","put","annotate","$inject","fnText","STRIP_COMMENTS","argDecl","FN_ARGS","FN_ARG_SPLIT","FN_ARG","all","underscore","last","modulesToLoad","supportObject","delegate","provider_","providerInjector","instantiate","$get","providerCache","providerSuffix","factoryFn","loadModules","loadedModules","get","moduleFn","angularModule","_runBlocks","_invokeQueue","ii","invokeArgs","message","stack","createInternalInjector","cache","getService","serviceName","INSTANTIATING","locals","args","Type","Constructor","returnedValue","prototype","instance","has","service","$injector","constant","instanceCache","decorator","decorFn","origProvider","orig$get","origProvider.$get","origInstance","instanceInjector","servicename","$AnchorScrollProvider","autoScrollingEnabled","disableAutoScrolling","this.disableAutoScrolling","$window","$location","$rootScope","getFirstAnchor","result","scroll","hash","elm","scrollIntoView","getElementsByName","scrollTo","autoScrollWatch","autoScrollWatchAction","Browser","$log","$sniffer","completeOutstandingRequest","outstandingRequestCount","outstandingRequestCallbacks","pop","error","startPoller","interval","setTimeout","check","pollFns","pollFn","pollTimeout","fireUrlChange","newLocation","lastBrowserUrl","url","urlChangeListeners","listener","rawDocument","history","clearTimeout","pendingDeferIds","isMock","$$completeOutstandingRequest","$$incOutstandingRequestCount","self.$$incOutstandingRequestCount","notifyWhenNoOutstandingRequests","self.notifyWhenNoOutstandingRequests","callback","addPollFn","self.addPollFn","href","baseElement","self.url","replaceState","pushState","urlChangeInit","onUrlChange","self.onUrlChange","hashchange","baseHref","self.baseHref","lastCookies","lastCookieString","cookiePath","cookies","self.cookies","cookieLength","cookie","escape","warn","cookieArray","unescape","substring","defer","self.defer","delay","timeoutId","cancel","self.defer.cancel","deferId","$BrowserProvider","$document","$CacheFactoryProvider","this.$get","cacheFactory","cacheId","options","refresh","entry","freshEnd","staleEnd","n","link","p","nextEntry","prevEntry","caches","size","stats","capacity","Number","MAX_VALUE","lruHash","lruEntry","remove","removeAll","destroy","info","cacheFactory.info","cacheFactory.get","$TemplateCacheProvider","$cacheFactory","$CompileProvider","hasDirectives","Suffix","COMMENT_DIRECTIVE_REGEXP","CLASS_DIRECTIVE_REGEXP","aHrefSanitizationWhitelist","imgSrcSanitizationWhitelist","EVENT_HANDLER_ATTR_REGEXP","directive","this.directive","registerDirective","directiveFactory","$exceptionHandler","directives","priority","require","controller","restrict","this.aHrefSanitizationWhitelist","regexp","this.imgSrcSanitizationWhitelist","$interpolate","$http","$templateCache","$parse","$controller","$sce","$animate","$compileNodes","transcludeFn","maxPriority","ignoreDirective","previousCompileContext","nodeValue","wrap","compositeLinkFn","compileNodes","publicLinkFn","cloneConnectFn","$linkNode","JQLitePrototype","eq","safeAddClass","$element","addClass","nodeList","$rootElement","boundTranscludeFn","childLinkFn","childScope","childTranscludeFn","stableNodeList","linkFns","nodeLinkFn","$new","transclude","cloneFn","transcludeScope","$$transcluded","attrs","linkFnFound","Attributes","collectDirectives","applyDirectivesToNode","terminal","attrsMap","$attr","addDirective","directiveNormalize","nodeName_","nName","nAttrs","j","jj","attrStartName","attrEndName","specified","ngAttrName","NG_ATTR_BINDING","directiveNName","addAttrInterpolateDirective","addTextInterpolateDirective","byPriority","groupScan","attrStart","attrEnd","nodes","depth","hasAttribute","$compileMinErr","nextSibling","groupElementsLinkFnWrapper","linkFn","controllers","compileNode","templateAttrs","jqCollection","originalReplaceDirective","preLinkFns","postLinkFns","addLinkFns","pre","post","getControllers","retrievalMethod","optional","$$controller","directiveName","linkNode","$$element","newIsolateScopeDirective","LOCAL_REGEXP","parentScope","$parent","definition","scopeName","attrName","mode","lastValue","parentGet","parentSet","$$isolateBindings","$observe","$$observers","$$scope","assign","parentValueWatch","parentValue","controllerDirectives","controllerInstance","controllerAs","$scope","terminalPriority","newScopeDirective","templateDirective","$compileNode","$template","transcludeDirective","$$start","$$end","directiveValue","templateUrl","assertNoDuplicate","createComment","replaceWith","replaceDirective","contents","template","denormalizeTemplate","newTemplateAttrs","mergeTemplateAttributes","compileTemplateUrl","Math","max","tDirectives","startAttrName","endAttrName","srcAttr","dstAttr","$set","tAttrs","linkQueue","afterTemplateNodeLinkFn","afterTemplateChildLinkFn","beforeTemplateCompileNode","origAsyncDirective","derivedSyncDirective","getTrustedResourceUrl","success","content","tempTemplateAttrs","beforeTemplateLinkNode","linkRootElement","response","code","headers","delayedNodeLinkFn","ignoreChildLinkFn","rootElement","a","b","diff","what","previousDirective","text","interpolateFn","textInterpolateLinkFn","bindings","interpolateFnWatchAction","getTrustedContext","attrNormalizedName","RESOURCE_URL","attrInterpolateLinkFn","$$inter","elementsToRemove","newNode","firstElementToRemove","removeCount","parentNode","j2","replaceChild","appendChild","expando","k","kk","$addClass","classVal","$removeClass","removeClass","writeAttr","tokenDifference","str1","str2","values","tokens1","tokens2","token","current","booleanKey","prop","normalizedVal","urlResolve","removeAttr","listeners","startSymbol","endSymbol","PREFIX_REGEXP","$ControllerProvider","CNTRL_REG","register","this.register","expression","identifier","$DocumentProvider","$ExceptionHandlerProvider","exception","cause","parseHeaders","parsed","line","headersGetter","headersObj","transformData","fns","$HttpProvider","JSON_START","JSON_END","PROTECTION_PREFIX","CONTENT_TYPE_APPLICATION_JSON","defaults","d","interceptorFactories","interceptors","responseInterceptorFactories","responseInterceptors","$httpBackend","$browser","$q","requestConfig","transformResponse","resp","status","reject","transformRequest","mergeHeaders","execHeaders","headerContent","headerFn","header","defHeaders","reqHeaders","defHeaderName","reqHeaderName","common","lowercaseDefHeaderName","uppercase","xsrfValue","urlIsSameOrigin","xsrfCookieName","xsrfHeaderName","chain","serverRequest","reqData","withCredentials","sendReq","then","promise","when","reversedInterceptors","interceptor","request","requestError","responseError","thenFn","rejectFn","promise.success","promise.error","done","headersString","resolvePromise","$$phase","deferred","resolve","removePendingReq","idx","pendingRequests","cachedResp","buildUrl","params","defaultCache","timeout","responseType","interceptorFactory","responseFn","createShortMethods","createShortMethodsWithData","$HttpBackendProvider","createHttpBackend","XHR","callbacks","protocol","$browserDefer","locationProtocol","jsonpReq","script","doneWrapper","body","onreadystatechange","script.onreadystatechange","readyState","onload","onerror","timeoutRequest","jsonpDone","xhr","abort","completeRequest","callbackId","counter","open","setRequestHeader","xhr.onreadystatechange","responseHeaders","getAllResponseHeaders","responseText","send","$InterpolateProvider","this.startSymbol","this.endSymbol","mustHaveExpression","trustedContext","endIndex","hasInterpolation","startSymbolLength","exp","endSymbolLength","$interpolateMinErr","part","getTrusted","valueOf","err","newErr","$interpolate.startSymbol","$interpolate.endSymbol","$IntervalProvider","count","invokeApply","clearInterval","iteration","skipApply","$$intervalId","tick","notify","intervals","interval.cancel","$LocaleProvider","short","pluralCat","num","encodePath","segments","parseAbsoluteUrl","absoluteUrl","locationObj","parsedUrl","$$protocol","$$host","hostname","$$port","port","DEFAULT_PORTS","parseAppUrl","relativeUrl","prefixed","$$path","pathname","$$search","search","$$hash","beginsWith","begin","whole","stripHash","stripFile","lastIndexOf","LocationHtml5Url","appBase","basePrefix","$$html5","appBaseNoFile","$$parse","this.$$parse","pathUrl","$locationMinErr","$$compose","this.$$compose","$$url","$$absUrl","$$rewrite","this.$$rewrite","appUrl","prevAppUrl","LocationHashbangUrl","hashPrefix","withoutBaseUrl","withoutHashUrl","LocationHashbangInHtml5Url","locationGetter","property","locationGetterSetter","preprocess","$LocationProvider","html5Mode","this.hashPrefix","prefix","this.html5Mode","afterLocationChange","oldUrl","$broadcast","absUrl","initialUrl","LocationMode","ctrlKey","metaKey","which","absHref","rewrittenUrl","newUrl","$digest","changeCounter","$locationWatch","currentReplace","$$replace","$LogProvider","debug","debugEnabled","this.debugEnabled","flag","formatError","Error","sourceURL","consoleLog","console","logFn","log","arg1","arg2","ensureSafeMemberName","fullExpression","$parseMinErr","ensureSafeObject","setter","setValue","fullExp","propertyObj","unwrapPromises","promiseWarning","$$v","cspSafeGetterFn","key0","key1","key2","key3","key4","cspSafePromiseEnabledGetter","pathVal","cspSafeGetter","getterFn","getterFnCache","pathKeys","pathKeysLength","csp","evaledFnGetter","Function","evaledFnGetter.toString","$ParseProvider","$parseOptions","this.unwrapPromises","logPromiseWarnings","this.logPromiseWarnings","$filter","promiseWarningCache","parsedExpression","lexer","Lexer","parser","Parser","$QProvider","qFactory","nextTick","exceptionHandler","defaultCallback","defaultErrback","pending","ref","progress","errback","progressback","wrappedCallback","wrappedErrback","wrappedProgressback","catch","finally","makePromise","resolved","handleCallback","isResolved","callbackOutput","promises","$RootScopeProvider","TTL","$rootScopeMinErr","digestTtl","this.digestTtl","Scope","$id","$$watchers","$$nextSibling","$$prevSibling","$$childHead","$$childTail","$root","$$destroyed","$$asyncQueue","$$postDigestQueue","$$listeners","beginPhase","phase","compileToFn","initWatchVal","isolate","child","Child","watchExp","objectEquality","watcher","listenFn","watcher.fn","newVal","oldVal","originalFn","$watchCollection","oldValue","newValue","changeDetected","objGetter","internalArray","internalObject","oldLength","$watchCollectionWatch","newLength","$watchCollectionAction","watch","watchers","asyncQueue","postDigestQueue","dirty","ttl","watchLog","logIdx","logMsg","asyncTask","$eval","isNaN","next","expr","$$postDigest","$on","namedListeners","$emit","empty","listenerArgs","array1","currentScope","adjustMatcher","matcher","$sceMinErr","adjustMatchers","matchers","adjustedMatchers","$SceDelegateProvider","SCE_CONTEXTS","resourceUrlWhitelist","resourceUrlBlacklist","this.resourceUrlWhitelist","this.resourceUrlBlacklist","generateHolderType","base","holderType","trustedValue","$$unwrapTrustedValue","this.$$unwrapTrustedValue","holderType.prototype.valueOf","holderType.prototype.toString","htmlSanitizer","trustedValueHolderBase","byType","HTML","CSS","URL","JS","trustAs","maybeTrusted","allowed","$SceProvider","this.enabled","$sceDelegate","documentMode","sce","isEnabled","sce.isEnabled","sce.getTrusted","parseAs","sce.parseAs","literal","sceParseAsTrusted","enumValue","lName","$SnifferProvider","eventSupport","android","userAgent","navigator","boxee","vendorPrefix","vendorRegex","bodyStyle","style","transitions","animations","webkitTransition","webkitAnimation","hasEvent","divElm","securityPolicy","isActive","$TimeoutProvider","deferreds","$$timeoutId","timeout.cancel","urlParsingNode","host","requestUrl","originUrl","$WindowProvider","$FilterProvider","filters","suffix","currencyFilter","dateFilter","filterFilter","jsonFilter","limitToFilter","lowercaseFilter","numberFilter","orderByFilter","uppercaseFilter","comperator","predicates","predicates.check","objKey","filtered","$locale","formats","NUMBER_FORMATS","amount","currencySymbol","CURRENCY_SYM","formatNumber","PATTERNS","GROUP_SEP","DECIMAL_SEP","number","fractionSize","pattern","groupSep","decimalSep","isFinite","isNegative","abs","numStr","formatedText","hasExponent","toFixed","fractionLen","min","minFrac","maxFrac","pow","round","fraction","lgroup","lgSize","group","gSize","negPre","posPre","negSuf","posSuf","padNumber","digits","neg","dateGetter","date","dateStrGetter","shortForm","jsonStringToDate","string","R_ISO8601_STR","tzHour","tzMin","dateSetter","setUTCFullYear","setFullYear","timeSetter","setUTCHours","setHours","m","s","ms","parseFloat","format","DATETIME_FORMATS","NUMBER_STRING","DATE_FORMATS_SPLIT","DATE_FORMATS","object","input","limit","out","sortPredicate","reverseOrder","reverseComparator","comp","descending","predicate","v1","v2","arrayCopy","comparator","ngDirective","FormController","toggleValidCss","isValid","validationErrorKey","INVALID_CLASS","VALID_CLASS","form","parentForm","nullFormCtrl","invalidCount","errors","$error","controls","$name","ngForm","$dirty","$pristine","$valid","$invalid","$addControl","PRISTINE_CLASS","form.$addControl","control","$removeControl","form.$removeControl","queue","validationToken","$setValidity","form.$setValidity","$setDirty","form.$setDirty","DIRTY_CLASS","$setPristine","form.$setPristine","textInputType","ctrl","ngTrim","$viewValue","$setViewValue","deferListener","keyCode","$render","ctrl.$render","$isEmpty","ngPattern","validate","patternValidator","patternObj","$formatters","$parsers","ngMinlength","minlength","minLengthValidator","ngMaxlength","maxlength","maxLengthValidator","classDirective","ngClassWatchAction","$index","flattenClasses","classes","old$index","mod","version","addEventListenerFn","addEventListener","attachEvent","removeEventListener","detachEvent","ready","trigger","fired","removeAttribute","css","currentStyle","lowercasedName","getNamedItem","ret","getText","textProp","NODE_TYPE_TEXT_PROPERTY","$dv","multiple","option","selected","onFn","eventFns","contains","compareDocumentPosition","adown","documentElement","bup","eventmap","related","relatedTarget","replaceNode","insertBefore","prepend","wrapNode","after","newElement","toggleClass","condition","nextElementSibling","getElementsByTagName","eventName","eventData","arg3","unbind","off","$animateMinErr","$AnimateProvider","$$selectors","$timeout","enter","afterNode","afterNextSibling","leave","move","XMLHttpRequest","ActiveXObject","e1","e2","e3","PATH_MATCH","paramValue","OPERATORS","null","true","false","+","-","*","/","%","^","===","!==","==","!=","<",">","<=",">=","&&","||","&","|","!","ESCAPE","lex","ch","lastCh","tokens","is","readString","peek","readNumber","isIdent","readIdent","was","isWhitespace","ch2","ch3","fn2","fn3","throwError","chars","isExpOperator","start","end","colStr","peekCh","ident","lastDot","peekIndex","methodName","quote","rawString","hex","rep","ZERO","Parser.ZERO","assignment","logicalOR","functionCall","fieldAccess","objectIndex","filterChain","this.filterChain","primary","statements","expect","consume","arrayDeclaration","msg","peekToken","e4","t","unaryFn","right","ternaryFn","left","middle","binaryFn","statement","argsFn","fnInvoke","ternary","logicalAND","equality","relational","additive","multiplicative","unary","field","indexFn","o","safe","contextGetter","fnPtr","elementFns","allConstant","elementFn","keyValues","ampmGetter","getHours","AMPMS","timeZoneGetter","zone","getTimezoneOffset","paddedZone","htmlAnchorDirective","ngAttributeAliasDirectives","propName","normalized","ngBooleanAttrWatchAction","formDirectiveFactory","isNgForm","formDirective","formElement","action","preventDefaultListener","parentFormCtrl","alias","ngFormDirective","URL_REGEXP","EMAIL_REGEXP","NUMBER_REGEXP","inputType","numberInputType","minValidator","maxValidator","urlInputType","urlValidator","emailInputType","emailValidator","radioInputType","checked","checkboxInputType","trueValue","ngTrueValue","falseValue","ngFalseValue","ctrl.$isEmpty","inputDirective","NgModelController","$modelValue","NaN","$viewChangeListeners","ngModelGet","ngModel","ngModelSet","this.$isEmpty","inheritedData","this.$setValidity","this.$setPristine","this.$setViewValue","ngModelWatch","formatters","ngModelDirective","ctrls","modelCtrl","formCtrl","ngChangeDirective","ngChange","requiredDirective","required","validator","ngListDirective","ngList","viewValue","CONSTANT_VALUE_REGEXP","ngValueDirective","tpl","tplAttr","ngValue","ngValueConstantLink","ngValueLink","valueWatchAction","ngBindDirective","ngBind","ngBindWatchAction","ngBindTemplateDirective","ngBindTemplate","ngBindHtmlDirective","ngBindHtml","getStringValue","ngBindHtmlWatchAction","getTrustedHtml","ngClassDirective","ngClassOddDirective","ngClassEvenDirective","ngCloakDirective","ngControllerDirective","ngCspDirective","ngEventDirectives","ngIfDirective","childElement","ngIf","ngIfWatchAction","ngIncludeDirective","$anchorScroll","$compile","transclusion","srcExp","ngInclude","onloadExp","autoScrollExp","autoscroll","currentElement","cleanupLastIncludeContent","parseAsResourceUrl","ngIncludeWatchAction","thisChangeId","newScope","ngInitDirective","ngInit","ngNonBindableDirective","ngPluralizeDirective","BRACE","numberExp","whenExp","whens","whensExpFns","isWhen","attributeName","ngPluralizeWatch","ngPluralizeWatchAction","ngRepeatDirective","getBlockElements","startNode","endNode","ngRepeatMinErr","linker","ngRepeat","trackByExpGetter","trackByIdExpFn","trackByIdArrayFn","trackByIdObjFn","rhs","valueIdentifier","keyIdentifier","hashFnLocals","lhs","trackByExp","lastBlockMap","ngRepeatAction","collection","previousNode","nextNode","nextBlockMap","arrayLength","collectionKeys","nextBlockOrder","trackByIdFn","trackById","id","$first","$last","$middle","$odd","$even","ngShowDirective","ngShow","ngShowWatchAction","ngHideDirective","ngHide","ngHideWatchAction","ngStyleDirective","ngStyle","ngStyleWatchAction","newStyles","oldStyles","ngSwitchDirective","ngSwitchController","cases","selectedTranscludes","selectedElements","selectedScopes","ngSwitch","ngSwitchWatchAction","change","selectedTransclude","selectedScope","caseElement","anchor","ngSwitchWhenDirective","ngSwitchWhen","ngSwitchDefaultDirective","ngTranscludeDirective","$transclude","$attrs","scriptDirective","ngOptionsMinErr","ngOptionsDirective","selectDirective","NG_OPTIONS_REGEXP","nullModelCtrl","optionsMap","ngModelCtrl","unknownOption","databound","init","self.init","ngModelCtrl_","nullOption_","unknownOption_","addOption","self.addOption","removeOption","self.removeOption","hasOption","renderUnknownOption","self.renderUnknownOption","unknownVal","self.hasOption","Single","selectElement","selectCtrl","ngModelCtrl.$render","emptyOption","Multiple","lastView","items","selectMultipleWatch","Options","render","optionGroups","optionGroupNames","optionGroupName","optionGroup","existingParent","existingOptions","modelValue","valuesFn","keyName","groupIndex","selectedSet","lastElement","trackFn","trackIndex","valueName","groupByFn","modelCast","label","displayFn","nullOption","groupLength","optionGroupsCache","optGroupTemplate","existingOption","optionTemplate","optionsExp","track","optionElement","ngOptions","ngRequired","requiredValidator","optionDirective","nullSelectCtrl","selectCtrlName","interpolateWatchAction","styleDirective","publishExternalAPI","ngModule"]
+}
diff --git a/setup/pub/bootstrap/css/bootstrap-theme.css b/setup/pub/bootstrap/css/bootstrap-theme.css
new file mode 100644
index 0000000000000000000000000000000000000000..a4069929bceb661eacbd4b1eb21306cfa5a1c8f9
--- /dev/null
+++ b/setup/pub/bootstrap/css/bootstrap-theme.css
@@ -0,0 +1,347 @@
+/*!
+ * 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 {
+  text-shadow: 0 1px 0 #fff;
+  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;
+  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-color: #e8e8e8;
+  background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
+  background-image:         linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
+  background-repeat: repeat-x;
+}
+.dropdown-menu > .active > a,
+.dropdown-menu > .active > a:hover,
+.dropdown-menu > .active > a:focus {
+  background-color: #357ebd;
+  background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
+  background-image:         linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
+  background-repeat: repeat-x;
+}
+.navbar-default {
+  background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
+  background-image:         linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
+  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
+  background-repeat: repeat-x;
+  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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);
+  background-repeat: repeat-x;
+  -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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
+  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
+  background-repeat: repeat-x;
+}
+.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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);
+  background-repeat: repeat-x;
+  -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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
+  background-repeat: repeat-x;
+  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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
+  background-repeat: repeat-x;
+  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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
+  background-repeat: repeat-x;
+  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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
+  background-repeat: repeat-x;
+  border-color: #dca7a7;
+}
+.progress {
+  background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
+  background-image:         linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
+  background-repeat: repeat-x;
+}
+.progress-bar {
+  background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%);
+  background-image:         linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
+  background-repeat: repeat-x;
+}
+.progress-bar-success {
+  background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
+  background-image:         linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
+  background-repeat: repeat-x;
+}
+.progress-bar-info {
+  background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
+  background-image:         linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
+  background-repeat: repeat-x;
+}
+.progress-bar-warning {
+  background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
+  background-image:         linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
+  background-repeat: repeat-x;
+}
+.progress-bar-danger {
+  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
+  background-image:         linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
+  background-repeat: repeat-x;
+}
+.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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
+  background-repeat: repeat-x;
+  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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
+  background-repeat: repeat-x;
+}
+.panel-primary > .panel-heading {
+  background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
+  background-image:         linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
+  background-repeat: repeat-x;
+}
+.panel-success > .panel-heading {
+  background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
+  background-image:         linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
+  background-repeat: repeat-x;
+}
+.panel-info > .panel-heading {
+  background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
+  background-image:         linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
+  background-repeat: repeat-x;
+}
+.panel-warning > .panel-heading {
+  background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
+  background-image:         linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
+  background-repeat: repeat-x;
+}
+.panel-danger > .panel-heading {
+  background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
+  background-image:         linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
+  background-repeat: repeat-x;
+}
+.well {
+  background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
+  background-image:         linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
+  background-repeat: repeat-x;
+  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);
+}
+/*# sourceMappingURL=bootstrap-theme.css.map */
diff --git a/setup/pub/bootstrap/css/bootstrap-theme.css.map b/setup/pub/bootstrap/css/bootstrap-theme.css.map
new file mode 100644
index 0000000000000000000000000000000000000000..b36fc9a4970e41d7a3bfdb67780e93ab18a68faf
--- /dev/null
+++ b/setup/pub/bootstrap/css/bootstrap-theme.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["less/theme.less","less/mixins.less"],"names":[],"mappings":"AAeA;AACA;AACA;AACA;AACA;AACA;EACE,wCAAA;ECoGA,2FAAA;EACQ,mFAAA;;ADhGR,YAAC;AAAD,YAAC;AAAD,YAAC;AAAD,SAAC;AAAD,YAAC;AAAD,WAAC;AACD,YAAC;AAAD,YAAC;AAAD,YAAC;AAAD,SAAC;AAAD,YAAC;AAAD,WAAC;EC8FD,wDAAA;EACQ,gDAAA;;ADnER,IAAC;AACD,IAAC;EACC,sBAAA;;AAKJ;EC4PI,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EAEA,sHAAA;EAoCF,mEAAA;ED7TA,2BAAA;EACA,qBAAA;EAyB2C,yBAAA;EAA2B,kBAAA;;AAvBtE,YAAC;AACD,YAAC;EACC,yBAAA;EACA,4BAAA;;AAGF,YAAC;AACD,YAAC;EACC,yBAAA;EACA,qBAAA;;AAeJ;EC2PI,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EAEA,sHAAA;EAoCF,mEAAA;ED7TA,2BAAA;EACA,qBAAA;;AAEA,YAAC;AACD,YAAC;EACC,yBAAA;EACA,4BAAA;;AAGF,YAAC;AACD,YAAC;EACC,yBAAA;EACA,qBAAA;;AAgBJ;EC0PI,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EAEA,sHAAA;EAoCF,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sHAAA;;AD9HJ;EC2HI,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;ADtHJ;EACE,kBAAA;EC/EA,kDAAA;EACQ,0CAAA;;ADiFV,gBAAgB;AAChB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;EACrB,6BAAA;EC4GE,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;ED7GF,qBAAA;;AAUF;ECjGE,iDAAA;EACQ,yCAAA;;AD0GV,cAAe;ECsFX,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;ADxFJ,cAAe;ECqFX,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;ADvFJ,cAAe;ECoFX,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;ADtFJ,WAAY;ECmFR,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;ADrFJ,cAAe;ECkFX,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;ADpFJ,aAAc;ECiFV,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;;AD5EJ;ECyEI,kBAAkB,sDAAlB;EACA,kBAAkB,oDAAlB;EACA,2BAAA;EACA,sHAAA;ED1EF,qBAAA;EC1HA,yFAAA;EACQ,iFAAA","sourcesContent":["\n//\n// Load core variables and mixins\n// --------------------------------------------------\n\n@import \"variables.less\";\n@import \"mixins.less\";\n\n\n\n//\n// Buttons\n// --------------------------------------------------\n\n// Common styles\n.btn-default,\n.btn-primary,\n.btn-success,\n.btn-info,\n.btn-warning,\n.btn-danger {\n  text-shadow: 0 -1px 0 rgba(0,0,0,.2);\n  @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 1px rgba(0,0,0,.075);\n  .box-shadow(@shadow);\n\n  // Reset the shadow\n  &:active,\n  &.active {\n    .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n  }\n}\n\n// Mixin for generating new styles\n.btn-styles(@btn-color: #555) {\n  #gradient > .vertical(@start-color: @btn-color; @end-color: darken(@btn-color, 12%));\n  .reset-filter(); // Disable gradients for IE9 because filter bleeds through rounded corners\n  background-repeat: repeat-x;\n  border-color: darken(@btn-color, 14%);\n\n  &:hover,\n  &:focus  {\n    background-color: darken(@btn-color, 12%);\n    background-position: 0 -15px;\n  }\n\n  &:active,\n  &.active {\n    background-color: darken(@btn-color, 12%);\n    border-color: darken(@btn-color, 14%);\n  }\n}\n\n// Common styles\n.btn {\n  // Remove the gradient for the pressed/active state\n  &:active,\n  &.active {\n    background-image: none;\n  }\n}\n\n// Apply the mixin to the buttons\n.btn-default { .btn-styles(@btn-default-bg); text-shadow: 0 1px 0 #fff; border-color: #ccc; }\n.btn-primary { .btn-styles(@btn-primary-bg); }\n.btn-success { .btn-styles(@btn-success-bg); }\n.btn-info    { .btn-styles(@btn-info-bg); }\n.btn-warning { .btn-styles(@btn-warning-bg); }\n.btn-danger  { .btn-styles(@btn-danger-bg); }\n\n\n\n//\n// Images\n// --------------------------------------------------\n\n.thumbnail,\n.img-thumbnail {\n  .box-shadow(0 1px 2px rgba(0,0,0,.075));\n}\n\n\n\n//\n// Dropdowns\n// --------------------------------------------------\n\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  #gradient > .vertical(@start-color: @dropdown-link-hover-bg; @end-color: darken(@dropdown-link-hover-bg, 5%));\n  background-color: darken(@dropdown-link-hover-bg, 5%);\n}\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n  #gradient > .vertical(@start-color: @dropdown-link-active-bg; @end-color: darken(@dropdown-link-active-bg, 5%));\n  background-color: darken(@dropdown-link-active-bg, 5%);\n}\n\n\n\n//\n// Navbar\n// --------------------------------------------------\n\n// Default navbar\n.navbar-default {\n  #gradient > .vertical(@start-color: lighten(@navbar-default-bg, 10%); @end-color: @navbar-default-bg);\n  .reset-filter(); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered\n  border-radius: @navbar-border-radius;\n  @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 5px rgba(0,0,0,.075);\n  .box-shadow(@shadow);\n\n  .navbar-nav > .active > a {\n    #gradient > .vertical(@start-color: darken(@navbar-default-bg, 5%); @end-color: darken(@navbar-default-bg, 2%));\n    .box-shadow(inset 0 3px 9px rgba(0,0,0,.075));\n  }\n}\n.navbar-brand,\n.navbar-nav > li > a {\n  text-shadow: 0 1px 0 rgba(255,255,255,.25);\n}\n\n// Inverted navbar\n.navbar-inverse {\n  #gradient > .vertical(@start-color: lighten(@navbar-inverse-bg, 10%); @end-color: @navbar-inverse-bg);\n  .reset-filter(); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered\n\n  .navbar-nav > .active > a {\n    #gradient > .vertical(@start-color: @navbar-inverse-bg; @end-color: lighten(@navbar-inverse-bg, 2.5%));\n    .box-shadow(inset 0 3px 9px rgba(0,0,0,.25));\n  }\n\n  .navbar-brand,\n  .navbar-nav > li > a {\n    text-shadow: 0 -1px 0 rgba(0,0,0,.25);\n  }\n}\n\n// Undo rounded corners in static and fixed navbars\n.navbar-static-top,\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  border-radius: 0;\n}\n\n\n\n//\n// Alerts\n// --------------------------------------------------\n\n// Common styles\n.alert {\n  text-shadow: 0 1px 0 rgba(255,255,255,.2);\n  @shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.05);\n  .box-shadow(@shadow);\n}\n\n// Mixin for generating new styles\n.alert-styles(@color) {\n  #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 7.5%));\n  border-color: darken(@color, 15%);\n}\n\n// Apply the mixin to the alerts\n.alert-success    { .alert-styles(@alert-success-bg); }\n.alert-info       { .alert-styles(@alert-info-bg); }\n.alert-warning    { .alert-styles(@alert-warning-bg); }\n.alert-danger     { .alert-styles(@alert-danger-bg); }\n\n\n\n//\n// Progress bars\n// --------------------------------------------------\n\n// Give the progress background some depth\n.progress {\n  #gradient > .vertical(@start-color: darken(@progress-bg, 4%); @end-color: @progress-bg)\n}\n\n// Mixin for generating new styles\n.progress-bar-styles(@color) {\n  #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 10%));\n}\n\n// Apply the mixin to the progress bars\n.progress-bar            { .progress-bar-styles(@progress-bar-bg); }\n.progress-bar-success    { .progress-bar-styles(@progress-bar-success-bg); }\n.progress-bar-info       { .progress-bar-styles(@progress-bar-info-bg); }\n.progress-bar-warning    { .progress-bar-styles(@progress-bar-warning-bg); }\n.progress-bar-danger     { .progress-bar-styles(@progress-bar-danger-bg); }\n\n\n\n//\n// List groups\n// --------------------------------------------------\n\n.list-group {\n  border-radius: @border-radius-base;\n  .box-shadow(0 1px 2px rgba(0,0,0,.075));\n}\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n  text-shadow: 0 -1px 0 darken(@list-group-active-bg, 10%);\n  #gradient > .vertical(@start-color: @list-group-active-bg; @end-color: darken(@list-group-active-bg, 7.5%));\n  border-color: darken(@list-group-active-border, 7.5%);\n}\n\n\n\n//\n// Panels\n// --------------------------------------------------\n\n// Common styles\n.panel {\n  .box-shadow(0 1px 2px rgba(0,0,0,.05));\n}\n\n// Mixin for generating new styles\n.panel-heading-styles(@color) {\n  #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 5%));\n}\n\n// Apply the mixin to the panel headings only\n.panel-default > .panel-heading   { .panel-heading-styles(@panel-default-heading-bg); }\n.panel-primary > .panel-heading   { .panel-heading-styles(@panel-primary-heading-bg); }\n.panel-success > .panel-heading   { .panel-heading-styles(@panel-success-heading-bg); }\n.panel-info > .panel-heading      { .panel-heading-styles(@panel-info-heading-bg); }\n.panel-warning > .panel-heading   { .panel-heading-styles(@panel-warning-heading-bg); }\n.panel-danger > .panel-heading    { .panel-heading-styles(@panel-danger-heading-bg); }\n\n\n\n//\n// Wells\n// --------------------------------------------------\n\n.well {\n  #gradient > .vertical(@start-color: darken(@well-bg, 5%); @end-color: @well-bg);\n  border-color: darken(@well-bg, 10%);\n  @shadow: inset 0 1px 3px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);\n  .box-shadow(@shadow);\n}\n","//\n// Mixins\n// --------------------------------------------------\n\n\n// Utilities\n// -------------------------\n\n// Clearfix\n// Source: http://nicolasgallagher.com/micro-clearfix-hack/\n//\n// For modern browsers\n// 1. The space content is one way to avoid an Opera bug when the\n//    contenteditable attribute is included anywhere else in the document.\n//    Otherwise it causes space to appear at the top and bottom of elements\n//    that are clearfixed.\n// 2. The use of `table` rather than `block` is only necessary if using\n//    `:before` to contain the top-margins of child elements.\n.clearfix() {\n  &:before,\n  &:after {\n    content: \" \"; // 1\n    display: table; // 2\n  }\n  &:after {\n    clear: both;\n  }\n}\n\n// WebKit-style focus\n.tab-focus() {\n  // Default\n  outline: thin dotted;\n  // WebKit\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n\n// Center-align a block level element\n.center-block() {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n// Sizing shortcuts\n.size(@width; @height) {\n  width: @width;\n  height: @height;\n}\n.square(@size) {\n  .size(@size; @size);\n}\n\n// Placeholder text\n.placeholder(@color: @input-color-placeholder) {\n  &::-moz-placeholder           { color: @color;   // Firefox\n                                  opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526\n  &:-ms-input-placeholder       { color: @color; } // Internet Explorer 10+\n  &::-webkit-input-placeholder  { color: @color; } // Safari and Chrome\n}\n\n// Text overflow\n// Requires inline-block or block for proper styling\n.text-overflow() {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n// CSS image replacement\n//\n// Heads up! v3 launched with with only `.hide-text()`, but per our pattern for\n// mixins being reused as classes with the same name, this doesn't hold up. As\n// of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note\n// that we cannot chain the mixins together in Less, so they are repeated.\n//\n// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757\n\n// Deprecated as of v3.0.1 (will be removed in v4)\n.hide-text() {\n  font: ~\"0/0\" a;\n  color: transparent;\n  text-shadow: none;\n  background-color: transparent;\n  border: 0;\n}\n// New mixin to use as of v3.0.1\n.text-hide() {\n  .hide-text();\n}\n\n\n\n// CSS3 PROPERTIES\n// --------------------------------------------------\n\n// Single side border-radius\n.border-top-radius(@radius) {\n  border-top-right-radius: @radius;\n   border-top-left-radius: @radius;\n}\n.border-right-radius(@radius) {\n  border-bottom-right-radius: @radius;\n     border-top-right-radius: @radius;\n}\n.border-bottom-radius(@radius) {\n  border-bottom-right-radius: @radius;\n   border-bottom-left-radius: @radius;\n}\n.border-left-radius(@radius) {\n  border-bottom-left-radius: @radius;\n     border-top-left-radius: @radius;\n}\n\n// Drop shadows\n//\n// Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's\n//   supported browsers that have box shadow capabilities now support the\n//   standard `box-shadow` property.\n.box-shadow(@shadow) {\n  -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1\n          box-shadow: @shadow;\n}\n\n// Transitions\n.transition(@transition) {\n  -webkit-transition: @transition;\n          transition: @transition;\n}\n.transition-property(@transition-property) {\n  -webkit-transition-property: @transition-property;\n          transition-property: @transition-property;\n}\n.transition-delay(@transition-delay) {\n  -webkit-transition-delay: @transition-delay;\n          transition-delay: @transition-delay;\n}\n.transition-duration(@transition-duration) {\n  -webkit-transition-duration: @transition-duration;\n          transition-duration: @transition-duration;\n}\n.transition-transform(@transition) {\n  -webkit-transition: -webkit-transform @transition;\n     -moz-transition: -moz-transform @transition;\n       -o-transition: -o-transform @transition;\n          transition: transform @transition;\n}\n\n// Transformations\n.rotate(@degrees) {\n  -webkit-transform: rotate(@degrees);\n      -ms-transform: rotate(@degrees); // IE9 only\n          transform: rotate(@degrees);\n}\n.scale(@ratio; @ratio-y...) {\n  -webkit-transform: scale(@ratio, @ratio-y);\n      -ms-transform: scale(@ratio, @ratio-y); // IE9 only\n          transform: scale(@ratio, @ratio-y);\n}\n.translate(@x; @y) {\n  -webkit-transform: translate(@x, @y);\n      -ms-transform: translate(@x, @y); // IE9 only\n          transform: translate(@x, @y);\n}\n.skew(@x; @y) {\n  -webkit-transform: skew(@x, @y);\n      -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+\n          transform: skew(@x, @y);\n}\n.translate3d(@x; @y; @z) {\n  -webkit-transform: translate3d(@x, @y, @z);\n          transform: translate3d(@x, @y, @z);\n}\n\n.rotateX(@degrees) {\n  -webkit-transform: rotateX(@degrees);\n      -ms-transform: rotateX(@degrees); // IE9 only\n          transform: rotateX(@degrees);\n}\n.rotateY(@degrees) {\n  -webkit-transform: rotateY(@degrees);\n      -ms-transform: rotateY(@degrees); // IE9 only\n          transform: rotateY(@degrees);\n}\n.perspective(@perspective) {\n  -webkit-perspective: @perspective;\n     -moz-perspective: @perspective;\n          perspective: @perspective;\n}\n.perspective-origin(@perspective) {\n  -webkit-perspective-origin: @perspective;\n     -moz-perspective-origin: @perspective;\n          perspective-origin: @perspective;\n}\n.transform-origin(@origin) {\n  -webkit-transform-origin: @origin;\n     -moz-transform-origin: @origin;\n      -ms-transform-origin: @origin; // IE9 only\n          transform-origin: @origin;\n}\n\n// Animations\n.animation(@animation) {\n  -webkit-animation: @animation;\n          animation: @animation;\n}\n.animation-name(@name) {\n  -webkit-animation-name: @name;\n          animation-name: @name;\n}\n.animation-duration(@duration) {\n  -webkit-animation-duration: @duration;\n          animation-duration: @duration;\n}\n.animation-timing-function(@timing-function) {\n  -webkit-animation-timing-function: @timing-function;\n          animation-timing-function: @timing-function;\n}\n.animation-delay(@delay) {\n  -webkit-animation-delay: @delay;\n          animation-delay: @delay;\n}\n.animation-iteration-count(@iteration-count) {\n  -webkit-animation-iteration-count: @iteration-count;\n          animation-iteration-count: @iteration-count;\n}\n.animation-direction(@direction) {\n  -webkit-animation-direction: @direction;\n          animation-direction: @direction;\n}\n\n// Backface visibility\n// Prevent browsers from flickering when using CSS 3D transforms.\n// Default value is `visible`, but can be changed to `hidden`\n.backface-visibility(@visibility){\n  -webkit-backface-visibility: @visibility;\n     -moz-backface-visibility: @visibility;\n          backface-visibility: @visibility;\n}\n\n// Box sizing\n.box-sizing(@boxmodel) {\n  -webkit-box-sizing: @boxmodel;\n     -moz-box-sizing: @boxmodel;\n          box-sizing: @boxmodel;\n}\n\n// User select\n// For selecting text on the page\n.user-select(@select) {\n  -webkit-user-select: @select;\n     -moz-user-select: @select;\n      -ms-user-select: @select; // IE10+\n          user-select: @select;\n}\n\n// Resize anything\n.resizable(@direction) {\n  resize: @direction; // Options: horizontal, vertical, both\n  overflow: auto; // Safari fix\n}\n\n// CSS3 Content Columns\n.content-columns(@column-count; @column-gap: @grid-gutter-width) {\n  -webkit-column-count: @column-count;\n     -moz-column-count: @column-count;\n          column-count: @column-count;\n  -webkit-column-gap: @column-gap;\n     -moz-column-gap: @column-gap;\n          column-gap: @column-gap;\n}\n\n// Optional hyphenation\n.hyphens(@mode: auto) {\n  word-wrap: break-word;\n  -webkit-hyphens: @mode;\n     -moz-hyphens: @mode;\n      -ms-hyphens: @mode; // IE10+\n       -o-hyphens: @mode;\n          hyphens: @mode;\n}\n\n// Opacity\n.opacity(@opacity) {\n  opacity: @opacity;\n  // IE8 filter\n  @opacity-ie: (@opacity * 100);\n  filter: ~\"alpha(opacity=@{opacity-ie})\";\n}\n\n\n\n// GRADIENTS\n// --------------------------------------------------\n\n#gradient {\n\n  // Horizontal gradient, from left to right\n  //\n  // Creates two color stops, start and end, by specifying a color and position for each color stop.\n  // Color stops are not available in IE9 and below.\n  .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n    background-image: -webkit-linear-gradient(left, color-stop(@start-color @start-percent), color-stop(@end-color @end-percent)); // Safari 5.1-6, Chrome 10+\n    background-image:  linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n    background-repeat: repeat-x;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down\n  }\n\n  // Vertical gradient, from top to bottom\n  //\n  // Creates two color stops, start and end, by specifying a color and position for each color stop.\n  // Color stops are not available in IE9 and below.\n  .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n    background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);  // Safari 5.1-6, Chrome 10+\n    background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n    background-repeat: repeat-x;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down\n  }\n\n  .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {\n    background-repeat: repeat-x;\n    background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1-6, Chrome 10+\n    background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n  }\n  .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n    background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);\n    background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);\n    background-repeat: no-repeat;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n  }\n  .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n    background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-repeat: no-repeat;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n  }\n  .radial(@inner-color: #555; @outer-color: #333) {\n    background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color);\n    background-image: radial-gradient(circle, @inner-color, @outer-color);\n    background-repeat: no-repeat;\n  }\n  .striped(@color: rgba(255,255,255,.15); @angle: 45deg) {\n    background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n    background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n  }\n}\n\n// Reset filters for IE\n//\n// When you need to remove a gradient background, do not forget to use this to reset\n// the IE filter for IE9 and below.\n.reset-filter() {\n  filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(enabled = false)\"));\n}\n\n\n\n// Retina images\n//\n// Short retina mixin for setting background-image and -size\n\n.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {\n  background-image: url(\"@{file-1x}\");\n\n  @media\n  only screen and (-webkit-min-device-pixel-ratio: 2),\n  only screen and (   min--moz-device-pixel-ratio: 2),\n  only screen and (     -o-min-device-pixel-ratio: 2/1),\n  only screen and (        min-device-pixel-ratio: 2),\n  only screen and (                min-resolution: 192dpi),\n  only screen and (                min-resolution: 2dppx) {\n    background-image: url(\"@{file-2x}\");\n    background-size: @width-1x @height-1x;\n  }\n}\n\n\n// Responsive image\n//\n// Keep images from scaling beyond the width of their parents.\n\n.img-responsive(@display: block) {\n  display: @display;\n  max-width: 100%; // Part 1: Set a maximum relative to the parent\n  height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching\n}\n\n\n// COMPONENT MIXINS\n// --------------------------------------------------\n\n// Horizontal dividers\n// -------------------------\n// Dividers (basically an hr) within dropdowns and nav lists\n.nav-divider(@color: #e5e5e5) {\n  height: 1px;\n  margin: ((@line-height-computed / 2) - 1) 0;\n  overflow: hidden;\n  background-color: @color;\n}\n\n// Panels\n// -------------------------\n.panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {\n  border-color: @border;\n\n  & > .panel-heading {\n    color: @heading-text-color;\n    background-color: @heading-bg-color;\n    border-color: @heading-border;\n\n    + .panel-collapse .panel-body {\n      border-top-color: @border;\n    }\n  }\n  & > .panel-footer {\n    + .panel-collapse .panel-body {\n      border-bottom-color: @border;\n    }\n  }\n}\n\n// Alerts\n// -------------------------\n.alert-variant(@background; @border; @text-color) {\n  background-color: @background;\n  border-color: @border;\n  color: @text-color;\n\n  hr {\n    border-top-color: darken(@border, 5%);\n  }\n  .alert-link {\n    color: darken(@text-color, 10%);\n  }\n}\n\n// Tables\n// -------------------------\n.table-row-variant(@state; @background) {\n  // Exact selectors below required to override `.table-striped` and prevent\n  // inheritance to nested tables.\n  .table > thead > tr,\n  .table > tbody > tr,\n  .table > tfoot > tr {\n    > td.@{state},\n    > th.@{state},\n    &.@{state} > td,\n    &.@{state} > th {\n      background-color: @background;\n    }\n  }\n\n  // Hover states for `.table-hover`\n  // Note: this is not available for cells or rows within `thead` or `tfoot`.\n  .table-hover > tbody > tr {\n    > td.@{state}:hover,\n    > th.@{state}:hover,\n    &.@{state}:hover > td,\n    &.@{state}:hover > th {\n      background-color: darken(@background, 5%);\n    }\n  }\n}\n\n// List Groups\n// -------------------------\n.list-group-item-variant(@state; @background; @color) {\n  .list-group-item-@{state} {\n    color: @color;\n    background-color: @background;\n\n    a& {\n      color: @color;\n\n      .list-group-item-heading { color: inherit; }\n\n      &:hover,\n      &:focus {\n        color: @color;\n        background-color: darken(@background, 5%);\n      }\n      &.active,\n      &.active:hover,\n      &.active:focus {\n        color: #fff;\n        background-color: @color;\n        border-color: @color;\n      }\n    }\n  }\n}\n\n// Button variants\n// -------------------------\n// Easily pump out default styles, as well as :hover, :focus, :active,\n// and disabled options for all buttons\n.button-variant(@color; @background; @border) {\n  color: @color;\n  background-color: @background;\n  border-color: @border;\n\n  &:hover,\n  &:focus,\n  &:active,\n  &.active,\n  .open .dropdown-toggle& {\n    color: @color;\n    background-color: darken(@background, 8%);\n        border-color: darken(@border, 12%);\n  }\n  &:active,\n  &.active,\n  .open .dropdown-toggle& {\n    background-image: none;\n  }\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    &,\n    &:hover,\n    &:focus,\n    &:active,\n    &.active {\n      background-color: @background;\n          border-color: @border;\n    }\n  }\n\n  .badge {\n    color: @background;\n    background-color: @color;\n  }\n}\n\n// Button sizes\n// -------------------------\n.button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  padding: @padding-vertical @padding-horizontal;\n  font-size: @font-size;\n  line-height: @line-height;\n  border-radius: @border-radius;\n}\n\n// Pagination\n// -------------------------\n.pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {\n  > li {\n    > a,\n    > span {\n      padding: @padding-vertical @padding-horizontal;\n      font-size: @font-size;\n    }\n    &:first-child {\n      > a,\n      > span {\n        .border-left-radius(@border-radius);\n      }\n    }\n    &:last-child {\n      > a,\n      > span {\n        .border-right-radius(@border-radius);\n      }\n    }\n  }\n}\n\n// Labels\n// -------------------------\n.label-variant(@color) {\n  background-color: @color;\n  &[href] {\n    &:hover,\n    &:focus {\n      background-color: darken(@color, 10%);\n    }\n  }\n}\n\n// Contextual backgrounds\n// -------------------------\n.bg-variant(@color) {\n  background-color: @color;\n  a&:hover {\n    background-color: darken(@color, 10%);\n  }\n}\n\n// Typography\n// -------------------------\n.text-emphasis-variant(@color) {\n  color: @color;\n  a&:hover {\n    color: darken(@color, 10%);\n  }\n}\n\n// Navbar vertical align\n// -------------------------\n// Vertically center elements in the navbar.\n// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.\n.navbar-vertical-align(@element-height) {\n  margin-top: ((@navbar-height - @element-height) / 2);\n  margin-bottom: ((@navbar-height - @element-height) / 2);\n}\n\n// Progress bars\n// -------------------------\n.progress-bar-variant(@color) {\n  background-color: @color;\n  .progress-striped & {\n    #gradient > .striped();\n  }\n}\n\n// Responsive utilities\n// -------------------------\n// More easily include all the states for responsive-utilities.less.\n.responsive-visibility() {\n  display: block !important;\n  table&  { display: table; }\n  tr&     { display: table-row !important; }\n  th&,\n  td&     { display: table-cell !important; }\n}\n\n.responsive-invisibility() {\n  display: none !important;\n}\n\n\n// Grid System\n// -----------\n\n// Centered container element\n.container-fixed() {\n  margin-right: auto;\n  margin-left: auto;\n  padding-left:  (@grid-gutter-width / 2);\n  padding-right: (@grid-gutter-width / 2);\n  &:extend(.clearfix all);\n}\n\n// Creates a wrapper for a series of columns\n.make-row(@gutter: @grid-gutter-width) {\n  margin-left:  (@gutter / -2);\n  margin-right: (@gutter / -2);\n  &:extend(.clearfix all);\n}\n\n// Generate the extra small columns\n.make-xs-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  float: left;\n  width: percentage((@columns / @grid-columns));\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n}\n.make-xs-column-offset(@columns) {\n  @media (min-width: @screen-xs-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-xs-column-push(@columns) {\n  @media (min-width: @screen-xs-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-xs-column-pull(@columns) {\n  @media (min-width: @screen-xs-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Generate the small columns\n.make-sm-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-sm-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-offset(@columns) {\n  @media (min-width: @screen-sm-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-push(@columns) {\n  @media (min-width: @screen-sm-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-pull(@columns) {\n  @media (min-width: @screen-sm-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Generate the medium columns\n.make-md-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-md-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-offset(@columns) {\n  @media (min-width: @screen-md-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-push(@columns) {\n  @media (min-width: @screen-md-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-pull(@columns) {\n  @media (min-width: @screen-md-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Generate the large columns\n.make-lg-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-lg-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-offset(@columns) {\n  @media (min-width: @screen-lg-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-push(@columns) {\n  @media (min-width: @screen-lg-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-pull(@columns) {\n  @media (min-width: @screen-lg-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Framework grid generation\n//\n// Used only by Bootstrap to generate the correct number of grid classes given\n// any value of `@grid-columns`.\n\n.make-grid-columns() {\n  // Common styles for all sizes of grid columns, widths 1-12\n  .col(@index) when (@index = 1) { // initial\n    @item: ~\".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}\";\n    .col((@index + 1), @item);\n  }\n  .col(@index, @list) when (@index =< @grid-columns) { // general; \"=<\" isn't a typo\n    @item: ~\".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}\";\n    .col((@index + 1), ~\"@{list}, @{item}\");\n  }\n  .col(@index, @list) when (@index > @grid-columns) { // terminal\n    @{list} {\n      position: relative;\n      // Prevent columns from collapsing when empty\n      min-height: 1px;\n      // Inner gutter via padding\n      padding-left:  (@grid-gutter-width / 2);\n      padding-right: (@grid-gutter-width / 2);\n    }\n  }\n  .col(1); // kickstart it\n}\n\n.float-grid-columns(@class) {\n  .col(@index) when (@index = 1) { // initial\n    @item: ~\".col-@{class}-@{index}\";\n    .col((@index + 1), @item);\n  }\n  .col(@index, @list) when (@index =< @grid-columns) { // general\n    @item: ~\".col-@{class}-@{index}\";\n    .col((@index + 1), ~\"@{list}, @{item}\");\n  }\n  .col(@index, @list) when (@index > @grid-columns) { // terminal\n    @{list} {\n      float: left;\n    }\n  }\n  .col(1); // kickstart it\n}\n\n.calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {\n  .col-@{class}-@{index} {\n    width: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = push) {\n  .col-@{class}-push-@{index} {\n    left: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = pull) {\n  .col-@{class}-pull-@{index} {\n    right: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = offset) {\n  .col-@{class}-offset-@{index} {\n    margin-left: percentage((@index / @grid-columns));\n  }\n}\n\n// Basic looping in LESS\n.loop-grid-columns(@index, @class, @type) when (@index >= 0) {\n  .calc-grid-column(@index, @class, @type);\n  // next iteration\n  .loop-grid-columns((@index - 1), @class, @type);\n}\n\n// Create grid for specific class\n.make-grid(@class) {\n  .float-grid-columns(@class);\n  .loop-grid-columns(@grid-columns, @class, width);\n  .loop-grid-columns(@grid-columns, @class, pull);\n  .loop-grid-columns(@grid-columns, @class, push);\n  .loop-grid-columns(@grid-columns, @class, offset);\n}\n\n// Form validation states\n//\n// Used in forms.less to generate the form validation CSS for warnings, errors,\n// and successes.\n\n.form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {\n  // Color the label and help text\n  .help-block,\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline  {\n    color: @text-color;\n  }\n  // Set the border and box shadow on specific inputs to match\n  .form-control {\n    border-color: @border-color;\n    .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work\n    &:focus {\n      border-color: darken(@border-color, 10%);\n      @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);\n      .box-shadow(@shadow);\n    }\n  }\n  // Set validation states also for addons\n  .input-group-addon {\n    color: @text-color;\n    border-color: @border-color;\n    background-color: @background-color;\n  }\n  // Optional feedback icon\n  .form-control-feedback {\n    color: @text-color;\n  }\n}\n\n// Form control focus state\n//\n// Generate a customized focus state and for any input with the specified color,\n// which defaults to the `@input-focus-border` variable.\n//\n// We highly encourage you to not customize the default value, but instead use\n// this to tweak colors on an as-needed basis. This aesthetic change is based on\n// WebKit's default styles, but applicable to a wider range of browsers. Its\n// usability and accessibility should be taken into account with any change.\n//\n// Example usage: change the default blue border and shadow to white for better\n// contrast against a dark gray background.\n\n.form-control-focus(@color: @input-border-focus) {\n  @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);\n  &:focus {\n    border-color: @color;\n    outline: 0;\n    .box-shadow(~\"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}\");\n  }\n}\n\n// Form control sizing\n//\n// Relative text size, padding, and border-radii changes for form controls. For\n// horizontal sizing, wrap controls in the predefined grid classes. `<select>`\n// element gets special love because it's special, and that's a fact!\n\n.input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  height: @input-height;\n  padding: @padding-vertical @padding-horizontal;\n  font-size: @font-size;\n  line-height: @line-height;\n  border-radius: @border-radius;\n\n  select& {\n    height: @input-height;\n    line-height: @input-height;\n  }\n\n  textarea&,\n  select[multiple]& {\n    height: auto;\n  }\n}\n"]}
\ No newline at end of file
diff --git a/setup/pub/bootstrap/css/bootstrap-theme.min.css b/setup/pub/bootstrap/css/bootstrap-theme.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..ba4bd28ae51616917024b5d4a8d2d20b969a9e31
--- /dev/null
+++ b/setup/pub/bootstrap/css/bootstrap-theme.min.css
@@ -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/setup/pub/bootstrap/css/bootstrap.css b/setup/pub/bootstrap/css/bootstrap.css
new file mode 100644
index 0000000000000000000000000000000000000000..7f36651961ed5bc42a712042c6db5493b4ce99e9
--- /dev/null
+++ b/setup/pub/bootstrap/css/bootstrap.css
@@ -0,0 +1,5785 @@
+/*!
+ * 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;
+  -webkit-text-size-adjust: 100%;
+      -ms-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 {
+  margin: .67em 0;
+  font-size: 2em;
+}
+mark {
+  color: #000;
+  background: #ff0;
+}
+small {
+  font-size: 80%;
+}
+sub,
+sup {
+  position: relative;
+  font-size: 75%;
+  line-height: 0;
+  vertical-align: baseline;
+}
+sup {
+  top: -.5em;
+}
+sub {
+  bottom: -.25em;
+}
+img {
+  border: 0;
+}
+svg:not(:root) {
+  overflow: hidden;
+}
+figure {
+  margin: 1em 40px;
+}
+hr {
+  height: 0;
+  -moz-box-sizing: content-box;
+       box-sizing: content-box;
+}
+pre {
+  overflow: auto;
+}
+code,
+kbd,
+pre,
+samp {
+  font-family: monospace, monospace;
+  font-size: 1em;
+}
+button,
+input,
+optgroup,
+select,
+textarea {
+  margin: 0;
+  font: inherit;
+  color: inherit;
+}
+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 {
+  padding: 0;
+  border: 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-box-sizing: content-box;
+     -moz-box-sizing: content-box;
+          box-sizing: content-box;
+  -webkit-appearance: textfield;
+}
+input[type="search"]::-webkit-search-cancel-button,
+input[type="search"]::-webkit-search-decoration {
+  -webkit-appearance: none;
+}
+fieldset {
+  padding: .35em .625em .75em;
+  margin: 0 2px;
+  border: 1px solid #c0c0c0;
+}
+legend {
+  padding: 0;
+  border: 0;
+}
+textarea {
+  overflow: auto;
+}
+optgroup {
+  font-weight: bold;
+}
+table {
+  border-spacing: 0;
+  border-collapse: collapse;
+}
+td,
+th {
+  padding: 0;
+}
+@media print {
+  * {
+    color: #000 !important;
+    text-shadow: none !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 {
+  display: inline-block;
+  max-width: 100%;
+  height: auto;
+  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;
+}
+.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;
+  padding: 0;
+  margin: -1px;
+  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: normal;
+  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;
+  margin-left: -5px;
+  list-style: none;
+}
+.list-inline > li {
+  display: inline-block;
+  padding-right: 5px;
+  padding-left: 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;
+    overflow: hidden;
+    clear: left;
+    text-align: right;
+    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;
+  text-align: right;
+  border-right: 5px solid #eee;
+  border-left: 0;
+}
+.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;
+  white-space: nowrap;
+  background-color: #f9f2f4;
+  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;
+  color: #333;
+  word-break: break-all;
+  word-wrap: break-word;
+  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 {
+  padding-right: 15px;
+  padding-left: 15px;
+  margin-right: auto;
+  margin-left: auto;
+}
+@media (min-width: 768px) {
+  .container {
+    width: 750px;
+  }
+}
+@media (min-width: 992px) {
+  .container {
+    width: 970px;
+  }
+}
+@media (min-width: 1200px) {
+  .container {
+    width: 1170px;
+  }
+}
+.container-fluid {
+  padding-right: 15px;
+  padding-left: 15px;
+  margin-right: auto;
+  margin-left: auto;
+}
+.row {
+  margin-right: -15px;
+  margin-left: -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-right: 15px;
+  padding-left: 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;
+  display: table-column;
+  float: none;
+}
+table td[class*="col-"],
+table th[class*="col-"] {
+  position: static;
+  display: table-cell;
+  float: none;
+}
+.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-x: scroll;
+    overflow-y: hidden;
+    -webkit-overflow-scrolling: touch;
+    -ms-overflow-style: -ms-autohiding-scrollbar;
+    border: 1px solid #ddd;
+  }
+  .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 {
+  min-width: 0;
+  padding: 0;
+  margin: 0;
+  border: 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: 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;
+  /* IE8-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;
+  padding-left: 20px;
+  margin-top: 10px;
+  margin-bottom: 10px;
+}
+.radio label,
+.checkbox label {
+  display: inline;
+  font-weight: normal;
+  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;
+  font-weight: normal;
+  vertical-align: middle;
+  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;
+  background-color: #dff0d8;
+  border-color: #3c763d;
+}
+.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;
+  background-color: #fcf8e3;
+  border-color: #8a6d3b;
+}
+.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;
+  background-color: #f2dede;
+  border-color: #a94442;
+}
+.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;
+    padding-left: 0;
+    margin-top: 0;
+    margin-bottom: 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 {
+  padding-top: 7px;
+  margin-top: 0;
+  margin-bottom: 0;
+}
+.form-horizontal .radio,
+.form-horizontal .checkbox {
+  min-height: 27px;
+}
+.form-horizontal .form-group {
+  margin-right: -15px;
+  margin-left: -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;
+  padding: 6px 12px;
+  margin-bottom: 0;
+  font-size: 14px;
+  font-weight: normal;
+  line-height: 1.42857143;
+  text-align: center;
+  white-space: nowrap;
+  vertical-align: middle;
+  cursor: pointer;
+  -webkit-user-select: none;
+     -moz-user-select: none;
+      -ms-user-select: none;
+          user-select: none;
+  background-image: none;
+  border: 1px solid transparent;
+  border-radius: 4px;
+}
+.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 {
+  background-image: none;
+  outline: 0;
+  -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 {
+  pointer-events: none;
+  cursor: not-allowed;
+  filter: alpha(opacity=65);
+  -webkit-box-shadow: none;
+          box-shadow: none;
+  opacity: .65;
+}
+.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 {
+  font-weight: normal;
+  color: #428bca;
+  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-right: 0;
+  padding-left: 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: 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";
+}
+.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;
+  font-size: 14px;
+  list-style: none;
+  background-color: #fff;
+  background-clip: padding-box;
+  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);
+}
+.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: normal;
+  line-height: 1.42857143;
+  color: #333;
+  white-space: nowrap;
+}
+.dropdown-menu > li > a:hover,
+.dropdown-menu > li > a:focus {
+  color: #262626;
+  text-decoration: none;
+  background-color: #f5f5f5;
+}
+.dropdown-menu > .active > a,
+.dropdown-menu > .active > a:hover,
+.dropdown-menu > .active > a:focus {
+  color: #fff;
+  text-decoration: none;
+  background-color: #428bca;
+  outline: 0;
+}
+.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;
+  cursor: not-allowed;
+  background-color: transparent;
+  background-image: none;
+  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
+}
+.open > .dropdown-menu {
+  display: block;
+}
+.open > a {
+  outline: 0;
+}
+.dropdown-menu-right {
+  right: 0;
+  left: auto;
+}
+.dropdown-menu-left {
+  right: auto;
+  left: 0;
+}
+.dropdown-header {
+  display: block;
+  padding: 3px 20px;
+  font-size: 12px;
+  line-height: 1.42857143;
+  color: #999;
+}
+.dropdown-backdrop {
+  position: fixed;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  z-index: 990;
+}
+.pull-right > .dropdown-menu {
+  right: 0;
+  left: auto;
+}
+.dropup .caret,
+.navbar-fixed-bottom .dropdown .caret {
+  content: "";
+  border-top: 0;
+  border-bottom: 4px solid;
+}
+.dropup .dropdown-menu,
+.navbar-fixed-bottom .dropdown .dropdown-menu {
+  top: auto;
+  bottom: 100%;
+  margin-bottom: 1px;
+}
+@media (min-width: 768px) {
+  .navbar-right .dropdown-menu {
+    right: 0;
+    left: auto;
+  }
+  .navbar-right .dropdown-menu-left {
+    right: auto;
+    left: 0;
+  }
+}
+.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: none;
+}
+.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-top-right-radius: 0;
+  border-bottom-right-radius: 0;
+}
+.btn-group > .btn:last-child:not(:first-child),
+.btn-group > .dropdown-toggle:not(:first-child) {
+  border-top-left-radius: 0;
+  border-bottom-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-top-right-radius: 0;
+  border-bottom-right-radius: 0;
+}
+.btn-group > .btn-group:last-child > .btn:first-child {
+  border-top-left-radius: 0;
+  border-bottom-left-radius: 0;
+}
+.btn-group .dropdown-toggle:active,
+.btn-group.open .dropdown-toggle {
+  outline: 0;
+}
+.btn-group > .btn + .dropdown-toggle {
+  padding-right: 8px;
+  padding-left: 8px;
+}
+.btn-group > .btn-lg + .dropdown-toggle {
+  padding-right: 12px;
+  padding-left: 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-top-left-radius: 0;
+  border-top-right-radius: 0;
+  border-bottom-left-radius: 4px;
+}
+.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-left-radius: 0;
+  border-top-right-radius: 0;
+}
+.btn-group-justified {
+  display: table;
+  width: 100%;
+  table-layout: fixed;
+  border-collapse: separate;
+}
+.btn-group-justified > .btn,
+.btn-group-justified > .btn-group {
+  display: table-cell;
+  float: none;
+  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-right: 0;
+  padding-left: 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: normal;
+  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-top-right-radius: 0;
+  border-bottom-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-top-left-radius: 0;
+  border-bottom-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 {
+  padding-left: 0;
+  margin-bottom: 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;
+  cursor: not-allowed;
+  background-color: transparent;
+}
+.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;
+  cursor: default;
+  background-color: #fff;
+  border: 1px solid #ddd;
+  border-bottom-color: transparent;
+}
+.nav-tabs.nav-justified {
+  width: 100%;
+  border-bottom: 0;
+}
+.nav-tabs.nav-justified > li {
+  float: none;
+}
+.nav-tabs.nav-justified > li > a {
+  margin-bottom: 5px;
+  text-align: center;
+}
+.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 {
+  margin-bottom: 5px;
+  text-align: center;
+}
+.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-left-radius: 0;
+  border-top-right-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;
+  padding-right: 15px;
+  padding-left: 15px;
+  overflow-x: visible;
+  -webkit-overflow-scrolling: touch;
+  border-top: 1px solid transparent;
+  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
+}
+.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-right: 0;
+    padding-left: 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;
+  height: 50px;
+  padding: 15px 15px;
+  font-size: 18px;
+  line-height: 20px;
+}
+.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;
+  padding: 9px 10px;
+  margin-top: 8px;
+  margin-right: 15px;
+  margin-bottom: 8px;
+  background-color: transparent;
+  background-image: none;
+  border: 1px solid transparent;
+  border-radius: 4px;
+}
+.navbar-toggle:focus {
+  outline: none;
+}
+.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 {
+  padding: 10px 15px;
+  margin-top: 8px;
+  margin-right: -15px;
+  margin-bottom: 8px;
+  margin-left: -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);
+}
+@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;
+    padding-left: 0;
+    margin-top: 0;
+    margin-bottom: 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;
+    padding-top: 0;
+    padding-bottom: 0;
+    margin-right: 0;
+    margin-left: 0;
+    border: 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-left-radius: 0;
+  border-top-right-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-right: 15px;
+    margin-left: 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 {
+  color: #555;
+  background-color: #e7e7e7;
+}
+@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 {
+  color: #fff;
+  background-color: #080808;
+}
+@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 {
+  padding: 0 5px;
+  color: #ccc;
+  content: "/\00a0";
+}
+.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;
+  margin-left: -1px;
+  line-height: 1.42857143;
+  color: #428bca;
+  text-decoration: none;
+  background-color: #fff;
+  border: 1px solid #ddd;
+}
+.pagination > li:first-child > a,
+.pagination > li:first-child > span {
+  margin-left: 0;
+  border-top-left-radius: 4px;
+  border-bottom-left-radius: 4px;
+}
+.pagination > li:last-child > a,
+.pagination > li:last-child > span {
+  border-top-right-radius: 4px;
+  border-bottom-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;
+  cursor: default;
+  background-color: #428bca;
+  border-color: #428bca;
+}
+.pagination > .disabled > span,
+.pagination > .disabled > span:hover,
+.pagination > .disabled > span:focus,
+.pagination > .disabled > a,
+.pagination > .disabled > a:hover,
+.pagination > .disabled > a:focus {
+  color: #999;
+  cursor: not-allowed;
+  background-color: #fff;
+  border-color: #ddd;
+}
+.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-top-left-radius: 6px;
+  border-bottom-left-radius: 6px;
+}
+.pagination-lg > li:last-child > a,
+.pagination-lg > li:last-child > span {
+  border-top-right-radius: 6px;
+  border-bottom-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-top-left-radius: 3px;
+  border-bottom-left-radius: 3px;
+}
+.pagination-sm > li:last-child > a,
+.pagination-sm > li:last-child > span {
+  border-top-right-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+.pager {
+  padding-left: 0;
+  margin: 20px 0;
+  text-align: center;
+  list-style: none;
+}
+.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;
+  cursor: not-allowed;
+  background-color: #fff;
+}
+.label {
+  display: inline;
+  padding: .2em .6em .3em;
+  font-size: 75%;
+  font-weight: bold;
+  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: #808080;
+}
+.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: bold;
+  line-height: 1;
+  color: #fff;
+  text-align: center;
+  white-space: nowrap;
+  vertical-align: baseline;
+  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-right: 60px;
+    padding-left: 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-right: auto;
+  margin-left: 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: bold;
+}
+.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 {
+  color: #3c763d;
+  background-color: #dff0d8;
+  border-color: #d6e9c6;
+}
+.alert-success hr {
+  border-top-color: #c9e2b3;
+}
+.alert-success .alert-link {
+  color: #2b542c;
+}
+.alert-info {
+  color: #31708f;
+  background-color: #d9edf7;
+  border-color: #bce8f1;
+}
+.alert-info hr {
+  border-top-color: #a6e1ec;
+}
+.alert-info .alert-link {
+  color: #245269;
+}
+.alert-warning {
+  color: #8a6d3b;
+  background-color: #fcf8e3;
+  border-color: #faebcc;
+}
+.alert-warning hr {
+  border-top-color: #f7e1b5;
+}
+.alert-warning .alert-link {
+  color: #66512c;
+}
+.alert-danger {
+  color: #a94442;
+  background-color: #f2dede;
+  border-color: #ebccd1;
+}
+.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 {
+  height: 20px;
+  margin-bottom: 20px;
+  overflow: hidden;
+  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 {
+  padding-left: 0;
+  margin-bottom: 20px;
+}
+.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-left-radius: 4px;
+  border-top-right-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-left-radius: 3px;
+  border-top-right-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-left-radius: 3px;
+  border-top-right-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-left-radius: 3px;
+  border-top-right-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 {
+  margin-bottom: 0;
+  border: 0;
+}
+.panel-group {
+  margin-bottom: 20px;
+}
+.panel-group .panel {
+  margin-bottom: 0;
+  overflow: hidden;
+  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 #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: bold;
+  line-height: 1;
+  color: #000;
+  text-shadow: 0 1px 0 #fff;
+  filter: alpha(opacity=20);
+  opacity: .2;
+}
+.close:hover,
+.close:focus {
+  color: #000;
+  text-decoration: none;
+  cursor: pointer;
+  filter: alpha(opacity=50);
+  opacity: .5;
+}
+button.close {
+  -webkit-appearance: none;
+  padding: 0;
+  cursor: pointer;
+  background: transparent;
+  border: 0;
+}
+.modal-open {
+  overflow: hidden;
+}
+.modal {
+  position: fixed;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  z-index: 1050;
+  display: none;
+  overflow: auto;
+  overflow-y: scroll;
+  -webkit-overflow-scrolling: touch;
+  outline: 0;
+}
+.modal.fade .modal-dialog {
+  -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;
+  -webkit-transform: translate(0, -25%);
+      -ms-transform: translate(0, -25%);
+          transform: translate(0, -25%);
+}
+.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;
+  background-clip: padding-box;
+  border: 1px solid #999;
+  border: 1px solid rgba(0, 0, 0, .2);
+  border-radius: 6px;
+  outline: none;
+  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
+          box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
+}
+.modal-backdrop {
+  position: fixed;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  z-index: 1040;
+  background-color: #000;
+}
+.modal-backdrop.fade {
+  filter: alpha(opacity=0);
+  opacity: 0;
+}
+.modal-backdrop.in {
+  filter: alpha(opacity=50);
+  opacity: .5;
+}
+.modal-header {
+  min-height: 16.42857143px;
+  padding: 15px;
+  border-bottom: 1px solid #e5e5e5;
+}
+.modal-header .close {
+  margin-top: -2px;
+}
+.modal-title {
+  margin: 0;
+  line-height: 1.42857143;
+}
+.modal-body {
+  position: relative;
+  padding: 20px;
+}
+.modal-footer {
+  padding: 19px 20px 20px;
+  margin-top: 15px;
+  text-align: right;
+  border-top: 1px solid #e5e5e5;
+}
+.modal-footer .btn + .btn {
+  margin-bottom: 0;
+  margin-left: 5px;
+}
+.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;
+  font-size: 12px;
+  line-height: 1.4;
+  visibility: visible;
+  filter: alpha(opacity=0);
+  opacity: 0;
+}
+.tooltip.in {
+  filter: alpha(opacity=90);
+  opacity: .9;
+}
+.tooltip.top {
+  padding: 5px 0;
+  margin-top: -3px;
+}
+.tooltip.right {
+  padding: 0 5px;
+  margin-left: 3px;
+}
+.tooltip.bottom {
+  padding: 5px 0;
+  margin-top: 3px;
+}
+.tooltip.left {
+  padding: 0 5px;
+  margin-left: -3px;
+}
+.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 {
+  right: 5px;
+  bottom: 0;
+  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;
+  white-space: normal;
+  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);
+}
+.popover.top {
+  margin-top: -10px;
+}
+.popover.right {
+  margin-left: 10px;
+}
+.popover.bottom {
+  margin-top: 10px;
+}
+.popover.left {
+  margin-left: -10px;
+}
+.popover-title {
+  padding: 8px 14px;
+  margin: 0;
+  font-size: 14px;
+  font-weight: normal;
+  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 {
+  content: "";
+  border-width: 10px;
+}
+.popover.top > .arrow {
+  bottom: -11px;
+  left: 50%;
+  margin-left: -11px;
+  border-top-color: #999;
+  border-top-color: rgba(0, 0, 0, .25);
+  border-bottom-width: 0;
+}
+.popover.top > .arrow:after {
+  bottom: 1px;
+  margin-left: -10px;
+  content: " ";
+  border-top-color: #fff;
+  border-bottom-width: 0;
+}
+.popover.right > .arrow {
+  top: 50%;
+  left: -11px;
+  margin-top: -11px;
+  border-right-color: #999;
+  border-right-color: rgba(0, 0, 0, .25);
+  border-left-width: 0;
+}
+.popover.right > .arrow:after {
+  bottom: -10px;
+  left: 1px;
+  content: " ";
+  border-right-color: #fff;
+  border-left-width: 0;
+}
+.popover.bottom > .arrow {
+  top: -11px;
+  left: 50%;
+  margin-left: -11px;
+  border-top-width: 0;
+  border-bottom-color: #999;
+  border-bottom-color: rgba(0, 0, 0, .25);
+}
+.popover.bottom > .arrow:after {
+  top: 1px;
+  margin-left: -10px;
+  content: " ";
+  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 {
+  right: 1px;
+  bottom: -10px;
+  content: " ";
+  border-right-width: 0;
+  border-left-color: #fff;
+}
+.carousel {
+  position: relative;
+}
+.carousel-inner {
+  position: relative;
+  width: 100%;
+  overflow: hidden;
+}
+.carousel-inner > .item {
+  position: relative;
+  display: none;
+  -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;
+  bottom: 0;
+  left: 0;
+  width: 15%;
+  font-size: 20px;
+  color: #fff;
+  text-align: center;
+  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
+  filter: alpha(opacity=50);
+  opacity: .5;
+}
+.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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
+  background-repeat: repeat-x;
+}
+.carousel-control.right {
+  right: 0;
+  left: auto;
+  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%);
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
+  background-repeat: repeat-x;
+}
+.carousel-control:hover,
+.carousel-control:focus {
+  color: #fff;
+  text-decoration: none;
+  filter: alpha(opacity=90);
+  outline: none;
+  opacity: .9;
+}
+.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%;
+  padding-left: 0;
+  margin-left: -30%;
+  text-align: center;
+  list-style: none;
+}
+.carousel-indicators li {
+  display: inline-block;
+  width: 10px;
+  height: 10px;
+  margin: 1px;
+  text-indent: -999px;
+  cursor: pointer;
+  background-color: #000 \9;
+  background-color: rgba(0, 0, 0, 0);
+  border: 1px solid #fff;
+  border-radius: 10px;
+}
+.carousel-indicators .active {
+  width: 12px;
+  height: 12px;
+  margin: 0;
+  background-color: #fff;
+}
+.carousel-caption {
+  position: absolute;
+  right: 15%;
+  bottom: 20px;
+  left: 15%;
+  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 {
+    right: 20%;
+    left: 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 {
+  display: table;
+  content: " ";
+}
+.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-right: auto;
+  margin-left: 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;
+  }
+}
+/*# sourceMappingURL=bootstrap.css.map */
diff --git a/setup/pub/bootstrap/css/bootstrap.css.map b/setup/pub/bootstrap/css/bootstrap.css.map
new file mode 100644
index 0000000000000000000000000000000000000000..6bc5a2dc75413860670f9e657d62b64cf15fd195
--- /dev/null
+++ b/setup/pub/bootstrap/css/bootstrap.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["less/normalize.less","less/print.less","less/scaffolding.less","less/mixins.less","less/variables.less","less/thumbnails.less","less/carousel.less","less/type.less","less/code.less","less/grid.less","less/tables.less","less/forms.less","less/buttons.less","less/button-groups.less","less/component-animations.less","less/glyphicons.less","less/dropdowns.less","less/input-groups.less","less/navs.less","less/navbar.less","less/utilities.less","less/breadcrumbs.less","less/pagination.less","less/pager.less","less/labels.less","less/badges.less","less/jumbotron.less","less/alerts.less","less/progress-bars.less","less/media.less","less/list-group.less","less/panels.less","less/wells.less","less/close.less","less/modals.less","less/tooltip.less","less/popovers.less","less/responsive-utilities.less"],"names":[],"mappings":";AAQA;EACE,uBAAA;EACA,0BAAA;EACA,8BAAA;;AAOF;EACE,SAAA;;AAUF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,cAAA;;AAQF;AACA;AACA;AACA;EACE,qBAAA;EACA,wBAAA;;AAQF,KAAK,IAAI;EACP,aAAA;EACA,SAAA;;AAQF;AACA;EACE,aAAA;;AAUF;EACE,uBAAA;;AAOF,CAAC;AACD,CAAC;EACC,UAAA;;AAUF,IAAI;EACF,yBAAA;;AAOF;AACA;EACE,iBAAA;;AAOF;EACE,kBAAA;;AAQF;EACE,cAAA;EACA,gBAAA;;AAOF;EACE,gBAAA;EACA,WAAA;;AAOF;EACE,cAAA;;AAOF;AACA;EACE,cAAA;EACA,cAAA;EACA,kBAAA;EACA,wBAAA;;AAGF;EACE,WAAA;;AAGF;EACE,eAAA;;AAUF;EACE,SAAA;;AAOF,GAAG,IAAI;EACL,gBAAA;;AAUF;EACE,gBAAA;;AAOF;EACE,4BAAA;EACA,uBAAA;EACA,SAAA;;AAOF;EACE,cAAA;;AAOF;AACA;AACA;AACA;EACE,iCAAA;EACA,cAAA;;AAkBF;AACA;AACA;AACA;AACA;EACE,cAAA;EACA,aAAA;EACA,SAAA;;AAOF;EACE,iBAAA;;AAUF;AACA;EACE,oBAAA;;AAWF;AACA,IAAK,MAAK;AACV,KAAK;AACL,KAAK;EACH,0BAAA;EACA,eAAA;;AAOF,MAAM;AACN,IAAK,MAAK;EACR,eAAA;;AAOF,MAAM;AACN,KAAK;EACH,SAAA;EACA,UAAA;;AAQF;EACE,mBAAA;;AAWF,KAAK;AACL,KAAK;EACH,sBAAA;EACA,UAAA;;AASF,KAAK,eAAe;AACp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jBE,yBAAA;;EACA,KAAK;IAAK,cAAA;;EACV,EAAE;IAAQ,kBAAA;;EACV,EAAE;EACF,EAAE;IAAQ,mBAAA;;;AkCxjBZ,QAHqC;EAGrC;IlC4jBE,wBAAA;;;AkCvjBF,QAHqC,uBAAgC;EAGrE;IlCujBE,wBAAA;;;AkCljBF,QAHqC,uBAAgC;EAGrE;IlCkjBE,wBAAA;;;AkC7iBF,QAHqC;EAGrC;IlC6iBE,wBAAA;;;AkCtiBF;ElCsiBE,wBAAA;;AkChiBF;EAAA;IlCwhBE,yBAAA;;EACA,KAAK;IAAK,cAAA;;EACV,EAAE;IAAQ,kBAAA;;EACV,EAAE;EACF,EAAE;IAAQ,mBAAA;;;AkCthBZ;EAAA;IlC0hBE,wBAAA","sourcesContent":["/*! normalize.css v3.0.0 | MIT License | git.io/normalize */\n\n//\n// 1. Set default font family to sans-serif.\n// 2. Prevent iOS text size adjust after orientation change, without disabling\n//    user zoom.\n//\n\nhtml {\n  font-family: sans-serif; // 1\n  -ms-text-size-adjust: 100%; // 2\n  -webkit-text-size-adjust: 100%; // 2\n}\n\n//\n// Remove default margin.\n//\n\nbody {\n  margin: 0;\n}\n\n// HTML5 display definitions\n// ==========================================================================\n\n//\n// Correct `block` display not defined in IE 8/9.\n//\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nnav,\nsection,\nsummary {\n  display: block;\n}\n\n//\n// 1. Correct `inline-block` display not defined in IE 8/9.\n// 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\n//\n\naudio,\ncanvas,\nprogress,\nvideo {\n  display: inline-block; // 1\n  vertical-align: baseline; // 2\n}\n\n//\n// Prevent modern browsers from displaying `audio` without controls.\n// Remove excess height in iOS 5 devices.\n//\n\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n\n//\n// Address `[hidden]` styling not present in IE 8/9.\n// Hide the `template` element in IE, Safari, and Firefox < 22.\n//\n\n[hidden],\ntemplate {\n  display: none;\n}\n\n// Links\n// ==========================================================================\n\n//\n// Remove the gray background color from active links in IE 10.\n//\n\na {\n  background: transparent;\n}\n\n//\n// Improve readability when focused and also mouse hovered in all browsers.\n//\n\na:active,\na:hover {\n  outline: 0;\n}\n\n// Text-level semantics\n// ==========================================================================\n\n//\n// Address styling not present in IE 8/9, Safari 5, and Chrome.\n//\n\nabbr[title] {\n  border-bottom: 1px dotted;\n}\n\n//\n// Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n//\n\nb,\nstrong {\n  font-weight: bold;\n}\n\n//\n// Address styling not present in Safari 5 and Chrome.\n//\n\ndfn {\n  font-style: italic;\n}\n\n//\n// Address variable `h1` font-size and margin within `section` and `article`\n// contexts in Firefox 4+, Safari 5, and Chrome.\n//\n\nh1 {\n  font-size: 2em;\n  margin: 0.67em 0;\n}\n\n//\n// Address styling not present in IE 8/9.\n//\n\nmark {\n  background: #ff0;\n  color: #000;\n}\n\n//\n// Address inconsistent and variable font size in all browsers.\n//\n\nsmall {\n  font-size: 80%;\n}\n\n//\n// Prevent `sub` and `sup` affecting `line-height` in all browsers.\n//\n\nsub,\nsup {\n  font-size: 75%;\n  line-height: 0;\n  position: relative;\n  vertical-align: baseline;\n}\n\nsup {\n  top: -0.5em;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\n// Embedded content\n// ==========================================================================\n\n//\n// Remove border when inside `a` element in IE 8/9.\n//\n\nimg {\n  border: 0;\n}\n\n//\n// Correct overflow displayed oddly in IE 9.\n//\n\nsvg:not(:root) {\n  overflow: hidden;\n}\n\n// Grouping content\n// ==========================================================================\n\n//\n// Address margin not present in IE 8/9 and Safari 5.\n//\n\nfigure {\n  margin: 1em 40px;\n}\n\n//\n// Address differences between Firefox and other browsers.\n//\n\nhr {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  height: 0;\n}\n\n//\n// Contain overflow in all browsers.\n//\n\npre {\n  overflow: auto;\n}\n\n//\n// Address odd `em`-unit font size rendering in all browsers.\n//\n\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, monospace;\n  font-size: 1em;\n}\n\n// Forms\n// ==========================================================================\n\n//\n// Known limitation: by default, Chrome and Safari on OS X allow very limited\n// styling of `select`, unless a `border` property is set.\n//\n\n//\n// 1. Correct color not being inherited.\n//    Known issue: affects color of disabled elements.\n// 2. Correct font properties not being inherited.\n// 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n//\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  color: inherit; // 1\n  font: inherit; // 2\n  margin: 0; // 3\n}\n\n//\n// Address `overflow` set to `hidden` in IE 8/9/10.\n//\n\nbutton {\n  overflow: visible;\n}\n\n//\n// Address inconsistent `text-transform` inheritance for `button` and `select`.\n// All other form control elements do not inherit `text-transform` values.\n// Correct `button` style inheritance in Firefox, IE 8+, and Opera\n// Correct `select` style inheritance in Firefox.\n//\n\nbutton,\nselect {\n  text-transform: none;\n}\n\n//\n// 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n//    and `video` controls.\n// 2. Correct inability to style clickable `input` types in iOS.\n// 3. Improve usability and consistency of cursor style between image-type\n//    `input` and others.\n//\n\nbutton,\nhtml input[type=\"button\"], // 1\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  -webkit-appearance: button; // 2\n  cursor: pointer; // 3\n}\n\n//\n// Re-set default cursor for disabled elements.\n//\n\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\n\n//\n// Remove inner padding and border in Firefox 4+.\n//\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  border: 0;\n  padding: 0;\n}\n\n//\n// Address Firefox 4+ setting `line-height` on `input` using `!important` in\n// the UA stylesheet.\n//\n\ninput {\n  line-height: normal;\n}\n\n//\n// It's recommended that you don't attempt to style these elements.\n// Firefox's implementation doesn't respect box-sizing, padding, or width.\n//\n// 1. Address box sizing set to `content-box` in IE 8/9/10.\n// 2. Remove excess padding in IE 8/9/10.\n//\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n  box-sizing: border-box; // 1\n  padding: 0; // 2\n}\n\n//\n// Fix the cursor style for Chrome's increment/decrement buttons. For certain\n// `font-size` values of the `input`, it causes the cursor style of the\n// decrement button to change from `default` to `text`.\n//\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n  height: auto;\n}\n\n//\n// 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n// 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n//    (include `-moz` to future-proof).\n//\n\ninput[type=\"search\"] {\n  -webkit-appearance: textfield; // 1\n  -moz-box-sizing: content-box;\n  -webkit-box-sizing: content-box; // 2\n  box-sizing: content-box;\n}\n\n//\n// Remove inner padding and search cancel button in Safari and Chrome on OS X.\n// Safari (but not Chrome) clips the cancel button when the search input has\n// padding (and `textfield` appearance).\n//\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n//\n// Define consistent border, margin, and padding.\n//\n\nfieldset {\n  border: 1px solid #c0c0c0;\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n}\n\n//\n// 1. Correct `color` not being inherited in IE 8/9.\n// 2. Remove padding so people aren't caught out if they zero out fieldsets.\n//\n\nlegend {\n  border: 0; // 1\n  padding: 0; // 2\n}\n\n//\n// Remove default vertical scrollbar in IE 8/9.\n//\n\ntextarea {\n  overflow: auto;\n}\n\n//\n// Don't inherit the `font-weight` (applied by a rule above).\n// NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\n//\n\noptgroup {\n  font-weight: bold;\n}\n\n// Tables\n// ==========================================================================\n\n//\n// Remove most spacing between table cells.\n//\n\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n}\n\ntd,\nth {\n  padding: 0;\n}","//\n// Basic print styles\n// --------------------------------------------------\n// Source: https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css\n\n@media print {\n\n  * {\n    text-shadow: none !important;\n    color: #000 !important; // Black prints faster: h5bp.com/s\n    background: transparent !important;\n    box-shadow: none !important;\n  }\n\n  a,\n  a:visited {\n    text-decoration: underline;\n  }\n\n  a[href]:after {\n    content: \" (\" attr(href) \")\";\n  }\n\n  abbr[title]:after {\n    content: \" (\" attr(title) \")\";\n  }\n\n  // Don't show links for images, or javascript/internal links\n  a[href^=\"javascript:\"]:after,\n  a[href^=\"#\"]:after {\n    content: \"\";\n  }\n\n  pre,\n  blockquote {\n    border: 1px solid #999;\n    page-break-inside: avoid;\n  }\n\n  thead {\n    display: table-header-group; // h5bp.com/t\n  }\n\n  tr,\n  img {\n    page-break-inside: avoid;\n  }\n\n  img {\n    max-width: 100% !important;\n  }\n\n  p,\n  h2,\n  h3 {\n    orphans: 3;\n    widows: 3;\n  }\n\n  h2,\n  h3 {\n    page-break-after: avoid;\n  }\n\n  // Chrome (OSX) fix for https://github.com/twbs/bootstrap/issues/11245\n  // Once fixed, we can just straight up remove this.\n  select {\n    background: #fff !important;\n  }\n\n  // Bootstrap components\n  .navbar {\n    display: none;\n  }\n  .table {\n    td,\n    th {\n      background-color: #fff !important;\n    }\n  }\n  .btn,\n  .dropup > .btn {\n    > .caret {\n      border-top-color: #000 !important;\n    }\n  }\n  .label {\n    border: 1px solid #000;\n  }\n\n  .table {\n    border-collapse: collapse !important;\n  }\n  .table-bordered {\n    th,\n    td {\n      border: 1px solid #ddd !important;\n    }\n  }\n\n}\n","//\n// Scaffolding\n// --------------------------------------------------\n\n\n// Reset the box-sizing\n//\n// Heads up! This reset may cause conflicts with some third-party widgets.\n// For recommendations on resolving such conflicts, see\n// http://getbootstrap.com/getting-started/#third-box-sizing\n* {\n  .box-sizing(border-box);\n}\n*:before,\n*:after {\n  .box-sizing(border-box);\n}\n\n\n// Body reset\n\nhtml {\n  font-size: 62.5%;\n  -webkit-tap-highlight-color: rgba(0,0,0,0);\n}\n\nbody {\n  font-family: @font-family-base;\n  font-size: @font-size-base;\n  line-height: @line-height-base;\n  color: @text-color;\n  background-color: @body-bg;\n}\n\n// Reset fonts for relevant elements\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: inherit;\n  font-size: inherit;\n  line-height: inherit;\n}\n\n\n// Links\n\na {\n  color: @link-color;\n  text-decoration: none;\n\n  &:hover,\n  &:focus {\n    color: @link-hover-color;\n    text-decoration: underline;\n  }\n\n  &:focus {\n    .tab-focus();\n  }\n}\n\n\n// Figures\n//\n// We reset this here because previously Normalize had no `figure` margins. This\n// ensures we don't break anyone's use of the element.\n\nfigure {\n  margin: 0;\n}\n\n\n// Images\n\nimg {\n  vertical-align: middle;\n}\n\n// Responsive images (ensure images don't scale beyond their parents)\n.img-responsive {\n  .img-responsive();\n}\n\n// Rounded corners\n.img-rounded {\n  border-radius: @border-radius-large;\n}\n\n// Image thumbnails\n//\n// Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`.\n.img-thumbnail {\n  padding: @thumbnail-padding;\n  line-height: @line-height-base;\n  background-color: @thumbnail-bg;\n  border: 1px solid @thumbnail-border;\n  border-radius: @thumbnail-border-radius;\n  .transition(all .2s ease-in-out);\n\n  // Keep them at most 100% wide\n  .img-responsive(inline-block);\n}\n\n// Perfect circle\n.img-circle {\n  border-radius: 50%; // set radius in percents\n}\n\n\n// Horizontal rules\n\nhr {\n  margin-top:    @line-height-computed;\n  margin-bottom: @line-height-computed;\n  border: 0;\n  border-top: 1px solid @hr-border;\n}\n\n\n// Only display content to screen readers\n//\n// See: http://a11yproject.com/posts/how-to-hide-content/\n\n.sr-only {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  padding: 0;\n  overflow: hidden;\n  clip: rect(0,0,0,0);\n  border: 0;\n}\n","//\n// Mixins\n// --------------------------------------------------\n\n\n// Utilities\n// -------------------------\n\n// Clearfix\n// Source: http://nicolasgallagher.com/micro-clearfix-hack/\n//\n// For modern browsers\n// 1. The space content is one way to avoid an Opera bug when the\n//    contenteditable attribute is included anywhere else in the document.\n//    Otherwise it causes space to appear at the top and bottom of elements\n//    that are clearfixed.\n// 2. The use of `table` rather than `block` is only necessary if using\n//    `:before` to contain the top-margins of child elements.\n.clearfix() {\n  &:before,\n  &:after {\n    content: \" \"; // 1\n    display: table; // 2\n  }\n  &:after {\n    clear: both;\n  }\n}\n\n// WebKit-style focus\n.tab-focus() {\n  // Default\n  outline: thin dotted;\n  // WebKit\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n\n// Center-align a block level element\n.center-block() {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n// Sizing shortcuts\n.size(@width; @height) {\n  width: @width;\n  height: @height;\n}\n.square(@size) {\n  .size(@size; @size);\n}\n\n// Placeholder text\n.placeholder(@color: @input-color-placeholder) {\n  &::-moz-placeholder           { color: @color;   // Firefox\n                                  opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526\n  &:-ms-input-placeholder       { color: @color; } // Internet Explorer 10+\n  &::-webkit-input-placeholder  { color: @color; } // Safari and Chrome\n}\n\n// Text overflow\n// Requires inline-block or block for proper styling\n.text-overflow() {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n// CSS image replacement\n//\n// Heads up! v3 launched with with only `.hide-text()`, but per our pattern for\n// mixins being reused as classes with the same name, this doesn't hold up. As\n// of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note\n// that we cannot chain the mixins together in Less, so they are repeated.\n//\n// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757\n\n// Deprecated as of v3.0.1 (will be removed in v4)\n.hide-text() {\n  font: ~\"0/0\" a;\n  color: transparent;\n  text-shadow: none;\n  background-color: transparent;\n  border: 0;\n}\n// New mixin to use as of v3.0.1\n.text-hide() {\n  .hide-text();\n}\n\n\n\n// CSS3 PROPERTIES\n// --------------------------------------------------\n\n// Single side border-radius\n.border-top-radius(@radius) {\n  border-top-right-radius: @radius;\n   border-top-left-radius: @radius;\n}\n.border-right-radius(@radius) {\n  border-bottom-right-radius: @radius;\n     border-top-right-radius: @radius;\n}\n.border-bottom-radius(@radius) {\n  border-bottom-right-radius: @radius;\n   border-bottom-left-radius: @radius;\n}\n.border-left-radius(@radius) {\n  border-bottom-left-radius: @radius;\n     border-top-left-radius: @radius;\n}\n\n// Drop shadows\n//\n// Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's\n//   supported browsers that have box shadow capabilities now support the\n//   standard `box-shadow` property.\n.box-shadow(@shadow) {\n  -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1\n          box-shadow: @shadow;\n}\n\n// Transitions\n.transition(@transition) {\n  -webkit-transition: @transition;\n          transition: @transition;\n}\n.transition-property(@transition-property) {\n  -webkit-transition-property: @transition-property;\n          transition-property: @transition-property;\n}\n.transition-delay(@transition-delay) {\n  -webkit-transition-delay: @transition-delay;\n          transition-delay: @transition-delay;\n}\n.transition-duration(@transition-duration) {\n  -webkit-transition-duration: @transition-duration;\n          transition-duration: @transition-duration;\n}\n.transition-transform(@transition) {\n  -webkit-transition: -webkit-transform @transition;\n     -moz-transition: -moz-transform @transition;\n       -o-transition: -o-transform @transition;\n          transition: transform @transition;\n}\n\n// Transformations\n.rotate(@degrees) {\n  -webkit-transform: rotate(@degrees);\n      -ms-transform: rotate(@degrees); // IE9 only\n          transform: rotate(@degrees);\n}\n.scale(@ratio; @ratio-y...) {\n  -webkit-transform: scale(@ratio, @ratio-y);\n      -ms-transform: scale(@ratio, @ratio-y); // IE9 only\n          transform: scale(@ratio, @ratio-y);\n}\n.translate(@x; @y) {\n  -webkit-transform: translate(@x, @y);\n      -ms-transform: translate(@x, @y); // IE9 only\n          transform: translate(@x, @y);\n}\n.skew(@x; @y) {\n  -webkit-transform: skew(@x, @y);\n      -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+\n          transform: skew(@x, @y);\n}\n.translate3d(@x; @y; @z) {\n  -webkit-transform: translate3d(@x, @y, @z);\n          transform: translate3d(@x, @y, @z);\n}\n\n.rotateX(@degrees) {\n  -webkit-transform: rotateX(@degrees);\n      -ms-transform: rotateX(@degrees); // IE9 only\n          transform: rotateX(@degrees);\n}\n.rotateY(@degrees) {\n  -webkit-transform: rotateY(@degrees);\n      -ms-transform: rotateY(@degrees); // IE9 only\n          transform: rotateY(@degrees);\n}\n.perspective(@perspective) {\n  -webkit-perspective: @perspective;\n     -moz-perspective: @perspective;\n          perspective: @perspective;\n}\n.perspective-origin(@perspective) {\n  -webkit-perspective-origin: @perspective;\n     -moz-perspective-origin: @perspective;\n          perspective-origin: @perspective;\n}\n.transform-origin(@origin) {\n  -webkit-transform-origin: @origin;\n     -moz-transform-origin: @origin;\n      -ms-transform-origin: @origin; // IE9 only\n          transform-origin: @origin;\n}\n\n// Animations\n.animation(@animation) {\n  -webkit-animation: @animation;\n          animation: @animation;\n}\n.animation-name(@name) {\n  -webkit-animation-name: @name;\n          animation-name: @name;\n}\n.animation-duration(@duration) {\n  -webkit-animation-duration: @duration;\n          animation-duration: @duration;\n}\n.animation-timing-function(@timing-function) {\n  -webkit-animation-timing-function: @timing-function;\n          animation-timing-function: @timing-function;\n}\n.animation-delay(@delay) {\n  -webkit-animation-delay: @delay;\n          animation-delay: @delay;\n}\n.animation-iteration-count(@iteration-count) {\n  -webkit-animation-iteration-count: @iteration-count;\n          animation-iteration-count: @iteration-count;\n}\n.animation-direction(@direction) {\n  -webkit-animation-direction: @direction;\n          animation-direction: @direction;\n}\n\n// Backface visibility\n// Prevent browsers from flickering when using CSS 3D transforms.\n// Default value is `visible`, but can be changed to `hidden`\n.backface-visibility(@visibility){\n  -webkit-backface-visibility: @visibility;\n     -moz-backface-visibility: @visibility;\n          backface-visibility: @visibility;\n}\n\n// Box sizing\n.box-sizing(@boxmodel) {\n  -webkit-box-sizing: @boxmodel;\n     -moz-box-sizing: @boxmodel;\n          box-sizing: @boxmodel;\n}\n\n// User select\n// For selecting text on the page\n.user-select(@select) {\n  -webkit-user-select: @select;\n     -moz-user-select: @select;\n      -ms-user-select: @select; // IE10+\n          user-select: @select;\n}\n\n// Resize anything\n.resizable(@direction) {\n  resize: @direction; // Options: horizontal, vertical, both\n  overflow: auto; // Safari fix\n}\n\n// CSS3 Content Columns\n.content-columns(@column-count; @column-gap: @grid-gutter-width) {\n  -webkit-column-count: @column-count;\n     -moz-column-count: @column-count;\n          column-count: @column-count;\n  -webkit-column-gap: @column-gap;\n     -moz-column-gap: @column-gap;\n          column-gap: @column-gap;\n}\n\n// Optional hyphenation\n.hyphens(@mode: auto) {\n  word-wrap: break-word;\n  -webkit-hyphens: @mode;\n     -moz-hyphens: @mode;\n      -ms-hyphens: @mode; // IE10+\n       -o-hyphens: @mode;\n          hyphens: @mode;\n}\n\n// Opacity\n.opacity(@opacity) {\n  opacity: @opacity;\n  // IE8 filter\n  @opacity-ie: (@opacity * 100);\n  filter: ~\"alpha(opacity=@{opacity-ie})\";\n}\n\n\n\n// GRADIENTS\n// --------------------------------------------------\n\n#gradient {\n\n  // Horizontal gradient, from left to right\n  //\n  // Creates two color stops, start and end, by specifying a color and position for each color stop.\n  // Color stops are not available in IE9 and below.\n  .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n    background-image: -webkit-linear-gradient(left, color-stop(@start-color @start-percent), color-stop(@end-color @end-percent)); // Safari 5.1-6, Chrome 10+\n    background-image:  linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n    background-repeat: repeat-x;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down\n  }\n\n  // Vertical gradient, from top to bottom\n  //\n  // Creates two color stops, start and end, by specifying a color and position for each color stop.\n  // Color stops are not available in IE9 and below.\n  .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n    background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);  // Safari 5.1-6, Chrome 10+\n    background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n    background-repeat: repeat-x;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down\n  }\n\n  .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {\n    background-repeat: repeat-x;\n    background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1-6, Chrome 10+\n    background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n  }\n  .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n    background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);\n    background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);\n    background-repeat: no-repeat;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n  }\n  .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n    background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n    background-repeat: no-repeat;\n    filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n  }\n  .radial(@inner-color: #555; @outer-color: #333) {\n    background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color);\n    background-image: radial-gradient(circle, @inner-color, @outer-color);\n    background-repeat: no-repeat;\n  }\n  .striped(@color: rgba(255,255,255,.15); @angle: 45deg) {\n    background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n    background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n  }\n}\n\n// Reset filters for IE\n//\n// When you need to remove a gradient background, do not forget to use this to reset\n// the IE filter for IE9 and below.\n.reset-filter() {\n  filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(enabled = false)\"));\n}\n\n\n\n// Retina images\n//\n// Short retina mixin for setting background-image and -size\n\n.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {\n  background-image: url(\"@{file-1x}\");\n\n  @media\n  only screen and (-webkit-min-device-pixel-ratio: 2),\n  only screen and (   min--moz-device-pixel-ratio: 2),\n  only screen and (     -o-min-device-pixel-ratio: 2/1),\n  only screen and (        min-device-pixel-ratio: 2),\n  only screen and (                min-resolution: 192dpi),\n  only screen and (                min-resolution: 2dppx) {\n    background-image: url(\"@{file-2x}\");\n    background-size: @width-1x @height-1x;\n  }\n}\n\n\n// Responsive image\n//\n// Keep images from scaling beyond the width of their parents.\n\n.img-responsive(@display: block) {\n  display: @display;\n  max-width: 100%; // Part 1: Set a maximum relative to the parent\n  height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching\n}\n\n\n// COMPONENT MIXINS\n// --------------------------------------------------\n\n// Horizontal dividers\n// -------------------------\n// Dividers (basically an hr) within dropdowns and nav lists\n.nav-divider(@color: #e5e5e5) {\n  height: 1px;\n  margin: ((@line-height-computed / 2) - 1) 0;\n  overflow: hidden;\n  background-color: @color;\n}\n\n// Panels\n// -------------------------\n.panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {\n  border-color: @border;\n\n  & > .panel-heading {\n    color: @heading-text-color;\n    background-color: @heading-bg-color;\n    border-color: @heading-border;\n\n    + .panel-collapse .panel-body {\n      border-top-color: @border;\n    }\n  }\n  & > .panel-footer {\n    + .panel-collapse .panel-body {\n      border-bottom-color: @border;\n    }\n  }\n}\n\n// Alerts\n// -------------------------\n.alert-variant(@background; @border; @text-color) {\n  background-color: @background;\n  border-color: @border;\n  color: @text-color;\n\n  hr {\n    border-top-color: darken(@border, 5%);\n  }\n  .alert-link {\n    color: darken(@text-color, 10%);\n  }\n}\n\n// Tables\n// -------------------------\n.table-row-variant(@state; @background) {\n  // Exact selectors below required to override `.table-striped` and prevent\n  // inheritance to nested tables.\n  .table > thead > tr,\n  .table > tbody > tr,\n  .table > tfoot > tr {\n    > td.@{state},\n    > th.@{state},\n    &.@{state} > td,\n    &.@{state} > th {\n      background-color: @background;\n    }\n  }\n\n  // Hover states for `.table-hover`\n  // Note: this is not available for cells or rows within `thead` or `tfoot`.\n  .table-hover > tbody > tr {\n    > td.@{state}:hover,\n    > th.@{state}:hover,\n    &.@{state}:hover > td,\n    &.@{state}:hover > th {\n      background-color: darken(@background, 5%);\n    }\n  }\n}\n\n// List Groups\n// -------------------------\n.list-group-item-variant(@state; @background; @color) {\n  .list-group-item-@{state} {\n    color: @color;\n    background-color: @background;\n\n    a& {\n      color: @color;\n\n      .list-group-item-heading { color: inherit; }\n\n      &:hover,\n      &:focus {\n        color: @color;\n        background-color: darken(@background, 5%);\n      }\n      &.active,\n      &.active:hover,\n      &.active:focus {\n        color: #fff;\n        background-color: @color;\n        border-color: @color;\n      }\n    }\n  }\n}\n\n// Button variants\n// -------------------------\n// Easily pump out default styles, as well as :hover, :focus, :active,\n// and disabled options for all buttons\n.button-variant(@color; @background; @border) {\n  color: @color;\n  background-color: @background;\n  border-color: @border;\n\n  &:hover,\n  &:focus,\n  &:active,\n  &.active,\n  .open .dropdown-toggle& {\n    color: @color;\n    background-color: darken(@background, 8%);\n        border-color: darken(@border, 12%);\n  }\n  &:active,\n  &.active,\n  .open .dropdown-toggle& {\n    background-image: none;\n  }\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    &,\n    &:hover,\n    &:focus,\n    &:active,\n    &.active {\n      background-color: @background;\n          border-color: @border;\n    }\n  }\n\n  .badge {\n    color: @background;\n    background-color: @color;\n  }\n}\n\n// Button sizes\n// -------------------------\n.button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  padding: @padding-vertical @padding-horizontal;\n  font-size: @font-size;\n  line-height: @line-height;\n  border-radius: @border-radius;\n}\n\n// Pagination\n// -------------------------\n.pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {\n  > li {\n    > a,\n    > span {\n      padding: @padding-vertical @padding-horizontal;\n      font-size: @font-size;\n    }\n    &:first-child {\n      > a,\n      > span {\n        .border-left-radius(@border-radius);\n      }\n    }\n    &:last-child {\n      > a,\n      > span {\n        .border-right-radius(@border-radius);\n      }\n    }\n  }\n}\n\n// Labels\n// -------------------------\n.label-variant(@color) {\n  background-color: @color;\n  &[href] {\n    &:hover,\n    &:focus {\n      background-color: darken(@color, 10%);\n    }\n  }\n}\n\n// Contextual backgrounds\n// -------------------------\n.bg-variant(@color) {\n  background-color: @color;\n  a&:hover {\n    background-color: darken(@color, 10%);\n  }\n}\n\n// Typography\n// -------------------------\n.text-emphasis-variant(@color) {\n  color: @color;\n  a&:hover {\n    color: darken(@color, 10%);\n  }\n}\n\n// Navbar vertical align\n// -------------------------\n// Vertically center elements in the navbar.\n// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.\n.navbar-vertical-align(@element-height) {\n  margin-top: ((@navbar-height - @element-height) / 2);\n  margin-bottom: ((@navbar-height - @element-height) / 2);\n}\n\n// Progress bars\n// -------------------------\n.progress-bar-variant(@color) {\n  background-color: @color;\n  .progress-striped & {\n    #gradient > .striped();\n  }\n}\n\n// Responsive utilities\n// -------------------------\n// More easily include all the states for responsive-utilities.less.\n.responsive-visibility() {\n  display: block !important;\n  table&  { display: table; }\n  tr&     { display: table-row !important; }\n  th&,\n  td&     { display: table-cell !important; }\n}\n\n.responsive-invisibility() {\n  display: none !important;\n}\n\n\n// Grid System\n// -----------\n\n// Centered container element\n.container-fixed() {\n  margin-right: auto;\n  margin-left: auto;\n  padding-left:  (@grid-gutter-width / 2);\n  padding-right: (@grid-gutter-width / 2);\n  &:extend(.clearfix all);\n}\n\n// Creates a wrapper for a series of columns\n.make-row(@gutter: @grid-gutter-width) {\n  margin-left:  (@gutter / -2);\n  margin-right: (@gutter / -2);\n  &:extend(.clearfix all);\n}\n\n// Generate the extra small columns\n.make-xs-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  float: left;\n  width: percentage((@columns / @grid-columns));\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n}\n.make-xs-column-offset(@columns) {\n  @media (min-width: @screen-xs-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-xs-column-push(@columns) {\n  @media (min-width: @screen-xs-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-xs-column-pull(@columns) {\n  @media (min-width: @screen-xs-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Generate the small columns\n.make-sm-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-sm-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-offset(@columns) {\n  @media (min-width: @screen-sm-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-push(@columns) {\n  @media (min-width: @screen-sm-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-sm-column-pull(@columns) {\n  @media (min-width: @screen-sm-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Generate the medium columns\n.make-md-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-md-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-offset(@columns) {\n  @media (min-width: @screen-md-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-push(@columns) {\n  @media (min-width: @screen-md-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-md-column-pull(@columns) {\n  @media (min-width: @screen-md-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Generate the large columns\n.make-lg-column(@columns; @gutter: @grid-gutter-width) {\n  position: relative;\n  min-height: 1px;\n  padding-left:  (@gutter / 2);\n  padding-right: (@gutter / 2);\n\n  @media (min-width: @screen-lg-min) {\n    float: left;\n    width: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-offset(@columns) {\n  @media (min-width: @screen-lg-min) {\n    margin-left: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-push(@columns) {\n  @media (min-width: @screen-lg-min) {\n    left: percentage((@columns / @grid-columns));\n  }\n}\n.make-lg-column-pull(@columns) {\n  @media (min-width: @screen-lg-min) {\n    right: percentage((@columns / @grid-columns));\n  }\n}\n\n\n// Framework grid generation\n//\n// Used only by Bootstrap to generate the correct number of grid classes given\n// any value of `@grid-columns`.\n\n.make-grid-columns() {\n  // Common styles for all sizes of grid columns, widths 1-12\n  .col(@index) when (@index = 1) { // initial\n    @item: ~\".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}\";\n    .col((@index + 1), @item);\n  }\n  .col(@index, @list) when (@index =< @grid-columns) { // general; \"=<\" isn't a typo\n    @item: ~\".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}\";\n    .col((@index + 1), ~\"@{list}, @{item}\");\n  }\n  .col(@index, @list) when (@index > @grid-columns) { // terminal\n    @{list} {\n      position: relative;\n      // Prevent columns from collapsing when empty\n      min-height: 1px;\n      // Inner gutter via padding\n      padding-left:  (@grid-gutter-width / 2);\n      padding-right: (@grid-gutter-width / 2);\n    }\n  }\n  .col(1); // kickstart it\n}\n\n.float-grid-columns(@class) {\n  .col(@index) when (@index = 1) { // initial\n    @item: ~\".col-@{class}-@{index}\";\n    .col((@index + 1), @item);\n  }\n  .col(@index, @list) when (@index =< @grid-columns) { // general\n    @item: ~\".col-@{class}-@{index}\";\n    .col((@index + 1), ~\"@{list}, @{item}\");\n  }\n  .col(@index, @list) when (@index > @grid-columns) { // terminal\n    @{list} {\n      float: left;\n    }\n  }\n  .col(1); // kickstart it\n}\n\n.calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {\n  .col-@{class}-@{index} {\n    width: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = push) {\n  .col-@{class}-push-@{index} {\n    left: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = pull) {\n  .col-@{class}-pull-@{index} {\n    right: percentage((@index / @grid-columns));\n  }\n}\n.calc-grid-column(@index, @class, @type) when (@type = offset) {\n  .col-@{class}-offset-@{index} {\n    margin-left: percentage((@index / @grid-columns));\n  }\n}\n\n// Basic looping in LESS\n.loop-grid-columns(@index, @class, @type) when (@index >= 0) {\n  .calc-grid-column(@index, @class, @type);\n  // next iteration\n  .loop-grid-columns((@index - 1), @class, @type);\n}\n\n// Create grid for specific class\n.make-grid(@class) {\n  .float-grid-columns(@class);\n  .loop-grid-columns(@grid-columns, @class, width);\n  .loop-grid-columns(@grid-columns, @class, pull);\n  .loop-grid-columns(@grid-columns, @class, push);\n  .loop-grid-columns(@grid-columns, @class, offset);\n}\n\n// Form validation states\n//\n// Used in forms.less to generate the form validation CSS for warnings, errors,\n// and successes.\n\n.form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {\n  // Color the label and help text\n  .help-block,\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline  {\n    color: @text-color;\n  }\n  // Set the border and box shadow on specific inputs to match\n  .form-control {\n    border-color: @border-color;\n    .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work\n    &:focus {\n      border-color: darken(@border-color, 10%);\n      @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);\n      .box-shadow(@shadow);\n    }\n  }\n  // Set validation states also for addons\n  .input-group-addon {\n    color: @text-color;\n    border-color: @border-color;\n    background-color: @background-color;\n  }\n  // Optional feedback icon\n  .form-control-feedback {\n    color: @text-color;\n  }\n}\n\n// Form control focus state\n//\n// Generate a customized focus state and for any input with the specified color,\n// which defaults to the `@input-focus-border` variable.\n//\n// We highly encourage you to not customize the default value, but instead use\n// this to tweak colors on an as-needed basis. This aesthetic change is based on\n// WebKit's default styles, but applicable to a wider range of browsers. Its\n// usability and accessibility should be taken into account with any change.\n//\n// Example usage: change the default blue border and shadow to white for better\n// contrast against a dark gray background.\n\n.form-control-focus(@color: @input-border-focus) {\n  @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);\n  &:focus {\n    border-color: @color;\n    outline: 0;\n    .box-shadow(~\"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}\");\n  }\n}\n\n// Form control sizing\n//\n// Relative text size, padding, and border-radii changes for form controls. For\n// horizontal sizing, wrap controls in the predefined grid classes. `<select>`\n// element gets special love because it's special, and that's a fact!\n\n.input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {\n  height: @input-height;\n  padding: @padding-vertical @padding-horizontal;\n  font-size: @font-size;\n  line-height: @line-height;\n  border-radius: @border-radius;\n\n  select& {\n    height: @input-height;\n    line-height: @input-height;\n  }\n\n  textarea&,\n  select[multiple]& {\n    height: auto;\n  }\n}\n","//\n// Variables\n// --------------------------------------------------\n\n\n//== Colors\n//\n//## Gray and brand colors for use across Bootstrap.\n\n@gray-darker:            lighten(#000, 13.5%); // #222\n@gray-dark:              lighten(#000, 20%);   // #333\n@gray:                   lighten(#000, 33.5%); // #555\n@gray-light:             lighten(#000, 60%);   // #999\n@gray-lighter:           lighten(#000, 93.5%); // #eee\n\n@brand-primary:         #428bca;\n@brand-success:         #5cb85c;\n@brand-info:            #5bc0de;\n@brand-warning:         #f0ad4e;\n@brand-danger:          #d9534f;\n\n\n//== Scaffolding\n//\n// ## Settings for some of the most global styles.\n\n//** Background color for `<body>`.\n@body-bg:               #fff;\n//** Global text color on `<body>`.\n@text-color:            @gray-dark;\n\n//** Global textual link color.\n@link-color:            @brand-primary;\n//** Link hover color set via `darken()` function.\n@link-hover-color:      darken(@link-color, 15%);\n\n\n//== Typography\n//\n//## Font, line-height, and color for body text, headings, and more.\n\n@font-family-sans-serif:  \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n@font-family-serif:       Georgia, \"Times New Roman\", Times, serif;\n//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.\n@font-family-monospace:   Menlo, Monaco, Consolas, \"Courier New\", monospace;\n@font-family-base:        @font-family-sans-serif;\n\n@font-size-base:          14px;\n@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px\n@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px\n\n@font-size-h1:            floor((@font-size-base * 2.6)); // ~36px\n@font-size-h2:            floor((@font-size-base * 2.15)); // ~30px\n@font-size-h3:            ceil((@font-size-base * 1.7)); // ~24px\n@font-size-h4:            ceil((@font-size-base * 1.25)); // ~18px\n@font-size-h5:            @font-size-base;\n@font-size-h6:            ceil((@font-size-base * 0.85)); // ~12px\n\n//** Unit-less `line-height` for use in components like buttons.\n@line-height-base:        1.428571429; // 20/14\n//** Computed \"line-height\" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.\n@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px\n\n//** By default, this inherits from the `<body>`.\n@headings-font-family:    inherit;\n@headings-font-weight:    500;\n@headings-line-height:    1.1;\n@headings-color:          inherit;\n\n\n//-- Iconography\n//\n//## Specify custom locations of the include Glyphicons icon font. Useful for those including Bootstrap via Bower.\n\n@icon-font-path:          \"../fonts/\";\n@icon-font-name:          \"glyphicons-halflings-regular\";\n@icon-font-svg-id:        \"glyphicons_halflingsregular\";\n\n//== Components\n//\n//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).\n\n@padding-base-vertical:     6px;\n@padding-base-horizontal:   12px;\n\n@padding-large-vertical:    10px;\n@padding-large-horizontal:  16px;\n\n@padding-small-vertical:    5px;\n@padding-small-horizontal:  10px;\n\n@padding-xs-vertical:       1px;\n@padding-xs-horizontal:     5px;\n\n@line-height-large:         1.33;\n@line-height-small:         1.5;\n\n@border-radius-base:        4px;\n@border-radius-large:       6px;\n@border-radius-small:       3px;\n\n//** Global color for active items (e.g., navs or dropdowns).\n@component-active-color:    #fff;\n//** Global background color for active items (e.g., navs or dropdowns).\n@component-active-bg:       @brand-primary;\n\n//** Width of the `border` for generating carets that indicator dropdowns.\n@caret-width-base:          4px;\n//** Carets increase slightly in size for larger components.\n@caret-width-large:         5px;\n\n\n//== Tables\n//\n//## Customizes the `.table` component with basic values, each used across all table variations.\n\n//** Padding for `<th>`s and `<td>`s.\n@table-cell-padding:            8px;\n//** Padding for cells in `.table-condensed`.\n@table-condensed-cell-padding:  5px;\n\n//** Default background color used for all tables.\n@table-bg:                      transparent;\n//** Background color used for `.table-striped`.\n@table-bg-accent:               #f9f9f9;\n//** Background color used for `.table-hover`.\n@table-bg-hover:                #f5f5f5;\n@table-bg-active:               @table-bg-hover;\n\n//** Border color for table and cell borders.\n@table-border-color:            #ddd;\n\n\n//== Buttons\n//\n//## For each of Bootstrap's buttons, define text, background and border color.\n\n@btn-font-weight:                normal;\n\n@btn-default-color:              #333;\n@btn-default-bg:                 #fff;\n@btn-default-border:             #ccc;\n\n@btn-primary-color:              #fff;\n@btn-primary-bg:                 @brand-primary;\n@btn-primary-border:             darken(@btn-primary-bg, 5%);\n\n@btn-success-color:              #fff;\n@btn-success-bg:                 @brand-success;\n@btn-success-border:             darken(@btn-success-bg, 5%);\n\n@btn-info-color:                 #fff;\n@btn-info-bg:                    @brand-info;\n@btn-info-border:                darken(@btn-info-bg, 5%);\n\n@btn-warning-color:              #fff;\n@btn-warning-bg:                 @brand-warning;\n@btn-warning-border:             darken(@btn-warning-bg, 5%);\n\n@btn-danger-color:               #fff;\n@btn-danger-bg:                  @brand-danger;\n@btn-danger-border:              darken(@btn-danger-bg, 5%);\n\n@btn-link-disabled-color:        @gray-light;\n\n\n//== Forms\n//\n//##\n\n//** `<input>` background color\n@input-bg:                       #fff;\n//** `<input disabled>` background color\n@input-bg-disabled:              @gray-lighter;\n\n//** Text color for `<input>`s\n@input-color:                    @gray;\n//** `<input>` border color\n@input-border:                   #ccc;\n//** `<input>` border radius\n@input-border-radius:            @border-radius-base;\n//** Border color for inputs on focus\n@input-border-focus:             #66afe9;\n\n//** Placeholder text color\n@input-color-placeholder:        @gray-light;\n\n//** Default `.form-control` height\n@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);\n//** Large `.form-control` height\n@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);\n//** Small `.form-control` height\n@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);\n\n@legend-color:                   @gray-dark;\n@legend-border-color:            #e5e5e5;\n\n//** Background color for textual input addons\n@input-group-addon-bg:           @gray-lighter;\n//** Border color for textual input addons\n@input-group-addon-border-color: @input-border;\n\n\n//== Dropdowns\n//\n//## Dropdown menu container and contents.\n\n//** Background for the dropdown menu.\n@dropdown-bg:                    #fff;\n//** Dropdown menu `border-color`.\n@dropdown-border:                rgba(0,0,0,.15);\n//** Dropdown menu `border-color` **for IE8**.\n@dropdown-fallback-border:       #ccc;\n//** Divider color for between dropdown items.\n@dropdown-divider-bg:            #e5e5e5;\n\n//** Dropdown link text color.\n@dropdown-link-color:            @gray-dark;\n//** Hover color for dropdown links.\n@dropdown-link-hover-color:      darken(@gray-dark, 5%);\n//** Hover background for dropdown links.\n@dropdown-link-hover-bg:         #f5f5f5;\n\n//** Active dropdown menu item text color.\n@dropdown-link-active-color:     @component-active-color;\n//** Active dropdown menu item background color.\n@dropdown-link-active-bg:        @component-active-bg;\n\n//** Disabled dropdown menu item background color.\n@dropdown-link-disabled-color:   @gray-light;\n\n//** Text color for headers within dropdown menus.\n@dropdown-header-color:          @gray-light;\n\n// Note: Deprecated @dropdown-caret-color as of v3.1.0\n@dropdown-caret-color:           #000;\n\n\n//-- Z-index master list\n//\n// Warning: Avoid customizing these values. They're used for a bird's eye view\n// of components dependent on the z-axis and are designed to all work together.\n//\n// Note: These variables are not generated into the Customizer.\n\n@zindex-navbar:            1000;\n@zindex-dropdown:          1000;\n@zindex-popover:           1010;\n@zindex-tooltip:           1030;\n@zindex-navbar-fixed:      1030;\n@zindex-modal-background:  1040;\n@zindex-modal:             1050;\n\n\n//== Media queries breakpoints\n//\n//## Define the breakpoints at which your layout will change, adapting to different screen sizes.\n\n// Extra small screen / phone\n// Note: Deprecated @screen-xs and @screen-phone as of v3.0.1\n@screen-xs:                  480px;\n@screen-xs-min:              @screen-xs;\n@screen-phone:               @screen-xs-min;\n\n// Small screen / tablet\n// Note: Deprecated @screen-sm and @screen-tablet as of v3.0.1\n@screen-sm:                  768px;\n@screen-sm-min:              @screen-sm;\n@screen-tablet:              @screen-sm-min;\n\n// Medium screen / desktop\n// Note: Deprecated @screen-md and @screen-desktop as of v3.0.1\n@screen-md:                  992px;\n@screen-md-min:              @screen-md;\n@screen-desktop:             @screen-md-min;\n\n// Large screen / wide desktop\n// Note: Deprecated @screen-lg and @screen-lg-desktop as of v3.0.1\n@screen-lg:                  1200px;\n@screen-lg-min:              @screen-lg;\n@screen-lg-desktop:          @screen-lg-min;\n\n// So media queries don't overlap when required, provide a maximum\n@screen-xs-max:              (@screen-sm-min - 1);\n@screen-sm-max:              (@screen-md-min - 1);\n@screen-md-max:              (@screen-lg-min - 1);\n\n\n//== Grid system\n//\n//## Define your custom responsive grid.\n\n//** Number of columns in the grid.\n@grid-columns:              12;\n//** Padding between columns. Gets divided in half for the left and right.\n@grid-gutter-width:         30px;\n// Navbar collapse\n//** Point at which the navbar becomes uncollapsed.\n@grid-float-breakpoint:     @screen-sm-min;\n//** Point at which the navbar begins collapsing.\n@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);\n\n\n//== Container sizes\n//\n//## Define the maximum width of `.container` for different screen sizes.\n\n// Small screen / tablet\n@container-tablet:             ((720px + @grid-gutter-width));\n//** For `@screen-sm-min` and up.\n@container-sm:                 @container-tablet;\n\n// Medium screen / desktop\n@container-desktop:            ((940px + @grid-gutter-width));\n//** For `@screen-md-min` and up.\n@container-md:                 @container-desktop;\n\n// Large screen / wide desktop\n@container-large-desktop:      ((1140px + @grid-gutter-width));\n//** For `@screen-lg-min` and up.\n@container-lg:                 @container-large-desktop;\n\n\n//== Navbar\n//\n//##\n\n// Basics of a navbar\n@navbar-height:                    50px;\n@navbar-margin-bottom:             @line-height-computed;\n@navbar-border-radius:             @border-radius-base;\n@navbar-padding-horizontal:        floor((@grid-gutter-width / 2));\n@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);\n@navbar-collapse-max-height:       340px;\n\n@navbar-default-color:             #777;\n@navbar-default-bg:                #f8f8f8;\n@navbar-default-border:            darken(@navbar-default-bg, 6.5%);\n\n// Navbar links\n@navbar-default-link-color:                #777;\n@navbar-default-link-hover-color:          #333;\n@navbar-default-link-hover-bg:             transparent;\n@navbar-default-link-active-color:         #555;\n@navbar-default-link-active-bg:            darken(@navbar-default-bg, 6.5%);\n@navbar-default-link-disabled-color:       #ccc;\n@navbar-default-link-disabled-bg:          transparent;\n\n// Navbar brand label\n@navbar-default-brand-color:               @navbar-default-link-color;\n@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);\n@navbar-default-brand-hover-bg:            transparent;\n\n// Navbar toggle\n@navbar-default-toggle-hover-bg:           #ddd;\n@navbar-default-toggle-icon-bar-bg:        #888;\n@navbar-default-toggle-border-color:       #ddd;\n\n\n// Inverted navbar\n// Reset inverted navbar basics\n@navbar-inverse-color:                      @gray-light;\n@navbar-inverse-bg:                         #222;\n@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);\n\n// Inverted navbar links\n@navbar-inverse-link-color:                 @gray-light;\n@navbar-inverse-link-hover-color:           #fff;\n@navbar-inverse-link-hover-bg:              transparent;\n@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;\n@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);\n@navbar-inverse-link-disabled-color:        #444;\n@navbar-inverse-link-disabled-bg:           transparent;\n\n// Inverted navbar brand label\n@navbar-inverse-brand-color:                @navbar-inverse-link-color;\n@navbar-inverse-brand-hover-color:          #fff;\n@navbar-inverse-brand-hover-bg:             transparent;\n\n// Inverted navbar toggle\n@navbar-inverse-toggle-hover-bg:            #333;\n@navbar-inverse-toggle-icon-bar-bg:         #fff;\n@navbar-inverse-toggle-border-color:        #333;\n\n\n//== Navs\n//\n//##\n\n//=== Shared nav styles\n@nav-link-padding:                          10px 15px;\n@nav-link-hover-bg:                         @gray-lighter;\n\n@nav-disabled-link-color:                   @gray-light;\n@nav-disabled-link-hover-color:             @gray-light;\n\n@nav-open-link-hover-color:                 #fff;\n\n//== Tabs\n@nav-tabs-border-color:                     #ddd;\n\n@nav-tabs-link-hover-border-color:          @gray-lighter;\n\n@nav-tabs-active-link-hover-bg:             @body-bg;\n@nav-tabs-active-link-hover-color:          @gray;\n@nav-tabs-active-link-hover-border-color:   #ddd;\n\n@nav-tabs-justified-link-border-color:            #ddd;\n@nav-tabs-justified-active-link-border-color:     @body-bg;\n\n//== Pills\n@nav-pills-border-radius:                   @border-radius-base;\n@nav-pills-active-link-hover-bg:            @component-active-bg;\n@nav-pills-active-link-hover-color:         @component-active-color;\n\n\n//== Pagination\n//\n//##\n\n@pagination-color:                     @link-color;\n@pagination-bg:                        #fff;\n@pagination-border:                    #ddd;\n\n@pagination-hover-color:               @link-hover-color;\n@pagination-hover-bg:                  @gray-lighter;\n@pagination-hover-border:              #ddd;\n\n@pagination-active-color:              #fff;\n@pagination-active-bg:                 @brand-primary;\n@pagination-active-border:             @brand-primary;\n\n@pagination-disabled-color:            @gray-light;\n@pagination-disabled-bg:               #fff;\n@pagination-disabled-border:           #ddd;\n\n\n//== Pager\n//\n//##\n\n@pager-bg:                             @pagination-bg;\n@pager-border:                         @pagination-border;\n@pager-border-radius:                  15px;\n\n@pager-hover-bg:                       @pagination-hover-bg;\n\n@pager-active-bg:                      @pagination-active-bg;\n@pager-active-color:                   @pagination-active-color;\n\n@pager-disabled-color:                 @pagination-disabled-color;\n\n\n//== Jumbotron\n//\n//##\n\n@jumbotron-padding:              30px;\n@jumbotron-color:                inherit;\n@jumbotron-bg:                   @gray-lighter;\n@jumbotron-heading-color:        inherit;\n@jumbotron-font-size:            ceil((@font-size-base * 1.5));\n\n\n//== Form states and alerts\n//\n//## Define colors for form feedback states and, by default, alerts.\n\n@state-success-text:             #3c763d;\n@state-success-bg:               #dff0d8;\n@state-success-border:           darken(spin(@state-success-bg, -10), 5%);\n\n@state-info-text:                #31708f;\n@state-info-bg:                  #d9edf7;\n@state-info-border:              darken(spin(@state-info-bg, -10), 7%);\n\n@state-warning-text:             #8a6d3b;\n@state-warning-bg:               #fcf8e3;\n@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);\n\n@state-danger-text:              #a94442;\n@state-danger-bg:                #f2dede;\n@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);\n\n\n//== Tooltips\n//\n//##\n\n//** Tooltip max width\n@tooltip-max-width:           200px;\n//** Tooltip text color\n@tooltip-color:               #fff;\n//** Tooltip background color\n@tooltip-bg:                  #000;\n@tooltip-opacity:             .9;\n\n//** Tooltip arrow width\n@tooltip-arrow-width:         5px;\n//** Tooltip arrow color\n@tooltip-arrow-color:         @tooltip-bg;\n\n\n//== Popovers\n//\n//##\n\n//** Popover body background color\n@popover-bg:                          #fff;\n//** Popover maximum width\n@popover-max-width:                   276px;\n//** Popover border color\n@popover-border-color:                rgba(0,0,0,.2);\n//** Popover fallback border color\n@popover-fallback-border-color:       #ccc;\n\n//** Popover title background color\n@popover-title-bg:                    darken(@popover-bg, 3%);\n\n//** Popover arrow width\n@popover-arrow-width:                 10px;\n//** Popover arrow color\n@popover-arrow-color:                 #fff;\n\n//** Popover outer arrow width\n@popover-arrow-outer-width:           (@popover-arrow-width + 1);\n//** Popover outer arrow color\n@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);\n//** Popover outer arrow fallback color\n@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);\n\n\n//== Labels\n//\n//##\n\n//** Default label background color\n@label-default-bg:            @gray-light;\n//** Primary label background color\n@label-primary-bg:            @brand-primary;\n//** Success label background color\n@label-success-bg:            @brand-success;\n//** Info label background color\n@label-info-bg:               @brand-info;\n//** Warning label background color\n@label-warning-bg:            @brand-warning;\n//** Danger label background color\n@label-danger-bg:             @brand-danger;\n\n//** Default label text color\n@label-color:                 #fff;\n//** Default text color of a linked label\n@label-link-hover-color:      #fff;\n\n\n//== Modals\n//\n//##\n\n//** Padding applied to the modal body\n@modal-inner-padding:         20px;\n\n//** Padding applied to the modal title\n@modal-title-padding:         15px;\n//** Modal title line-height\n@modal-title-line-height:     @line-height-base;\n\n//** Background color of modal content area\n@modal-content-bg:                             #fff;\n//** Modal content border color\n@modal-content-border-color:                   rgba(0,0,0,.2);\n//** Modal content border color **for IE8**\n@modal-content-fallback-border-color:          #999;\n\n//** Modal backdrop background color\n@modal-backdrop-bg:           #000;\n//** Modal backdrop opacity\n@modal-backdrop-opacity:      .5;\n//** Modal header border color\n@modal-header-border-color:   #e5e5e5;\n//** Modal footer border color\n@modal-footer-border-color:   @modal-header-border-color;\n\n@modal-lg:                    900px;\n@modal-md:                    600px;\n@modal-sm:                    300px;\n\n\n//== Alerts\n//\n//## Define alert colors, border radius, and padding.\n\n@alert-padding:               15px;\n@alert-border-radius:         @border-radius-base;\n@alert-link-font-weight:      bold;\n\n@alert-success-bg:            @state-success-bg;\n@alert-success-text:          @state-success-text;\n@alert-success-border:        @state-success-border;\n\n@alert-info-bg:               @state-info-bg;\n@alert-info-text:             @state-info-text;\n@alert-info-border:           @state-info-border;\n\n@alert-warning-bg:            @state-warning-bg;\n@alert-warning-text:          @state-warning-text;\n@alert-warning-border:        @state-warning-border;\n\n@alert-danger-bg:             @state-danger-bg;\n@alert-danger-text:           @state-danger-text;\n@alert-danger-border:         @state-danger-border;\n\n\n//== Progress bars\n//\n//##\n\n//** Background color of the whole progress component\n@progress-bg:                 #f5f5f5;\n//** Progress bar text color\n@progress-bar-color:          #fff;\n\n//** Default progress bar color\n@progress-bar-bg:             @brand-primary;\n//** Success progress bar color\n@progress-bar-success-bg:     @brand-success;\n//** Warning progress bar color\n@progress-bar-warning-bg:     @brand-warning;\n//** Danger progress bar color\n@progress-bar-danger-bg:      @brand-danger;\n//** Info progress bar color\n@progress-bar-info-bg:        @brand-info;\n\n\n//== List group\n//\n//##\n\n//** Background color on `.list-group-item`\n@list-group-bg:                 #fff;\n//** `.list-group-item` border color\n@list-group-border:             #ddd;\n//** List group border radius\n@list-group-border-radius:      @border-radius-base;\n\n//** Background color of single list elements on hover\n@list-group-hover-bg:           #f5f5f5;\n//** Text color of active list elements\n@list-group-active-color:       @component-active-color;\n//** Background color of active list elements\n@list-group-active-bg:          @component-active-bg;\n//** Border color of active list elements\n@list-group-active-border:      @list-group-active-bg;\n@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);\n\n@list-group-link-color:         #555;\n@list-group-link-heading-color: #333;\n\n\n//== Panels\n//\n//##\n\n@panel-bg:                    #fff;\n@panel-body-padding:          15px;\n@panel-border-radius:         @border-radius-base;\n\n//** Border color for elements within panels\n@panel-inner-border:          #ddd;\n@panel-footer-bg:             #f5f5f5;\n\n@panel-default-text:          @gray-dark;\n@panel-default-border:        #ddd;\n@panel-default-heading-bg:    #f5f5f5;\n\n@panel-primary-text:          #fff;\n@panel-primary-border:        @brand-primary;\n@panel-primary-heading-bg:    @brand-primary;\n\n@panel-success-text:          @state-success-text;\n@panel-success-border:        @state-success-border;\n@panel-success-heading-bg:    @state-success-bg;\n\n@panel-info-text:             @state-info-text;\n@panel-info-border:           @state-info-border;\n@panel-info-heading-bg:       @state-info-bg;\n\n@panel-warning-text:          @state-warning-text;\n@panel-warning-border:        @state-warning-border;\n@panel-warning-heading-bg:    @state-warning-bg;\n\n@panel-danger-text:           @state-danger-text;\n@panel-danger-border:         @state-danger-border;\n@panel-danger-heading-bg:     @state-danger-bg;\n\n\n//== Thumbnails\n//\n//##\n\n//** Padding around the thumbnail image\n@thumbnail-padding:           4px;\n//** Thumbnail background color\n@thumbnail-bg:                @body-bg;\n//** Thumbnail border color\n@thumbnail-border:            #ddd;\n//** Thumbnail border radius\n@thumbnail-border-radius:     @border-radius-base;\n\n//** Custom text color for thumbnail captions\n@thumbnail-caption-color:     @text-color;\n//** Padding around the thumbnail caption\n@thumbnail-caption-padding:   9px;\n\n\n//== Wells\n//\n//##\n\n@well-bg:                     #f5f5f5;\n@well-border:                 darken(@well-bg, 7%);\n\n\n//== Badges\n//\n//##\n\n@badge-color:                 #fff;\n//** Linked badge text color on hover\n@badge-link-hover-color:      #fff;\n@badge-bg:                    @gray-light;\n\n//** Badge text color in active nav link\n@badge-active-color:          @link-color;\n//** Badge background color in active nav link\n@badge-active-bg:             #fff;\n\n@badge-font-weight:           bold;\n@badge-line-height:           1;\n@badge-border-radius:         10px;\n\n\n//== Breadcrumbs\n//\n//##\n\n@breadcrumb-padding-vertical:   8px;\n@breadcrumb-padding-horizontal: 15px;\n//** Breadcrumb background color\n@breadcrumb-bg:                 #f5f5f5;\n//** Breadcrumb text color\n@breadcrumb-color:              #ccc;\n//** Text color of current page in the breadcrumb\n@breadcrumb-active-color:       @gray-light;\n//** Textual separator for between breadcrumb elements\n@breadcrumb-separator:          \"/\";\n\n\n//== Carousel\n//\n//##\n\n@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);\n\n@carousel-control-color:                      #fff;\n@carousel-control-width:                      15%;\n@carousel-control-opacity:                    .5;\n@carousel-control-font-size:                  20px;\n\n@carousel-indicator-active-bg:                #fff;\n@carousel-indicator-border-color:             #fff;\n\n@carousel-caption-color:                      #fff;\n\n\n//== Close\n//\n//##\n\n@close-font-weight:           bold;\n@close-color:                 #000;\n@close-text-shadow:           0 1px 0 #fff;\n\n\n//== Code\n//\n//##\n\n@code-color:                  #c7254e;\n@code-bg:                     #f9f2f4;\n\n@kbd-color:                   #fff;\n@kbd-bg:                      #333;\n\n@pre-bg:                      #f5f5f5;\n@pre-color:                   @gray-dark;\n@pre-border-color:            #ccc;\n@pre-scrollable-max-height:   340px;\n\n\n//== Type\n//\n//##\n\n//** Text muted color\n@text-muted:                  @gray-light;\n//** Abbreviations and acronyms border color\n@abbr-border-color:           @gray-light;\n//** Headings small color\n@headings-small-color:        @gray-light;\n//** Blockquote small color\n@blockquote-small-color:      @gray-light;\n//** Blockquote font size\n@blockquote-font-size:        (@font-size-base * 1.25);\n//** Blockquote border color\n@blockquote-border-color:     @gray-lighter;\n//** Page header border color\n@page-header-border-color:    @gray-lighter;\n\n\n//== Miscellaneous\n//\n//##\n\n//** Horizontal line color.\n@hr-border:                   @gray-lighter;\n\n//** Horizontal offset for forms and lists.\n@component-offset-horizontal: 180px;\n","//\n// Thumbnails\n// --------------------------------------------------\n\n\n// Mixin and adjust the regular image class\n.thumbnail {\n  display: block;\n  padding: @thumbnail-padding;\n  margin-bottom: @line-height-computed;\n  line-height: @line-height-base;\n  background-color: @thumbnail-bg;\n  border: 1px solid @thumbnail-border;\n  border-radius: @thumbnail-border-radius;\n  .transition(all .2s ease-in-out);\n\n  > img,\n  a > img {\n    &:extend(.img-responsive);\n    margin-left: auto;\n    margin-right: auto;\n  }\n\n  // Add a hover state for linked versions only\n  a&:hover,\n  a&:focus,\n  a&.active {\n    border-color: @link-color;\n  }\n\n  // Image captions\n  .caption {\n    padding: @thumbnail-caption-padding;\n    color: @thumbnail-caption-color;\n  }\n}\n","//\n// Carousel\n// --------------------------------------------------\n\n\n// Wrapper for the slide container and indicators\n.carousel {\n  position: relative;\n}\n\n.carousel-inner {\n  position: relative;\n  overflow: hidden;\n  width: 100%;\n\n  > .item {\n    display: none;\n    position: relative;\n    .transition(.6s ease-in-out left);\n\n    // Account for jankitude on images\n    > img,\n    > a > img {\n      &:extend(.img-responsive);\n      line-height: 1;\n    }\n  }\n\n  > .active,\n  > .next,\n  > .prev { display: block; }\n\n  > .active {\n    left: 0;\n  }\n\n  > .next,\n  > .prev {\n    position: absolute;\n    top: 0;\n    width: 100%;\n  }\n\n  > .next {\n    left: 100%;\n  }\n  > .prev {\n    left: -100%;\n  }\n  > .next.left,\n  > .prev.right {\n    left: 0;\n  }\n\n  > .active.left {\n    left: -100%;\n  }\n  > .active.right {\n    left: 100%;\n  }\n\n}\n\n// Left/right controls for nav\n// ---------------------------\n\n.carousel-control {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  width: @carousel-control-width;\n  .opacity(@carousel-control-opacity);\n  font-size: @carousel-control-font-size;\n  color: @carousel-control-color;\n  text-align: center;\n  text-shadow: @carousel-text-shadow;\n  // We can't have this transition here because WebKit cancels the carousel\n  // animation if you trip this while in the middle of another animation.\n\n  // Set gradients for backgrounds\n  &.left {\n    #gradient > .horizontal(@start-color: rgba(0,0,0,.5); @end-color: rgba(0,0,0,.0001));\n  }\n  &.right {\n    left: auto;\n    right: 0;\n    #gradient > .horizontal(@start-color: rgba(0,0,0,.0001); @end-color: rgba(0,0,0,.5));\n  }\n\n  // Hover/focus state\n  &:hover,\n  &:focus {\n    outline: none;\n    color: @carousel-control-color;\n    text-decoration: none;\n    .opacity(.9);\n  }\n\n  // Toggles\n  .icon-prev,\n  .icon-next,\n  .glyphicon-chevron-left,\n  .glyphicon-chevron-right {\n    position: absolute;\n    top: 50%;\n    z-index: 5;\n    display: inline-block;\n  }\n  .icon-prev,\n  .glyphicon-chevron-left {\n    left: 50%;\n  }\n  .icon-next,\n  .glyphicon-chevron-right {\n    right: 50%;\n  }\n  .icon-prev,\n  .icon-next {\n    width:  20px;\n    height: 20px;\n    margin-top: -10px;\n    margin-left: -10px;\n    font-family: serif;\n  }\n\n  .icon-prev {\n    &:before {\n      content: '\\2039';// SINGLE LEFT-POINTING ANGLE QUOTATION MARK (U+2039)\n    }\n  }\n  .icon-next {\n    &:before {\n      content: '\\203a';// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (U+203A)\n    }\n  }\n}\n\n// Optional indicator pips\n//\n// Add an unordered list with the following class and add a list item for each\n// slide your carousel holds.\n\n.carousel-indicators {\n  position: absolute;\n  bottom: 10px;\n  left: 50%;\n  z-index: 15;\n  width: 60%;\n  margin-left: -30%;\n  padding-left: 0;\n  list-style: none;\n  text-align: center;\n\n  li {\n    display: inline-block;\n    width:  10px;\n    height: 10px;\n    margin: 1px;\n    text-indent: -999px;\n    border: 1px solid @carousel-indicator-border-color;\n    border-radius: 10px;\n    cursor: pointer;\n\n    // IE8-9 hack for event handling\n    //\n    // Internet Explorer 8-9 does not support clicks on elements without a set\n    // `background-color`. We cannot use `filter` since that's not viewed as a\n    // background color by the browser. Thus, a hack is needed.\n    //\n    // For IE8, we set solid black as it doesn't support `rgba()`. For IE9, we\n    // set alpha transparency for the best results possible.\n    background-color: #000 \\9; // IE8\n    background-color: rgba(0,0,0,0); // IE9\n  }\n  .active {\n    margin: 0;\n    width:  12px;\n    height: 12px;\n    background-color: @carousel-indicator-active-bg;\n  }\n}\n\n// Optional captions\n// -----------------------------\n// Hidden by default for smaller viewports\n.carousel-caption {\n  position: absolute;\n  left: 15%;\n  right: 15%;\n  bottom: 20px;\n  z-index: 10;\n  padding-top: 20px;\n  padding-bottom: 20px;\n  color: @carousel-caption-color;\n  text-align: center;\n  text-shadow: @carousel-text-shadow;\n  & .btn {\n    text-shadow: none; // No shadow for button elements in carousel-caption\n  }\n}\n\n\n// Scale up controls for tablets and up\n@media screen and (min-width: @screen-sm-min) {\n\n  // Scale up the controls a smidge\n  .carousel-control {\n    .glyphicon-chevron-left,\n    .glyphicon-chevron-right,\n    .icon-prev,\n    .icon-next {\n      width: 30px;\n      height: 30px;\n      margin-top: -15px;\n      margin-left: -15px;\n      font-size: 30px;\n    }\n  }\n\n  // Show and left align the captions\n  .carousel-caption {\n    left: 20%;\n    right: 20%;\n    padding-bottom: 30px;\n  }\n\n  // Move up the indicators\n  .carousel-indicators {\n    bottom: 20px;\n  }\n}\n","//\n// Typography\n// --------------------------------------------------\n\n\n// Headings\n// -------------------------\n\nh1, h2, h3, h4, h5, h6,\n.h1, .h2, .h3, .h4, .h5, .h6 {\n  font-family: @headings-font-family;\n  font-weight: @headings-font-weight;\n  line-height: @headings-line-height;\n  color: @headings-color;\n\n  small,\n  .small {\n    font-weight: normal;\n    line-height: 1;\n    color: @headings-small-color;\n  }\n}\n\nh1, .h1,\nh2, .h2,\nh3, .h3 {\n  margin-top: @line-height-computed;\n  margin-bottom: (@line-height-computed / 2);\n\n  small,\n  .small {\n    font-size: 65%;\n  }\n}\nh4, .h4,\nh5, .h5,\nh6, .h6 {\n  margin-top: (@line-height-computed / 2);\n  margin-bottom: (@line-height-computed / 2);\n\n  small,\n  .small {\n    font-size: 75%;\n  }\n}\n\nh1, .h1 { font-size: @font-size-h1; }\nh2, .h2 { font-size: @font-size-h2; }\nh3, .h3 { font-size: @font-size-h3; }\nh4, .h4 { font-size: @font-size-h4; }\nh5, .h5 { font-size: @font-size-h5; }\nh6, .h6 { font-size: @font-size-h6; }\n\n\n// Body text\n// -------------------------\n\np {\n  margin: 0 0 (@line-height-computed / 2);\n}\n\n.lead {\n  margin-bottom: @line-height-computed;\n  font-size: floor((@font-size-base * 1.15));\n  font-weight: 200;\n  line-height: 1.4;\n\n  @media (min-width: @screen-sm-min) {\n    font-size: (@font-size-base * 1.5);\n  }\n}\n\n\n// Emphasis & misc\n// -------------------------\n\n// Ex: 14px base font * 85% = about 12px\nsmall,\n.small  { font-size: 85%; }\n\n// Undo browser default styling\ncite    { font-style: normal; }\n\n// Alignment\n.text-left           { text-align: left; }\n.text-right          { text-align: right; }\n.text-center         { text-align: center; }\n.text-justify        { text-align: justify; }\n\n// Contextual colors\n.text-muted {\n  color: @text-muted;\n}\n.text-primary {\n  .text-emphasis-variant(@brand-primary);\n}\n.text-success {\n  .text-emphasis-variant(@state-success-text);\n}\n.text-info {\n  .text-emphasis-variant(@state-info-text);\n}\n.text-warning {\n  .text-emphasis-variant(@state-warning-text);\n}\n.text-danger {\n  .text-emphasis-variant(@state-danger-text);\n}\n\n// Contextual backgrounds\n// For now we'll leave these alongside the text classes until v4 when we can\n// safely shift things around (per SemVer rules).\n.bg-primary {\n  // Given the contrast here, this is the only class to have its color inverted\n  // automatically.\n  color: #fff;\n  .bg-variant(@brand-primary);\n}\n.bg-success {\n  .bg-variant(@state-success-bg);\n}\n.bg-info {\n  .bg-variant(@state-info-bg);\n}\n.bg-warning {\n  .bg-variant(@state-warning-bg);\n}\n.bg-danger {\n  .bg-variant(@state-danger-bg);\n}\n\n\n// Page header\n// -------------------------\n\n.page-header {\n  padding-bottom: ((@line-height-computed / 2) - 1);\n  margin: (@line-height-computed * 2) 0 @line-height-computed;\n  border-bottom: 1px solid @page-header-border-color;\n}\n\n\n// Lists\n// --------------------------------------------------\n\n// Unordered and Ordered lists\nul,\nol {\n  margin-top: 0;\n  margin-bottom: (@line-height-computed / 2);\n  ul,\n  ol {\n    margin-bottom: 0;\n  }\n}\n\n// List options\n\n// Unstyled keeps list items block level, just removes default browser padding and list-style\n.list-unstyled {\n  padding-left: 0;\n  list-style: none;\n}\n\n// Inline turns list items into inline-block\n.list-inline {\n  .list-unstyled();\n  margin-left: -5px;\n\n  > li {\n    display: inline-block;\n    padding-left: 5px;\n    padding-right: 5px;\n  }\n}\n\n// Description Lists\ndl {\n  margin-top: 0; // Remove browser default\n  margin-bottom: @line-height-computed;\n}\ndt,\ndd {\n  line-height: @line-height-base;\n}\ndt {\n  font-weight: bold;\n}\ndd {\n  margin-left: 0; // Undo browser default\n}\n\n// Horizontal description lists\n//\n// Defaults to being stacked without any of the below styles applied, until the\n// grid breakpoint is reached (default of ~768px).\n\n@media (min-width: @grid-float-breakpoint) {\n  .dl-horizontal {\n    dt {\n      float: left;\n      width: (@component-offset-horizontal - 20);\n      clear: left;\n      text-align: right;\n      .text-overflow();\n    }\n    dd {\n      margin-left: @component-offset-horizontal;\n      &:extend(.clearfix all); // Clear the floated `dt` if an empty `dd` is present\n    }\n  }\n}\n\n// MISC\n// ----\n\n// Abbreviations and acronyms\nabbr[title],\n// Add data-* attribute to help out our tooltip plugin, per https://github.com/twbs/bootstrap/issues/5257\nabbr[data-original-title] {\n  cursor: help;\n  border-bottom: 1px dotted @abbr-border-color;\n}\n.initialism {\n  font-size: 90%;\n  text-transform: uppercase;\n}\n\n// Blockquotes\nblockquote {\n  padding: (@line-height-computed / 2) @line-height-computed;\n  margin: 0 0 @line-height-computed;\n  font-size: @blockquote-font-size;\n  border-left: 5px solid @blockquote-border-color;\n\n  p,\n  ul,\n  ol {\n    &:last-child {\n      margin-bottom: 0;\n    }\n  }\n\n  // Note: Deprecated small and .small as of v3.1.0\n  // Context: https://github.com/twbs/bootstrap/issues/11660\n  footer,\n  small,\n  .small {\n    display: block;\n    font-size: 80%; // back to default font-size\n    line-height: @line-height-base;\n    color: @blockquote-small-color;\n\n    &:before {\n      content: '\\2014 \\00A0'; // em dash, nbsp\n    }\n  }\n}\n\n// Opposite alignment of blockquote\n//\n// Heads up: `blockquote.pull-right` has been deprecated as of v3.1.0.\n.blockquote-reverse,\nblockquote.pull-right {\n  padding-right: 15px;\n  padding-left: 0;\n  border-right: 5px solid @blockquote-border-color;\n  border-left: 0;\n  text-align: right;\n\n  // Account for citation\n  footer,\n  small,\n  .small {\n    &:before { content: ''; }\n    &:after {\n      content: '\\00A0 \\2014'; // nbsp, em dash\n    }\n  }\n}\n\n// Quotes\nblockquote:before,\nblockquote:after {\n  content: \"\";\n}\n\n// Addresses\naddress {\n  margin-bottom: @line-height-computed;\n  font-style: normal;\n  line-height: @line-height-base;\n}\n","//\n// Code (inline and block)\n// --------------------------------------------------\n\n\n// Inline and block code styles\ncode,\nkbd,\npre,\nsamp {\n  font-family: @font-family-monospace;\n}\n\n// Inline code\ncode {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: @code-color;\n  background-color: @code-bg;\n  white-space: nowrap;\n  border-radius: @border-radius-base;\n}\n\n// User input typically entered via keyboard\nkbd {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: @kbd-color;\n  background-color: @kbd-bg;\n  border-radius: @border-radius-small;\n  box-shadow: inset 0 -1px 0 rgba(0,0,0,.25);\n}\n\n// Blocks of code\npre {\n  display: block;\n  padding: ((@line-height-computed - 1) / 2);\n  margin: 0 0 (@line-height-computed / 2);\n  font-size: (@font-size-base - 1); // 14px to 13px\n  line-height: @line-height-base;\n  word-break: break-all;\n  word-wrap: break-word;\n  color: @pre-color;\n  background-color: @pre-bg;\n  border: 1px solid @pre-border-color;\n  border-radius: @border-radius-base;\n\n  // Account for some code outputs that place code tags in pre tags\n  code {\n    padding: 0;\n    font-size: inherit;\n    color: inherit;\n    white-space: pre-wrap;\n    background-color: transparent;\n    border-radius: 0;\n  }\n}\n\n// Enable scrollable blocks of code\n.pre-scrollable {\n  max-height: @pre-scrollable-max-height;\n  overflow-y: scroll;\n}\n","//\n// Grid system\n// --------------------------------------------------\n\n\n// Container widths\n//\n// Set the container width, and override it for fixed navbars in media queries.\n\n.container {\n  .container-fixed();\n\n  @media (min-width: @screen-sm-min) {\n    width: @container-sm;\n  }\n  @media (min-width: @screen-md-min) {\n    width: @container-md;\n  }\n  @media (min-width: @screen-lg-min) {\n    width: @container-lg;\n  }\n}\n\n\n// Fluid container\n//\n// Utilizes the mixin meant for fixed width containers, but without any defined\n// width for fluid, full width layouts.\n\n.container-fluid {\n  .container-fixed();\n}\n\n\n// Row\n//\n// Rows contain and clear the floats of your columns.\n\n.row {\n  .make-row();\n}\n\n\n// Columns\n//\n// Common styles for small and large grid columns\n\n.make-grid-columns();\n\n\n// Extra small grid\n//\n// Columns, offsets, pushes, and pulls for extra small devices like\n// smartphones.\n\n.make-grid(xs);\n\n\n// Small grid\n//\n// Columns, offsets, pushes, and pulls for the small device range, from phones\n// to tablets.\n\n@media (min-width: @screen-sm-min) {\n  .make-grid(sm);\n}\n\n\n// Medium grid\n//\n// Columns, offsets, pushes, and pulls for the desktop device range.\n\n@media (min-width: @screen-md-min) {\n  .make-grid(md);\n}\n\n\n// Large grid\n//\n// Columns, offsets, pushes, and pulls for the large desktop device range.\n\n@media (min-width: @screen-lg-min) {\n  .make-grid(lg);\n}\n","//\n// Tables\n// --------------------------------------------------\n\n\ntable {\n  max-width: 100%;\n  background-color: @table-bg;\n}\nth {\n  text-align: left;\n}\n\n\n// Baseline styles\n\n.table {\n  width: 100%;\n  margin-bottom: @line-height-computed;\n  // Cells\n  > thead,\n  > tbody,\n  > tfoot {\n    > tr {\n      > th,\n      > td {\n        padding: @table-cell-padding;\n        line-height: @line-height-base;\n        vertical-align: top;\n        border-top: 1px solid @table-border-color;\n      }\n    }\n  }\n  // Bottom align for column headings\n  > thead > tr > th {\n    vertical-align: bottom;\n    border-bottom: 2px solid @table-border-color;\n  }\n  // Remove top border from thead by default\n  > caption + thead,\n  > colgroup + thead,\n  > thead:first-child {\n    > tr:first-child {\n      > th,\n      > td {\n        border-top: 0;\n      }\n    }\n  }\n  // Account for multiple tbody instances\n  > tbody + tbody {\n    border-top: 2px solid @table-border-color;\n  }\n\n  // Nesting\n  .table {\n    background-color: @body-bg;\n  }\n}\n\n\n// Condensed table w/ half padding\n\n.table-condensed {\n  > thead,\n  > tbody,\n  > tfoot {\n    > tr {\n      > th,\n      > td {\n        padding: @table-condensed-cell-padding;\n      }\n    }\n  }\n}\n\n\n// Bordered version\n//\n// Add borders all around the table and between all the columns.\n\n.table-bordered {\n  border: 1px solid @table-border-color;\n  > thead,\n  > tbody,\n  > tfoot {\n    > tr {\n      > th,\n      > td {\n        border: 1px solid @table-border-color;\n      }\n    }\n  }\n  > thead > tr {\n    > th,\n    > td {\n      border-bottom-width: 2px;\n    }\n  }\n}\n\n\n// Zebra-striping\n//\n// Default zebra-stripe styles (alternating gray and transparent backgrounds)\n\n.table-striped {\n  > tbody > tr:nth-child(odd) {\n    > td,\n    > th {\n      background-color: @table-bg-accent;\n    }\n  }\n}\n\n\n// Hover effect\n//\n// Placed here since it has to come after the potential zebra striping\n\n.table-hover {\n  > tbody > tr:hover {\n    > td,\n    > th {\n      background-color: @table-bg-hover;\n    }\n  }\n}\n\n\n// Table cell sizing\n//\n// Reset default table behavior\n\ntable col[class*=\"col-\"] {\n  position: static; // Prevent border hiding in Firefox and IE9/10 (see https://github.com/twbs/bootstrap/issues/11623)\n  float: none;\n  display: table-column;\n}\ntable {\n  td,\n  th {\n    &[class*=\"col-\"] {\n      position: static; // Prevent border hiding in Firefox and IE9/10 (see https://github.com/twbs/bootstrap/issues/11623)\n      float: none;\n      display: table-cell;\n    }\n  }\n}\n\n\n// Table backgrounds\n//\n// Exact selectors below required to override `.table-striped` and prevent\n// inheritance to nested tables.\n\n// Generate the contextual variants\n.table-row-variant(active; @table-bg-active);\n.table-row-variant(success; @state-success-bg);\n.table-row-variant(info; @state-info-bg);\n.table-row-variant(warning; @state-warning-bg);\n.table-row-variant(danger; @state-danger-bg);\n\n\n// Responsive tables\n//\n// Wrap your tables in `.table-responsive` and we'll make them mobile friendly\n// by enabling horizontal scrolling. Only applies <768px. Everything above that\n// will display normally.\n\n@media (max-width: @screen-xs-max) {\n  .table-responsive {\n    width: 100%;\n    margin-bottom: (@line-height-computed * 0.75);\n    overflow-y: hidden;\n    overflow-x: scroll;\n    -ms-overflow-style: -ms-autohiding-scrollbar;\n    border: 1px solid @table-border-color;\n    -webkit-overflow-scrolling: touch;\n\n    // Tighten up spacing\n    > .table {\n      margin-bottom: 0;\n\n      // Ensure the content doesn't wrap\n      > thead,\n      > tbody,\n      > tfoot {\n        > tr {\n          > th,\n          > td {\n            white-space: nowrap;\n          }\n        }\n      }\n    }\n\n    // Special overrides for the bordered tables\n    > .table-bordered {\n      border: 0;\n\n      // Nuke the appropriate borders so that the parent can handle them\n      > thead,\n      > tbody,\n      > tfoot {\n        > tr {\n          > th:first-child,\n          > td:first-child {\n            border-left: 0;\n          }\n          > th:last-child,\n          > td:last-child {\n            border-right: 0;\n          }\n        }\n      }\n\n      // Only nuke the last row's bottom-border in `tbody` and `tfoot` since\n      // chances are there will be only one `tr` in a `thead` and that would\n      // remove the border altogether.\n      > tbody,\n      > tfoot {\n        > tr:last-child {\n          > th,\n          > td {\n            border-bottom: 0;\n          }\n        }\n      }\n\n    }\n  }\n}\n","//\n// Forms\n// --------------------------------------------------\n\n\n// Normalize non-controls\n//\n// Restyle and baseline non-control form elements.\n\nfieldset {\n  padding: 0;\n  margin: 0;\n  border: 0;\n  // Chrome and Firefox set a `min-width: -webkit-min-content;` on fieldsets,\n  // so we reset that to ensure it behaves more like a standard block element.\n  // See https://github.com/twbs/bootstrap/issues/12359.\n  min-width: 0;\n}\n\nlegend {\n  display: block;\n  width: 100%;\n  padding: 0;\n  margin-bottom: @line-height-computed;\n  font-size: (@font-size-base * 1.5);\n  line-height: inherit;\n  color: @legend-color;\n  border: 0;\n  border-bottom: 1px solid @legend-border-color;\n}\n\nlabel {\n  display: inline-block;\n  margin-bottom: 5px;\n  font-weight: bold;\n}\n\n\n// Normalize form controls\n//\n// While most of our form styles require extra classes, some basic normalization\n// is required to ensure optimum display with or without those classes to better\n// address browser inconsistencies.\n\n// Override content-box in Normalize (* isn't specific enough)\ninput[type=\"search\"] {\n  .box-sizing(border-box);\n}\n\n// Position radios and checkboxes better\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 4px 0 0;\n  margin-top: 1px \\9; /* IE8-9 */\n  line-height: normal;\n}\n\n// Set the height of file controls to match text inputs\ninput[type=\"file\"] {\n  display: block;\n}\n\n// Make range inputs behave like textual form controls\ninput[type=\"range\"] {\n  display: block;\n  width: 100%;\n}\n\n// Make multiple select elements height not fixed\nselect[multiple],\nselect[size] {\n  height: auto;\n}\n\n// Focus for file, radio, and checkbox\ninput[type=\"file\"]:focus,\ninput[type=\"radio\"]:focus,\ninput[type=\"checkbox\"]:focus {\n  .tab-focus();\n}\n\n// Adjust output element\noutput {\n  display: block;\n  padding-top: (@padding-base-vertical + 1);\n  font-size: @font-size-base;\n  line-height: @line-height-base;\n  color: @input-color;\n}\n\n\n// Common form controls\n//\n// Shared size and type resets for form controls. Apply `.form-control` to any\n// of the following form controls:\n//\n// select\n// textarea\n// input[type=\"text\"]\n// input[type=\"password\"]\n// input[type=\"datetime\"]\n// input[type=\"datetime-local\"]\n// input[type=\"date\"]\n// input[type=\"month\"]\n// input[type=\"time\"]\n// input[type=\"week\"]\n// input[type=\"number\"]\n// input[type=\"email\"]\n// input[type=\"url\"]\n// input[type=\"search\"]\n// input[type=\"tel\"]\n// input[type=\"color\"]\n\n.form-control {\n  display: block;\n  width: 100%;\n  height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)\n  padding: @padding-base-vertical @padding-base-horizontal;\n  font-size: @font-size-base;\n  line-height: @line-height-base;\n  color: @input-color;\n  background-color: @input-bg;\n  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214\n  border: 1px solid @input-border;\n  border-radius: @input-border-radius;\n  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));\n  .transition(~\"border-color ease-in-out .15s, box-shadow ease-in-out .15s\");\n\n  // Customize the `:focus` state to imitate native WebKit styles.\n  .form-control-focus();\n\n  // Placeholder\n  .placeholder();\n\n  // Disabled and read-only inputs\n  //\n  // HTML5 says that controls under a fieldset > legend:first-child won't be\n  // disabled if the fieldset is disabled. Due to implementation difficulty, we\n  // don't honor that edge case; we style them as disabled anyway.\n  &[disabled],\n  &[readonly],\n  fieldset[disabled] & {\n    cursor: not-allowed;\n    background-color: @input-bg-disabled;\n    opacity: 1; // iOS fix for unreadable disabled content\n  }\n\n  // Reset height for `textarea`s\n  textarea& {\n    height: auto;\n  }\n}\n\n\n// Search inputs in iOS\n//\n// This overrides the extra rounded corners on search inputs in iOS so that our\n// `.form-control` class can properly style them. Note that this cannot simply\n// be added to `.form-control` as it's not specific enough. For details, see\n// https://github.com/twbs/bootstrap/issues/11586.\n\ninput[type=\"search\"] {\n  -webkit-appearance: none;\n}\n\n\n// Special styles for iOS date input\n//\n// In Mobile Safari, date inputs require a pixel line-height that matches the\n// given height of the input.\n\ninput[type=\"date\"] {\n  line-height: @input-height-base;\n}\n\n\n// Form groups\n//\n// Designed to help with the organization and spacing of vertical forms. For\n// horizontal forms, use the predefined grid classes.\n\n.form-group {\n  margin-bottom: 15px;\n}\n\n\n// Checkboxes and radios\n//\n// Indent the labels to position radios/checkboxes as hanging controls.\n\n.radio,\n.checkbox {\n  display: block;\n  min-height: @line-height-computed; // clear the floating input if there is no label text\n  margin-top: 10px;\n  margin-bottom: 10px;\n  padding-left: 20px;\n  label {\n    display: inline;\n    font-weight: normal;\n    cursor: pointer;\n  }\n}\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n  float: left;\n  margin-left: -20px;\n}\n.radio + .radio,\n.checkbox + .checkbox {\n  margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing\n}\n\n// Radios and checkboxes on same line\n.radio-inline,\n.checkbox-inline {\n  display: inline-block;\n  padding-left: 20px;\n  margin-bottom: 0;\n  vertical-align: middle;\n  font-weight: normal;\n  cursor: pointer;\n}\n.radio-inline + .radio-inline,\n.checkbox-inline + .checkbox-inline {\n  margin-top: 0;\n  margin-left: 10px; // space out consecutive inline controls\n}\n\n// Apply same disabled cursor tweak as for inputs\n//\n// Note: Neither radios nor checkboxes can be readonly.\ninput[type=\"radio\"],\ninput[type=\"checkbox\"],\n.radio,\n.radio-inline,\n.checkbox,\n.checkbox-inline {\n  &[disabled],\n  fieldset[disabled] & {\n    cursor: not-allowed;\n  }\n}\n\n\n// Form control sizing\n//\n// Build on `.form-control` with modifier classes to decrease or increase the\n// height and font-size of form controls.\n\n.input-sm {\n  .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);\n}\n\n.input-lg {\n  .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);\n}\n\n\n// Form control feedback states\n//\n// Apply contextual and semantic states to individual form controls.\n\n.has-feedback {\n  // Enable absolute positioning\n  position: relative;\n\n  // Ensure icons don't overlap text\n  .form-control {\n    padding-right: (@input-height-base * 1.25);\n  }\n\n  // Feedback icon (requires .glyphicon classes)\n  .form-control-feedback {\n    position: absolute;\n    top: (@line-height-computed + 5); // Height of the `label` and its margin\n    right: 0;\n    display: block;\n    width: @input-height-base;\n    height: @input-height-base;\n    line-height: @input-height-base;\n    text-align: center;\n  }\n}\n\n// Feedback states\n.has-success {\n  .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);\n}\n.has-warning {\n  .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);\n}\n.has-error {\n  .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);\n}\n\n\n// Static form control text\n//\n// Apply class to a `p` element to make any string of text align with labels in\n// a horizontal form layout.\n\n.form-control-static {\n  margin-bottom: 0; // Remove default margin from `p`\n}\n\n\n// Help text\n//\n// Apply to any element you wish to create light text for placement immediately\n// below a form control. Use for general help, formatting, or instructional text.\n\n.help-block {\n  display: block; // account for any element using help-block\n  margin-top: 5px;\n  margin-bottom: 10px;\n  color: lighten(@text-color, 25%); // lighten the text some for contrast\n}\n\n\n\n// Inline forms\n//\n// Make forms appear inline(-block) by adding the `.form-inline` class. Inline\n// forms begin stacked on extra small (mobile) devices and then go inline when\n// viewports reach <768px.\n//\n// Requires wrapping inputs and labels with `.form-group` for proper display of\n// default HTML form controls and our custom form controls (e.g., input groups).\n//\n// Heads up! This is mixin-ed into `.navbar-form` in navbars.less.\n\n.form-inline {\n\n  // Kick in the inline\n  @media (min-width: @screen-sm-min) {\n    // Inline-block all the things for \"inline\"\n    .form-group {\n      display: inline-block;\n      margin-bottom: 0;\n      vertical-align: middle;\n    }\n\n    // In navbar-form, allow folks to *not* use `.form-group`\n    .form-control {\n      display: inline-block;\n      width: auto; // Prevent labels from stacking above inputs in `.form-group`\n      vertical-align: middle;\n    }\n    // Input groups need that 100% width though\n    .input-group > .form-control {\n      width: 100%;\n    }\n\n    .control-label {\n      margin-bottom: 0;\n      vertical-align: middle;\n    }\n\n    // Remove default margin on radios/checkboxes that were used for stacking, and\n    // then undo the floating of radios and checkboxes to match (which also avoids\n    // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).\n    .radio,\n    .checkbox {\n      display: inline-block;\n      margin-top: 0;\n      margin-bottom: 0;\n      padding-left: 0;\n      vertical-align: middle;\n    }\n    .radio input[type=\"radio\"],\n    .checkbox input[type=\"checkbox\"] {\n      float: none;\n      margin-left: 0;\n    }\n\n    // Validation states\n    //\n    // Reposition the icon because it's now within a grid column and columns have\n    // `position: relative;` on them. Also accounts for the grid gutter padding.\n    .has-feedback .form-control-feedback {\n      top: 0;\n    }\n  }\n}\n\n\n// Horizontal forms\n//\n// Horizontal forms are built on grid classes and allow you to create forms with\n// labels on the left and inputs on the right.\n\n.form-horizontal {\n\n  // Consistent vertical alignment of labels, radios, and checkboxes\n  .control-label,\n  .radio,\n  .checkbox,\n  .radio-inline,\n  .checkbox-inline {\n    margin-top: 0;\n    margin-bottom: 0;\n    padding-top: (@padding-base-vertical + 1); // Default padding plus a border\n  }\n  // Account for padding we're adding to ensure the alignment and of help text\n  // and other content below items\n  .radio,\n  .checkbox {\n    min-height: (@line-height-computed + (@padding-base-vertical + 1));\n  }\n\n  // Make form groups behave like rows\n  .form-group {\n    .make-row();\n  }\n\n  .form-control-static {\n    padding-top: (@padding-base-vertical + 1);\n  }\n\n  // Only right align form labels here when the columns stop stacking\n  @media (min-width: @screen-sm-min) {\n    .control-label {\n      text-align: right;\n    }\n  }\n\n  // Validation states\n  //\n  // Reposition the icon because it's now within a grid column and columns have\n  // `position: relative;` on them. Also accounts for the grid gutter padding.\n  .has-feedback .form-control-feedback {\n    top: 0;\n    right: (@grid-gutter-width / 2);\n  }\n}\n","//\n// Buttons\n// --------------------------------------------------\n\n\n// Base styles\n// --------------------------------------------------\n\n.btn {\n  display: inline-block;\n  margin-bottom: 0; // For input.btn\n  font-weight: @btn-font-weight;\n  text-align: center;\n  vertical-align: middle;\n  cursor: pointer;\n  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214\n  border: 1px solid transparent;\n  white-space: nowrap;\n  .button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @border-radius-base);\n  .user-select(none);\n\n  &,\n  &:active,\n  &.active {\n    &:focus {\n      .tab-focus();\n    }\n  }\n\n  &:hover,\n  &:focus {\n    color: @btn-default-color;\n    text-decoration: none;\n  }\n\n  &:active,\n  &.active {\n    outline: 0;\n    background-image: none;\n    .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n  }\n\n  &.disabled,\n  &[disabled],\n  fieldset[disabled] & {\n    cursor: not-allowed;\n    pointer-events: none; // Future-proof disabling of clicks\n    .opacity(.65);\n    .box-shadow(none);\n  }\n}\n\n\n// Alternate buttons\n// --------------------------------------------------\n\n.btn-default {\n  .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);\n}\n.btn-primary {\n  .button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);\n}\n// Success appears as green\n.btn-success {\n  .button-variant(@btn-success-color; @btn-success-bg; @btn-success-border);\n}\n// Info appears as blue-green\n.btn-info {\n  .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);\n}\n// Warning appears as orange\n.btn-warning {\n  .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);\n}\n// Danger and error appear as red\n.btn-danger {\n  .button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border);\n}\n\n\n// Link buttons\n// -------------------------\n\n// Make a button look and behave like a link\n.btn-link {\n  color: @link-color;\n  font-weight: normal;\n  cursor: pointer;\n  border-radius: 0;\n\n  &,\n  &:active,\n  &[disabled],\n  fieldset[disabled] & {\n    background-color: transparent;\n    .box-shadow(none);\n  }\n  &,\n  &:hover,\n  &:focus,\n  &:active {\n    border-color: transparent;\n  }\n  &:hover,\n  &:focus {\n    color: @link-hover-color;\n    text-decoration: underline;\n    background-color: transparent;\n  }\n  &[disabled],\n  fieldset[disabled] & {\n    &:hover,\n    &:focus {\n      color: @btn-link-disabled-color;\n      text-decoration: none;\n    }\n  }\n}\n\n\n// Button Sizes\n// --------------------------------------------------\n\n.btn-lg {\n  // line-height: ensure even-numbered height of button next to large input\n  .button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);\n}\n.btn-sm {\n  // line-height: ensure proper height of button next to small input\n  .button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);\n}\n.btn-xs {\n  .button-size(@padding-xs-vertical; @padding-xs-horizontal; @font-size-small; @line-height-small; @border-radius-small);\n}\n\n\n// Block button\n// --------------------------------------------------\n\n.btn-block {\n  display: block;\n  width: 100%;\n  padding-left: 0;\n  padding-right: 0;\n}\n\n// Vertically space out multiple block buttons\n.btn-block + .btn-block {\n  margin-top: 5px;\n}\n\n// Specificity overrides\ninput[type=\"submit\"],\ninput[type=\"reset\"],\ninput[type=\"button\"] {\n  &.btn-block {\n    width: 100%;\n  }\n}\n","//\n// Button groups\n// --------------------------------------------------\n\n// Make the div behave like a button\n.btn-group,\n.btn-group-vertical {\n  position: relative;\n  display: inline-block;\n  vertical-align: middle; // match .btn alignment given font-size hack above\n  > .btn {\n    position: relative;\n    float: left;\n    // Bring the \"active\" button to the front\n    &:hover,\n    &:focus,\n    &:active,\n    &.active {\n      z-index: 2;\n    }\n    &:focus {\n      // Remove focus outline when dropdown JS adds it after closing the menu\n      outline: none;\n    }\n  }\n}\n\n// Prevent double borders when buttons are next to each other\n.btn-group {\n  .btn + .btn,\n  .btn + .btn-group,\n  .btn-group + .btn,\n  .btn-group + .btn-group {\n    margin-left: -1px;\n  }\n}\n\n// Optional: Group multiple button groups together for a toolbar\n.btn-toolbar {\n  margin-left: -5px; // Offset the first child's margin\n  &:extend(.clearfix all);\n\n  .btn-group,\n  .input-group {\n    float: left;\n  }\n  > .btn,\n  > .btn-group,\n  > .input-group {\n    margin-left: 5px;\n  }\n}\n\n.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {\n  border-radius: 0;\n}\n\n// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match\n.btn-group > .btn:first-child {\n  margin-left: 0;\n  &:not(:last-child):not(.dropdown-toggle) {\n    .border-right-radius(0);\n  }\n}\n// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it\n.btn-group > .btn:last-child:not(:first-child),\n.btn-group > .dropdown-toggle:not(:first-child) {\n  .border-left-radius(0);\n}\n\n// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)\n.btn-group > .btn-group {\n  float: left;\n}\n.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group > .btn-group:first-child {\n  > .btn:last-child,\n  > .dropdown-toggle {\n    .border-right-radius(0);\n  }\n}\n.btn-group > .btn-group:last-child > .btn:first-child {\n  .border-left-radius(0);\n}\n\n// On active and open, don't show outline\n.btn-group .dropdown-toggle:active,\n.btn-group.open .dropdown-toggle {\n  outline: 0;\n}\n\n\n// Sizing\n//\n// Remix the default button sizing classes into new ones for easier manipulation.\n\n.btn-group-xs > .btn { &:extend(.btn-xs); }\n.btn-group-sm > .btn { &:extend(.btn-sm); }\n.btn-group-lg > .btn { &:extend(.btn-lg); }\n\n\n// Split button dropdowns\n// ----------------------\n\n// Give the line between buttons some depth\n.btn-group > .btn + .dropdown-toggle {\n  padding-left: 8px;\n  padding-right: 8px;\n}\n.btn-group > .btn-lg + .dropdown-toggle {\n  padding-left: 12px;\n  padding-right: 12px;\n}\n\n// The clickable button for toggling the menu\n// Remove the gradient and set the same inset shadow as the :active state\n.btn-group.open .dropdown-toggle {\n  .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n\n  // Show no shadow for `.btn-link` since it has no other button styles.\n  &.btn-link {\n    .box-shadow(none);\n  }\n}\n\n\n// Reposition the caret\n.btn .caret {\n  margin-left: 0;\n}\n// Carets in other button sizes\n.btn-lg .caret {\n  border-width: @caret-width-large @caret-width-large 0;\n  border-bottom-width: 0;\n}\n// Upside down carets for .dropup\n.dropup .btn-lg .caret {\n  border-width: 0 @caret-width-large @caret-width-large;\n}\n\n\n// Vertical button groups\n// ----------------------\n\n.btn-group-vertical {\n  > .btn,\n  > .btn-group,\n  > .btn-group > .btn {\n    display: block;\n    float: none;\n    width: 100%;\n    max-width: 100%;\n  }\n\n  // Clear floats so dropdown menus can be properly placed\n  > .btn-group {\n    &:extend(.clearfix all);\n    > .btn {\n      float: none;\n    }\n  }\n\n  > .btn + .btn,\n  > .btn + .btn-group,\n  > .btn-group + .btn,\n  > .btn-group + .btn-group {\n    margin-top: -1px;\n    margin-left: 0;\n  }\n}\n\n.btn-group-vertical > .btn {\n  &:not(:first-child):not(:last-child) {\n    border-radius: 0;\n  }\n  &:first-child:not(:last-child) {\n    border-top-right-radius: @border-radius-base;\n    .border-bottom-radius(0);\n  }\n  &:last-child:not(:first-child) {\n    border-bottom-left-radius: @border-radius-base;\n    .border-top-radius(0);\n  }\n}\n.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group-vertical > .btn-group:first-child:not(:last-child) {\n  > .btn:last-child,\n  > .dropdown-toggle {\n    .border-bottom-radius(0);\n  }\n}\n.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  .border-top-radius(0);\n}\n\n\n\n// Justified button groups\n// ----------------------\n\n.btn-group-justified {\n  display: table;\n  width: 100%;\n  table-layout: fixed;\n  border-collapse: separate;\n  > .btn,\n  > .btn-group {\n    float: none;\n    display: table-cell;\n    width: 1%;\n  }\n  > .btn-group .btn {\n    width: 100%;\n  }\n}\n\n\n// Checkbox and radio options\n[data-toggle=\"buttons\"] > .btn > input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn > input[type=\"checkbox\"] {\n  display: none;\n}\n","//\n// Component animations\n// --------------------------------------------------\n\n// Heads up!\n//\n// We don't use the `.opacity()` mixin here since it causes a bug with text\n// fields in IE7-8. Source: https://github.com/twitter/bootstrap/pull/3552.\n\n.fade {\n  opacity: 0;\n  .transition(opacity .15s linear);\n  &.in {\n    opacity: 1;\n  }\n}\n\n.collapse {\n  display: none;\n  &.in {\n    display: block;\n  }\n}\n.collapsing {\n  position: relative;\n  height: 0;\n  overflow: hidden;\n  .transition(height .35s ease);\n}\n","//\n// Glyphicons for Bootstrap\n//\n// Since icons are fonts, they can be placed anywhere text is placed and are\n// thus automatically sized to match the surrounding child. To use, create an\n// inline element with the appropriate classes, like so:\n//\n// <a href=\"#\"><span class=\"glyphicon glyphicon-star\"></span> Star</a>\n\n// Import the fonts\n@font-face {\n  font-family: 'Glyphicons Halflings';\n  src: ~\"url('@{icon-font-path}@{icon-font-name}.eot')\";\n  src: ~\"url('@{icon-font-path}@{icon-font-name}.eot?#iefix') format('embedded-opentype')\",\n       ~\"url('@{icon-font-path}@{icon-font-name}.woff') format('woff')\",\n       ~\"url('@{icon-font-path}@{icon-font-name}.ttf') format('truetype')\",\n       ~\"url('@{icon-font-path}@{icon-font-name}.svg#@{icon-font-svg-id}') format('svg')\";\n}\n\n// Catchall baseclass\n.glyphicon {\n  position: relative;\n  top: 1px;\n  display: inline-block;\n  font-family: 'Glyphicons Halflings';\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\n// Individual icons\n.glyphicon-asterisk               { &:before { content: \"\\2a\"; } }\n.glyphicon-plus                   { &:before { content: \"\\2b\"; } }\n.glyphicon-euro                   { &:before { content: \"\\20ac\"; } }\n.glyphicon-minus                  { &:before { content: \"\\2212\"; } }\n.glyphicon-cloud                  { &:before { content: \"\\2601\"; } }\n.glyphicon-envelope               { &:before { content: \"\\2709\"; } }\n.glyphicon-pencil                 { &:before { content: \"\\270f\"; } }\n.glyphicon-glass                  { &:before { content: \"\\e001\"; } }\n.glyphicon-music                  { &:before { content: \"\\e002\"; } }\n.glyphicon-search                 { &:before { content: \"\\e003\"; } }\n.glyphicon-heart                  { &:before { content: \"\\e005\"; } }\n.glyphicon-star                   { &:before { content: \"\\e006\"; } }\n.glyphicon-star-empty             { &:before { content: \"\\e007\"; } }\n.glyphicon-user                   { &:before { content: \"\\e008\"; } }\n.glyphicon-film                   { &:before { content: \"\\e009\"; } }\n.glyphicon-th-large               { &:before { content: \"\\e010\"; } }\n.glyphicon-th                     { &:before { content: \"\\e011\"; } }\n.glyphicon-th-list                { &:before { content: \"\\e012\"; } }\n.glyphicon-ok                     { &:before { content: \"\\e013\"; } }\n.glyphicon-remove                 { &:before { content: \"\\e014\"; } }\n.glyphicon-zoom-in                { &:before { content: \"\\e015\"; } }\n.glyphicon-zoom-out               { &:before { content: \"\\e016\"; } }\n.glyphicon-off                    { &:before { content: \"\\e017\"; } }\n.glyphicon-signal                 { &:before { content: \"\\e018\"; } }\n.glyphicon-cog                    { &:before { content: \"\\e019\"; } }\n.glyphicon-trash                  { &:before { content: \"\\e020\"; } }\n.glyphicon-home                   { &:before { content: \"\\e021\"; } }\n.glyphicon-file                   { &:before { content: \"\\e022\"; } }\n.glyphicon-time                   { &:before { content: \"\\e023\"; } }\n.glyphicon-road                   { &:before { content: \"\\e024\"; } }\n.glyphicon-download-alt           { &:before { content: \"\\e025\"; } }\n.glyphicon-download               { &:before { content: \"\\e026\"; } }\n.glyphicon-upload                 { &:before { content: \"\\e027\"; } }\n.glyphicon-inbox                  { &:before { content: \"\\e028\"; } }\n.glyphicon-play-circle            { &:before { content: \"\\e029\"; } }\n.glyphicon-repeat                 { &:before { content: \"\\e030\"; } }\n.glyphicon-refresh                { &:before { content: \"\\e031\"; } }\n.glyphicon-list-alt               { &:before { content: \"\\e032\"; } }\n.glyphicon-lock                   { &:before { content: \"\\e033\"; } }\n.glyphicon-flag                   { &:before { content: \"\\e034\"; } }\n.glyphicon-headphones             { &:before { content: \"\\e035\"; } }\n.glyphicon-volume-off             { &:before { content: \"\\e036\"; } }\n.glyphicon-volume-down            { &:before { content: \"\\e037\"; } }\n.glyphicon-volume-up              { &:before { content: \"\\e038\"; } }\n.glyphicon-qrcode                 { &:before { content: \"\\e039\"; } }\n.glyphicon-barcode                { &:before { content: \"\\e040\"; } }\n.glyphicon-tag                    { &:before { content: \"\\e041\"; } }\n.glyphicon-tags                   { &:before { content: \"\\e042\"; } }\n.glyphicon-book                   { &:before { content: \"\\e043\"; } }\n.glyphicon-bookmark               { &:before { content: \"\\e044\"; } }\n.glyphicon-print                  { &:before { content: \"\\e045\"; } }\n.glyphicon-camera                 { &:before { content: \"\\e046\"; } }\n.glyphicon-font                   { &:before { content: \"\\e047\"; } }\n.glyphicon-bold                   { &:before { content: \"\\e048\"; } }\n.glyphicon-italic                 { &:before { content: \"\\e049\"; } }\n.glyphicon-text-height            { &:before { content: \"\\e050\"; } }\n.glyphicon-text-width             { &:before { content: \"\\e051\"; } }\n.glyphicon-align-left             { &:before { content: \"\\e052\"; } }\n.glyphicon-align-center           { &:before { content: \"\\e053\"; } }\n.glyphicon-align-right            { &:before { content: \"\\e054\"; } }\n.glyphicon-align-justify          { &:before { content: \"\\e055\"; } }\n.glyphicon-list                   { &:before { content: \"\\e056\"; } }\n.glyphicon-indent-left            { &:before { content: \"\\e057\"; } }\n.glyphicon-indent-right           { &:before { content: \"\\e058\"; } }\n.glyphicon-facetime-video         { &:before { content: \"\\e059\"; } }\n.glyphicon-picture                { &:before { content: \"\\e060\"; } }\n.glyphicon-map-marker             { &:before { content: \"\\e062\"; } }\n.glyphicon-adjust                 { &:before { content: \"\\e063\"; } }\n.glyphicon-tint                   { &:before { content: \"\\e064\"; } }\n.glyphicon-edit                   { &:before { content: \"\\e065\"; } }\n.glyphicon-share                  { &:before { content: \"\\e066\"; } }\n.glyphicon-check                  { &:before { content: \"\\e067\"; } }\n.glyphicon-move                   { &:before { content: \"\\e068\"; } }\n.glyphicon-step-backward          { &:before { content: \"\\e069\"; } }\n.glyphicon-fast-backward          { &:before { content: \"\\e070\"; } }\n.glyphicon-backward               { &:before { content: \"\\e071\"; } }\n.glyphicon-play                   { &:before { content: \"\\e072\"; } }\n.glyphicon-pause                  { &:before { content: \"\\e073\"; } }\n.glyphicon-stop                   { &:before { content: \"\\e074\"; } }\n.glyphicon-forward                { &:before { content: \"\\e075\"; } }\n.glyphicon-fast-forward           { &:before { content: \"\\e076\"; } }\n.glyphicon-step-forward           { &:before { content: \"\\e077\"; } }\n.glyphicon-eject                  { &:before { content: \"\\e078\"; } }\n.glyphicon-chevron-left           { &:before { content: \"\\e079\"; } }\n.glyphicon-chevron-right          { &:before { content: \"\\e080\"; } }\n.glyphicon-plus-sign              { &:before { content: \"\\e081\"; } }\n.glyphicon-minus-sign             { &:before { content: \"\\e082\"; } }\n.glyphicon-remove-sign            { &:before { content: \"\\e083\"; } }\n.glyphicon-ok-sign                { &:before { content: \"\\e084\"; } }\n.glyphicon-question-sign          { &:before { content: \"\\e085\"; } }\n.glyphicon-info-sign              { &:before { content: \"\\e086\"; } }\n.glyphicon-screenshot             { &:before { content: \"\\e087\"; } }\n.glyphicon-remove-circle          { &:before { content: \"\\e088\"; } }\n.glyphicon-ok-circle              { &:before { content: \"\\e089\"; } }\n.glyphicon-ban-circle             { &:before { content: \"\\e090\"; } }\n.glyphicon-arrow-left             { &:before { content: \"\\e091\"; } }\n.glyphicon-arrow-right            { &:before { content: \"\\e092\"; } }\n.glyphicon-arrow-up               { &:before { content: \"\\e093\"; } }\n.glyphicon-arrow-down             { &:before { content: \"\\e094\"; } }\n.glyphicon-share-alt              { &:before { content: \"\\e095\"; } }\n.glyphicon-resize-full            { &:before { content: \"\\e096\"; } }\n.glyphicon-resize-small           { &:before { content: \"\\e097\"; } }\n.glyphicon-exclamation-sign       { &:before { content: \"\\e101\"; } }\n.glyphicon-gift                   { &:before { content: \"\\e102\"; } }\n.glyphicon-leaf                   { &:before { content: \"\\e103\"; } }\n.glyphicon-fire                   { &:before { content: \"\\e104\"; } }\n.glyphicon-eye-open               { &:before { content: \"\\e105\"; } }\n.glyphicon-eye-close              { &:before { content: \"\\e106\"; } }\n.glyphicon-warning-sign           { &:before { content: \"\\e107\"; } }\n.glyphicon-plane                  { &:before { content: \"\\e108\"; } }\n.glyphicon-calendar               { &:before { content: \"\\e109\"; } }\n.glyphicon-random                 { &:before { content: \"\\e110\"; } }\n.glyphicon-comment                { &:before { content: \"\\e111\"; } }\n.glyphicon-magnet                 { &:before { content: \"\\e112\"; } }\n.glyphicon-chevron-up             { &:before { content: \"\\e113\"; } }\n.glyphicon-chevron-down           { &:before { content: \"\\e114\"; } }\n.glyphicon-retweet                { &:before { content: \"\\e115\"; } }\n.glyphicon-shopping-cart          { &:before { content: \"\\e116\"; } }\n.glyphicon-folder-close           { &:before { content: \"\\e117\"; } }\n.glyphicon-folder-open            { &:before { content: \"\\e118\"; } }\n.glyphicon-resize-vertical        { &:before { content: \"\\e119\"; } }\n.glyphicon-resize-horizontal      { &:before { content: \"\\e120\"; } }\n.glyphicon-hdd                    { &:before { content: \"\\e121\"; } }\n.glyphicon-bullhorn               { &:before { content: \"\\e122\"; } }\n.glyphicon-bell                   { &:before { content: \"\\e123\"; } }\n.glyphicon-certificate            { &:before { content: \"\\e124\"; } }\n.glyphicon-thumbs-up              { &:before { content: \"\\e125\"; } }\n.glyphicon-thumbs-down            { &:before { content: \"\\e126\"; } }\n.glyphicon-hand-right             { &:before { content: \"\\e127\"; } }\n.glyphicon-hand-left              { &:before { content: \"\\e128\"; } }\n.glyphicon-hand-up                { &:before { content: \"\\e129\"; } }\n.glyphicon-hand-down              { &:before { content: \"\\e130\"; } }\n.glyphicon-circle-arrow-right     { &:before { content: \"\\e131\"; } }\n.glyphicon-circle-arrow-left      { &:before { content: \"\\e132\"; } }\n.glyphicon-circle-arrow-up        { &:before { content: \"\\e133\"; } }\n.glyphicon-circle-arrow-down      { &:before { content: \"\\e134\"; } }\n.glyphicon-globe                  { &:before { content: \"\\e135\"; } }\n.glyphicon-wrench                 { &:before { content: \"\\e136\"; } }\n.glyphicon-tasks                  { &:before { content: \"\\e137\"; } }\n.glyphicon-filter                 { &:before { content: \"\\e138\"; } }\n.glyphicon-briefcase              { &:before { content: \"\\e139\"; } }\n.glyphicon-fullscreen             { &:before { content: \"\\e140\"; } }\n.glyphicon-dashboard              { &:before { content: \"\\e141\"; } }\n.glyphicon-paperclip              { &:before { content: \"\\e142\"; } }\n.glyphicon-heart-empty            { &:before { content: \"\\e143\"; } }\n.glyphicon-link                   { &:before { content: \"\\e144\"; } }\n.glyphicon-phone                  { &:before { content: \"\\e145\"; } }\n.glyphicon-pushpin                { &:before { content: \"\\e146\"; } }\n.glyphicon-usd                    { &:before { content: \"\\e148\"; } }\n.glyphicon-gbp                    { &:before { content: \"\\e149\"; } }\n.glyphicon-sort                   { &:before { content: \"\\e150\"; } }\n.glyphicon-sort-by-alphabet       { &:before { content: \"\\e151\"; } }\n.glyphicon-sort-by-alphabet-alt   { &:before { content: \"\\e152\"; } }\n.glyphicon-sort-by-order          { &:before { content: \"\\e153\"; } }\n.glyphicon-sort-by-order-alt      { &:before { content: \"\\e154\"; } }\n.glyphicon-sort-by-attributes     { &:before { content: \"\\e155\"; } }\n.glyphicon-sort-by-attributes-alt { &:before { content: \"\\e156\"; } }\n.glyphicon-unchecked              { &:before { content: \"\\e157\"; } }\n.glyphicon-expand                 { &:before { content: \"\\e158\"; } }\n.glyphicon-collapse-down          { &:before { content: \"\\e159\"; } }\n.glyphicon-collapse-up            { &:before { content: \"\\e160\"; } }\n.glyphicon-log-in                 { &:before { content: \"\\e161\"; } }\n.glyphicon-flash                  { &:before { content: \"\\e162\"; } }\n.glyphicon-log-out                { &:before { content: \"\\e163\"; } }\n.glyphicon-new-window             { &:before { content: \"\\e164\"; } }\n.glyphicon-record                 { &:before { content: \"\\e165\"; } }\n.glyphicon-save                   { &:before { content: \"\\e166\"; } }\n.glyphicon-open                   { &:before { content: \"\\e167\"; } }\n.glyphicon-saved                  { &:before { content: \"\\e168\"; } }\n.glyphicon-import                 { &:before { content: \"\\e169\"; } }\n.glyphicon-export                 { &:before { content: \"\\e170\"; } }\n.glyphicon-send                   { &:before { content: \"\\e171\"; } }\n.glyphicon-floppy-disk            { &:before { content: \"\\e172\"; } }\n.glyphicon-floppy-saved           { &:before { content: \"\\e173\"; } }\n.glyphicon-floppy-remove          { &:before { content: \"\\e174\"; } }\n.glyphicon-floppy-save            { &:before { content: \"\\e175\"; } }\n.glyphicon-floppy-open            { &:before { content: \"\\e176\"; } }\n.glyphicon-credit-card            { &:before { content: \"\\e177\"; } }\n.glyphicon-transfer               { &:before { content: \"\\e178\"; } }\n.glyphicon-cutlery                { &:before { content: \"\\e179\"; } }\n.glyphicon-header                 { &:before { content: \"\\e180\"; } }\n.glyphicon-compressed             { &:before { content: \"\\e181\"; } }\n.glyphicon-earphone               { &:before { content: \"\\e182\"; } }\n.glyphicon-phone-alt              { &:before { content: \"\\e183\"; } }\n.glyphicon-tower                  { &:before { content: \"\\e184\"; } }\n.glyphicon-stats                  { &:before { content: \"\\e185\"; } }\n.glyphicon-sd-video               { &:before { content: \"\\e186\"; } }\n.glyphicon-hd-video               { &:before { content: \"\\e187\"; } }\n.glyphicon-subtitles              { &:before { content: \"\\e188\"; } }\n.glyphicon-sound-stereo           { &:before { content: \"\\e189\"; } }\n.glyphicon-sound-dolby            { &:before { content: \"\\e190\"; } }\n.glyphicon-sound-5-1              { &:before { content: \"\\e191\"; } }\n.glyphicon-sound-6-1              { &:before { content: \"\\e192\"; } }\n.glyphicon-sound-7-1              { &:before { content: \"\\e193\"; } }\n.glyphicon-copyright-mark         { &:before { content: \"\\e194\"; } }\n.glyphicon-registration-mark      { &:before { content: \"\\e195\"; } }\n.glyphicon-cloud-download         { &:before { content: \"\\e197\"; } }\n.glyphicon-cloud-upload           { &:before { content: \"\\e198\"; } }\n.glyphicon-tree-conifer           { &:before { content: \"\\e199\"; } }\n.glyphicon-tree-deciduous         { &:before { content: \"\\e200\"; } }\n","//\n// Dropdown menus\n// --------------------------------------------------\n\n\n// Dropdown arrow/caret\n.caret {\n  display: inline-block;\n  width: 0;\n  height: 0;\n  margin-left: 2px;\n  vertical-align: middle;\n  border-top:   @caret-width-base solid;\n  border-right: @caret-width-base solid transparent;\n  border-left:  @caret-width-base solid transparent;\n}\n\n// The dropdown wrapper (div)\n.dropdown {\n  position: relative;\n}\n\n// Prevent the focus on the dropdown toggle when closing dropdowns\n.dropdown-toggle:focus {\n  outline: 0;\n}\n\n// The dropdown menu (ul)\n.dropdown-menu {\n  position: absolute;\n  top: 100%;\n  left: 0;\n  z-index: @zindex-dropdown;\n  display: none; // none by default, but block on \"open\" of the menu\n  float: left;\n  min-width: 160px;\n  padding: 5px 0;\n  margin: 2px 0 0; // override default ul\n  list-style: none;\n  font-size: @font-size-base;\n  background-color: @dropdown-bg;\n  border: 1px solid @dropdown-fallback-border; // IE8 fallback\n  border: 1px solid @dropdown-border;\n  border-radius: @border-radius-base;\n  .box-shadow(0 6px 12px rgba(0,0,0,.175));\n  background-clip: padding-box;\n\n  // Aligns the dropdown menu to right\n  //\n  // Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`\n  &.pull-right {\n    right: 0;\n    left: auto;\n  }\n\n  // Dividers (basically an hr) within the dropdown\n  .divider {\n    .nav-divider(@dropdown-divider-bg);\n  }\n\n  // Links within the dropdown menu\n  > li > a {\n    display: block;\n    padding: 3px 20px;\n    clear: both;\n    font-weight: normal;\n    line-height: @line-height-base;\n    color: @dropdown-link-color;\n    white-space: nowrap; // prevent links from randomly breaking onto new lines\n  }\n}\n\n// Hover/Focus state\n.dropdown-menu > li > a {\n  &:hover,\n  &:focus {\n    text-decoration: none;\n    color: @dropdown-link-hover-color;\n    background-color: @dropdown-link-hover-bg;\n  }\n}\n\n// Active state\n.dropdown-menu > .active > a {\n  &,\n  &:hover,\n  &:focus {\n    color: @dropdown-link-active-color;\n    text-decoration: none;\n    outline: 0;\n    background-color: @dropdown-link-active-bg;\n  }\n}\n\n// Disabled state\n//\n// Gray out text and ensure the hover/focus state remains gray\n\n.dropdown-menu > .disabled > a {\n  &,\n  &:hover,\n  &:focus {\n    color: @dropdown-link-disabled-color;\n  }\n}\n// Nuke hover/focus effects\n.dropdown-menu > .disabled > a {\n  &:hover,\n  &:focus {\n    text-decoration: none;\n    background-color: transparent;\n    background-image: none; // Remove CSS gradient\n    .reset-filter();\n    cursor: not-allowed;\n  }\n}\n\n// Open state for the dropdown\n.open {\n  // Show the menu\n  > .dropdown-menu {\n    display: block;\n  }\n\n  // Remove the outline when :focus is triggered\n  > a {\n    outline: 0;\n  }\n}\n\n// Menu positioning\n//\n// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown\n// menu with the parent.\n.dropdown-menu-right {\n  left: auto; // Reset the default from `.dropdown-menu`\n  right: 0;\n}\n// With v3, we enabled auto-flipping if you have a dropdown within a right\n// aligned nav component. To enable the undoing of that, we provide an override\n// to restore the default dropdown menu alignment.\n//\n// This is only for left-aligning a dropdown menu within a `.navbar-right` or\n// `.pull-right` nav component.\n.dropdown-menu-left {\n  left: 0;\n  right: auto;\n}\n\n// Dropdown section headers\n.dropdown-header {\n  display: block;\n  padding: 3px 20px;\n  font-size: @font-size-small;\n  line-height: @line-height-base;\n  color: @dropdown-header-color;\n}\n\n// Backdrop to catch body clicks on mobile, etc.\n.dropdown-backdrop {\n  position: fixed;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  top: 0;\n  z-index: (@zindex-dropdown - 10);\n}\n\n// Right aligned dropdowns\n.pull-right > .dropdown-menu {\n  right: 0;\n  left: auto;\n}\n\n// Allow for dropdowns to go bottom up (aka, dropup-menu)\n//\n// Just add .dropup after the standard .dropdown class and you're set, bro.\n// TODO: abstract this so that the navbar fixed styles are not placed here?\n\n.dropup,\n.navbar-fixed-bottom .dropdown {\n  // Reverse the caret\n  .caret {\n    border-top: 0;\n    border-bottom: @caret-width-base solid;\n    content: \"\";\n  }\n  // Different positioning for bottom up menu\n  .dropdown-menu {\n    top: auto;\n    bottom: 100%;\n    margin-bottom: 1px;\n  }\n}\n\n\n// Component alignment\n//\n// Reiterate per navbar.less and the modified component alignment there.\n\n@media (min-width: @grid-float-breakpoint) {\n  .navbar-right {\n    .dropdown-menu {\n      .dropdown-menu-right();\n    }\n    // Necessary for overrides of the default right aligned menu.\n    // Will remove come v4 in all likelihood.\n    .dropdown-menu-left {\n      .dropdown-menu-left();\n    }\n  }\n}\n\n","//\n// Input groups\n// --------------------------------------------------\n\n// Base styles\n// -------------------------\n.input-group {\n  position: relative; // For dropdowns\n  display: table;\n  border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table\n\n  // Undo padding and float of grid classes\n  &[class*=\"col-\"] {\n    float: none;\n    padding-left: 0;\n    padding-right: 0;\n  }\n\n  .form-control {\n    // Ensure that the input is always above the *appended* addon button for\n    // proper border colors.\n    position: relative;\n    z-index: 2;\n\n    // IE9 fubars the placeholder attribute in text inputs and the arrows on\n    // select elements in input groups. To fix it, we float the input. Details:\n    // https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855\n    float: left;\n\n    width: 100%;\n    margin-bottom: 0;\n  }\n}\n\n// Sizing options\n//\n// Remix the default form control sizing classes into new ones for easier\n// manipulation.\n\n.input-group-lg > .form-control,\n.input-group-lg > .input-group-addon,\n.input-group-lg > .input-group-btn > .btn { .input-lg(); }\n.input-group-sm > .form-control,\n.input-group-sm > .input-group-addon,\n.input-group-sm > .input-group-btn > .btn { .input-sm(); }\n\n\n// Display as table-cell\n// -------------------------\n.input-group-addon,\n.input-group-btn,\n.input-group .form-control {\n  display: table-cell;\n\n  &:not(:first-child):not(:last-child) {\n    border-radius: 0;\n  }\n}\n// Addon and addon wrapper for buttons\n.input-group-addon,\n.input-group-btn {\n  width: 1%;\n  white-space: nowrap;\n  vertical-align: middle; // Match the inputs\n}\n\n// Text input groups\n// -------------------------\n.input-group-addon {\n  padding: @padding-base-vertical @padding-base-horizontal;\n  font-size: @font-size-base;\n  font-weight: normal;\n  line-height: 1;\n  color: @input-color;\n  text-align: center;\n  background-color: @input-group-addon-bg;\n  border: 1px solid @input-group-addon-border-color;\n  border-radius: @border-radius-base;\n\n  // Sizing\n  &.input-sm {\n    padding: @padding-small-vertical @padding-small-horizontal;\n    font-size: @font-size-small;\n    border-radius: @border-radius-small;\n  }\n  &.input-lg {\n    padding: @padding-large-vertical @padding-large-horizontal;\n    font-size: @font-size-large;\n    border-radius: @border-radius-large;\n  }\n\n  // Nuke default margins from checkboxes and radios to vertically center within.\n  input[type=\"radio\"],\n  input[type=\"checkbox\"] {\n    margin-top: 0;\n  }\n}\n\n// Reset rounded corners\n.input-group .form-control:first-child,\n.input-group-addon:first-child,\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group > .btn,\n.input-group-btn:first-child > .dropdown-toggle,\n.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),\n.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {\n  .border-right-radius(0);\n}\n.input-group-addon:first-child {\n  border-right: 0;\n}\n.input-group .form-control:last-child,\n.input-group-addon:last-child,\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group > .btn,\n.input-group-btn:last-child > .dropdown-toggle,\n.input-group-btn:first-child > .btn:not(:first-child),\n.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {\n  .border-left-radius(0);\n}\n.input-group-addon:last-child {\n  border-left: 0;\n}\n\n// Button input groups\n// -------------------------\n.input-group-btn {\n  position: relative;\n  // Jankily prevent input button groups from wrapping with `white-space` and\n  // `font-size` in combination with `inline-block` on buttons.\n  font-size: 0;\n  white-space: nowrap;\n\n  // Negative margin for spacing, position for bringing hovered/focused/actived\n  // element above the siblings.\n  > .btn {\n    position: relative;\n    + .btn {\n      margin-left: -1px;\n    }\n    // Bring the \"active\" button to the front\n    &:hover,\n    &:focus,\n    &:active {\n      z-index: 2;\n    }\n  }\n\n  // Negative margin to only have a 1px border between the two\n  &:first-child {\n    > .btn,\n    > .btn-group {\n      margin-right: -1px;\n    }\n  }\n  &:last-child {\n    > .btn,\n    > .btn-group {\n      margin-left: -1px;\n    }\n  }\n}\n","//\n// Navs\n// --------------------------------------------------\n\n\n// Base class\n// --------------------------------------------------\n\n.nav {\n  margin-bottom: 0;\n  padding-left: 0; // Override default ul/ol\n  list-style: none;\n  &:extend(.clearfix all);\n\n  > li {\n    position: relative;\n    display: block;\n\n    > a {\n      position: relative;\n      display: block;\n      padding: @nav-link-padding;\n      &:hover,\n      &:focus {\n        text-decoration: none;\n        background-color: @nav-link-hover-bg;\n      }\n    }\n\n    // Disabled state sets text to gray and nukes hover/tab effects\n    &.disabled > a {\n      color: @nav-disabled-link-color;\n\n      &:hover,\n      &:focus {\n        color: @nav-disabled-link-hover-color;\n        text-decoration: none;\n        background-color: transparent;\n        cursor: not-allowed;\n      }\n    }\n  }\n\n  // Open dropdowns\n  .open > a {\n    &,\n    &:hover,\n    &:focus {\n      background-color: @nav-link-hover-bg;\n      border-color: @link-color;\n    }\n  }\n\n  // Nav dividers (deprecated with v3.0.1)\n  //\n  // This should have been removed in v3 with the dropping of `.nav-list`, but\n  // we missed it. We don't currently support this anywhere, but in the interest\n  // of maintaining backward compatibility in case you use it, it's deprecated.\n  .nav-divider {\n    .nav-divider();\n  }\n\n  // Prevent IE8 from misplacing imgs\n  //\n  // See https://github.com/h5bp/html5-boilerplate/issues/984#issuecomment-3985989\n  > li > a > img {\n    max-width: none;\n  }\n}\n\n\n// Tabs\n// -------------------------\n\n// Give the tabs something to sit on\n.nav-tabs {\n  border-bottom: 1px solid @nav-tabs-border-color;\n  > li {\n    float: left;\n    // Make the list-items overlay the bottom border\n    margin-bottom: -1px;\n\n    // Actual tabs (as links)\n    > a {\n      margin-right: 2px;\n      line-height: @line-height-base;\n      border: 1px solid transparent;\n      border-radius: @border-radius-base @border-radius-base 0 0;\n      &:hover {\n        border-color: @nav-tabs-link-hover-border-color @nav-tabs-link-hover-border-color @nav-tabs-border-color;\n      }\n    }\n\n    // Active state, and its :hover to override normal :hover\n    &.active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @nav-tabs-active-link-hover-color;\n        background-color: @nav-tabs-active-link-hover-bg;\n        border: 1px solid @nav-tabs-active-link-hover-border-color;\n        border-bottom-color: transparent;\n        cursor: default;\n      }\n    }\n  }\n  // pulling this in mainly for less shorthand\n  &.nav-justified {\n    .nav-justified();\n    .nav-tabs-justified();\n  }\n}\n\n\n// Pills\n// -------------------------\n.nav-pills {\n  > li {\n    float: left;\n\n    // Links rendered as pills\n    > a {\n      border-radius: @nav-pills-border-radius;\n    }\n    + li {\n      margin-left: 2px;\n    }\n\n    // Active state\n    &.active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @nav-pills-active-link-hover-color;\n        background-color: @nav-pills-active-link-hover-bg;\n      }\n    }\n  }\n}\n\n\n// Stacked pills\n.nav-stacked {\n  > li {\n    float: none;\n    + li {\n      margin-top: 2px;\n      margin-left: 0; // no need for this gap between nav items\n    }\n  }\n}\n\n\n// Nav variations\n// --------------------------------------------------\n\n// Justified nav links\n// -------------------------\n\n.nav-justified {\n  width: 100%;\n\n  > li {\n    float: none;\n     > a {\n      text-align: center;\n      margin-bottom: 5px;\n    }\n  }\n\n  > .dropdown .dropdown-menu {\n    top: auto;\n    left: auto;\n  }\n\n  @media (min-width: @screen-sm-min) {\n    > li {\n      display: table-cell;\n      width: 1%;\n      > a {\n        margin-bottom: 0;\n      }\n    }\n  }\n}\n\n// Move borders to anchors instead of bottom of list\n//\n// Mixin for adding on top the shared `.nav-justified` styles for our tabs\n.nav-tabs-justified {\n  border-bottom: 0;\n\n  > li > a {\n    // Override margin from .nav-tabs\n    margin-right: 0;\n    border-radius: @border-radius-base;\n  }\n\n  > .active > a,\n  > .active > a:hover,\n  > .active > a:focus {\n    border: 1px solid @nav-tabs-justified-link-border-color;\n  }\n\n  @media (min-width: @screen-sm-min) {\n    > li > a {\n      border-bottom: 1px solid @nav-tabs-justified-link-border-color;\n      border-radius: @border-radius-base @border-radius-base 0 0;\n    }\n    > .active > a,\n    > .active > a:hover,\n    > .active > a:focus {\n      border-bottom-color: @nav-tabs-justified-active-link-border-color;\n    }\n  }\n}\n\n\n// Tabbable tabs\n// -------------------------\n\n// Hide tabbable panes to start, show them when `.active`\n.tab-content {\n  > .tab-pane {\n    display: none;\n  }\n  > .active {\n    display: block;\n  }\n}\n\n\n// Dropdowns\n// -------------------------\n\n// Specific dropdowns\n.nav-tabs .dropdown-menu {\n  // make dropdown border overlap tab border\n  margin-top: -1px;\n  // Remove the top rounded corners here since there is a hard edge above the menu\n  .border-top-radius(0);\n}\n","//\n// Navbars\n// --------------------------------------------------\n\n\n// Wrapper and base class\n//\n// Provide a static navbar from which we expand to create full-width, fixed, and\n// other navbar variations.\n\n.navbar {\n  position: relative;\n  min-height: @navbar-height; // Ensure a navbar always shows (e.g., without a .navbar-brand in collapsed mode)\n  margin-bottom: @navbar-margin-bottom;\n  border: 1px solid transparent;\n\n  // Prevent floats from breaking the navbar\n  &:extend(.clearfix all);\n\n  @media (min-width: @grid-float-breakpoint) {\n    border-radius: @navbar-border-radius;\n  }\n}\n\n\n// Navbar heading\n//\n// Groups `.navbar-brand` and `.navbar-toggle` into a single component for easy\n// styling of responsive aspects.\n\n.navbar-header {\n  &:extend(.clearfix all);\n\n  @media (min-width: @grid-float-breakpoint) {\n    float: left;\n  }\n}\n\n\n// Navbar collapse (body)\n//\n// Group your navbar content into this for easy collapsing and expanding across\n// various device sizes. By default, this content is collapsed when <768px, but\n// will expand past that for a horizontal display.\n//\n// To start (on mobile devices) the navbar links, forms, and buttons are stacked\n// vertically and include a `max-height` to overflow in case you have too much\n// content for the user's viewport.\n\n.navbar-collapse {\n  max-height: @navbar-collapse-max-height;\n  overflow-x: visible;\n  padding-right: @navbar-padding-horizontal;\n  padding-left:  @navbar-padding-horizontal;\n  border-top: 1px solid transparent;\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);\n  &:extend(.clearfix all);\n  -webkit-overflow-scrolling: touch;\n\n  &.in {\n    overflow-y: auto;\n  }\n\n  @media (min-width: @grid-float-breakpoint) {\n    width: auto;\n    border-top: 0;\n    box-shadow: none;\n\n    &.collapse {\n      display: block !important;\n      height: auto !important;\n      padding-bottom: 0; // Override default setting\n      overflow: visible !important;\n    }\n\n    &.in {\n      overflow-y: visible;\n    }\n\n    // Undo the collapse side padding for navbars with containers to ensure\n    // alignment of right-aligned contents.\n    .navbar-fixed-top &,\n    .navbar-static-top &,\n    .navbar-fixed-bottom & {\n      padding-left: 0;\n      padding-right: 0;\n    }\n  }\n}\n\n\n// Both navbar header and collapse\n//\n// When a container is present, change the behavior of the header and collapse.\n\n.container,\n.container-fluid {\n  > .navbar-header,\n  > .navbar-collapse {\n    margin-right: -@navbar-padding-horizontal;\n    margin-left:  -@navbar-padding-horizontal;\n\n    @media (min-width: @grid-float-breakpoint) {\n      margin-right: 0;\n      margin-left:  0;\n    }\n  }\n}\n\n\n//\n// Navbar alignment options\n//\n// Display the navbar across the entirety of the page or fixed it to the top or\n// bottom of the page.\n\n// Static top (unfixed, but 100% wide) navbar\n.navbar-static-top {\n  z-index: @zindex-navbar;\n  border-width: 0 0 1px;\n\n  @media (min-width: @grid-float-breakpoint) {\n    border-radius: 0;\n  }\n}\n\n// Fix the top/bottom navbars when screen real estate supports it\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  position: fixed;\n  right: 0;\n  left: 0;\n  z-index: @zindex-navbar-fixed;\n\n  // Undo the rounded corners\n  @media (min-width: @grid-float-breakpoint) {\n    border-radius: 0;\n  }\n}\n.navbar-fixed-top {\n  top: 0;\n  border-width: 0 0 1px;\n}\n.navbar-fixed-bottom {\n  bottom: 0;\n  margin-bottom: 0; // override .navbar defaults\n  border-width: 1px 0 0;\n}\n\n\n// Brand/project name\n\n.navbar-brand {\n  float: left;\n  padding: @navbar-padding-vertical @navbar-padding-horizontal;\n  font-size: @font-size-large;\n  line-height: @line-height-computed;\n  height: @navbar-height;\n\n  &:hover,\n  &:focus {\n    text-decoration: none;\n  }\n\n  @media (min-width: @grid-float-breakpoint) {\n    .navbar > .container &,\n    .navbar > .container-fluid & {\n      margin-left: -@navbar-padding-horizontal;\n    }\n  }\n}\n\n\n// Navbar toggle\n//\n// Custom button for toggling the `.navbar-collapse`, powered by the collapse\n// JavaScript plugin.\n\n.navbar-toggle {\n  position: relative;\n  float: right;\n  margin-right: @navbar-padding-horizontal;\n  padding: 9px 10px;\n  .navbar-vertical-align(34px);\n  background-color: transparent;\n  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214\n  border: 1px solid transparent;\n  border-radius: @border-radius-base;\n\n  // We remove the `outline` here, but later compensate by attaching `:hover`\n  // styles to `:focus`.\n  &:focus {\n    outline: none;\n  }\n\n  // Bars\n  .icon-bar {\n    display: block;\n    width: 22px;\n    height: 2px;\n    border-radius: 1px;\n  }\n  .icon-bar + .icon-bar {\n    margin-top: 4px;\n  }\n\n  @media (min-width: @grid-float-breakpoint) {\n    display: none;\n  }\n}\n\n\n// Navbar nav links\n//\n// Builds on top of the `.nav` components with its own modifier class to make\n// the nav the full height of the horizontal nav (above 768px).\n\n.navbar-nav {\n  margin: (@navbar-padding-vertical / 2) -@navbar-padding-horizontal;\n\n  > li > a {\n    padding-top:    10px;\n    padding-bottom: 10px;\n    line-height: @line-height-computed;\n  }\n\n  @media (max-width: @grid-float-breakpoint-max) {\n    // Dropdowns get custom display when collapsed\n    .open .dropdown-menu {\n      position: static;\n      float: none;\n      width: auto;\n      margin-top: 0;\n      background-color: transparent;\n      border: 0;\n      box-shadow: none;\n      > li > a,\n      .dropdown-header {\n        padding: 5px 15px 5px 25px;\n      }\n      > li > a {\n        line-height: @line-height-computed;\n        &:hover,\n        &:focus {\n          background-image: none;\n        }\n      }\n    }\n  }\n\n  // Uncollapse the nav\n  @media (min-width: @grid-float-breakpoint) {\n    float: left;\n    margin: 0;\n\n    > li {\n      float: left;\n      > a {\n        padding-top:    @navbar-padding-vertical;\n        padding-bottom: @navbar-padding-vertical;\n      }\n    }\n\n    &.navbar-right:last-child {\n      margin-right: -@navbar-padding-horizontal;\n    }\n  }\n}\n\n\n// Component alignment\n//\n// Repurpose the pull utilities as their own navbar utilities to avoid specificity\n// issues with parents and chaining. Only do this when the navbar is uncollapsed\n// though so that navbar contents properly stack and align in mobile.\n\n@media (min-width: @grid-float-breakpoint) {\n  .navbar-left  { .pull-left(); }\n  .navbar-right { .pull-right(); }\n}\n\n\n// Navbar form\n//\n// Extension of the `.form-inline` with some extra flavor for optimum display in\n// our navbars.\n\n.navbar-form {\n  margin-left: -@navbar-padding-horizontal;\n  margin-right: -@navbar-padding-horizontal;\n  padding: 10px @navbar-padding-horizontal;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid transparent;\n  @shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);\n  .box-shadow(@shadow);\n\n  // Mixin behavior for optimum display\n  .form-inline();\n\n  .form-group {\n    @media (max-width: @grid-float-breakpoint-max) {\n      margin-bottom: 5px;\n    }\n  }\n\n  // Vertically center in expanded, horizontal navbar\n  .navbar-vertical-align(@input-height-base);\n\n  // Undo 100% width for pull classes\n  @media (min-width: @grid-float-breakpoint) {\n    width: auto;\n    border: 0;\n    margin-left: 0;\n    margin-right: 0;\n    padding-top: 0;\n    padding-bottom: 0;\n    .box-shadow(none);\n\n    // Outdent the form if last child to line up with content down the page\n    &.navbar-right:last-child {\n      margin-right: -@navbar-padding-horizontal;\n    }\n  }\n}\n\n\n// Dropdown menus\n\n// Menu position and menu carets\n.navbar-nav > li > .dropdown-menu {\n  margin-top: 0;\n  .border-top-radius(0);\n}\n// Menu position and menu caret support for dropups via extra dropup class\n.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {\n  .border-bottom-radius(0);\n}\n\n\n// Buttons in navbars\n//\n// Vertically center a button within a navbar (when *not* in a form).\n\n.navbar-btn {\n  .navbar-vertical-align(@input-height-base);\n\n  &.btn-sm {\n    .navbar-vertical-align(@input-height-small);\n  }\n  &.btn-xs {\n    .navbar-vertical-align(22);\n  }\n}\n\n\n// Text in navbars\n//\n// Add a class to make any element properly align itself vertically within the navbars.\n\n.navbar-text {\n  .navbar-vertical-align(@line-height-computed);\n\n  @media (min-width: @grid-float-breakpoint) {\n    float: left;\n    margin-left: @navbar-padding-horizontal;\n    margin-right: @navbar-padding-horizontal;\n\n    // Outdent the form if last child to line up with content down the page\n    &.navbar-right:last-child {\n      margin-right: 0;\n    }\n  }\n}\n\n// Alternate navbars\n// --------------------------------------------------\n\n// Default navbar\n.navbar-default {\n  background-color: @navbar-default-bg;\n  border-color: @navbar-default-border;\n\n  .navbar-brand {\n    color: @navbar-default-brand-color;\n    &:hover,\n    &:focus {\n      color: @navbar-default-brand-hover-color;\n      background-color: @navbar-default-brand-hover-bg;\n    }\n  }\n\n  .navbar-text {\n    color: @navbar-default-color;\n  }\n\n  .navbar-nav {\n    > li > a {\n      color: @navbar-default-link-color;\n\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-hover-color;\n        background-color: @navbar-default-link-hover-bg;\n      }\n    }\n    > .active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-active-color;\n        background-color: @navbar-default-link-active-bg;\n      }\n    }\n    > .disabled > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-default-link-disabled-color;\n        background-color: @navbar-default-link-disabled-bg;\n      }\n    }\n  }\n\n  .navbar-toggle {\n    border-color: @navbar-default-toggle-border-color;\n    &:hover,\n    &:focus {\n      background-color: @navbar-default-toggle-hover-bg;\n    }\n    .icon-bar {\n      background-color: @navbar-default-toggle-icon-bar-bg;\n    }\n  }\n\n  .navbar-collapse,\n  .navbar-form {\n    border-color: @navbar-default-border;\n  }\n\n  // Dropdown menu items\n  .navbar-nav {\n    // Remove background color from open dropdown\n    > .open > a {\n      &,\n      &:hover,\n      &:focus {\n        background-color: @navbar-default-link-active-bg;\n        color: @navbar-default-link-active-color;\n      }\n    }\n\n    @media (max-width: @grid-float-breakpoint-max) {\n      // Dropdowns get custom display when collapsed\n      .open .dropdown-menu {\n        > li > a {\n          color: @navbar-default-link-color;\n          &:hover,\n          &:focus {\n            color: @navbar-default-link-hover-color;\n            background-color: @navbar-default-link-hover-bg;\n          }\n        }\n        > .active > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-default-link-active-color;\n            background-color: @navbar-default-link-active-bg;\n          }\n        }\n        > .disabled > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-default-link-disabled-color;\n            background-color: @navbar-default-link-disabled-bg;\n          }\n        }\n      }\n    }\n  }\n\n\n  // Links in navbars\n  //\n  // Add a class to ensure links outside the navbar nav are colored correctly.\n\n  .navbar-link {\n    color: @navbar-default-link-color;\n    &:hover {\n      color: @navbar-default-link-hover-color;\n    }\n  }\n\n}\n\n// Inverse navbar\n\n.navbar-inverse {\n  background-color: @navbar-inverse-bg;\n  border-color: @navbar-inverse-border;\n\n  .navbar-brand {\n    color: @navbar-inverse-brand-color;\n    &:hover,\n    &:focus {\n      color: @navbar-inverse-brand-hover-color;\n      background-color: @navbar-inverse-brand-hover-bg;\n    }\n  }\n\n  .navbar-text {\n    color: @navbar-inverse-color;\n  }\n\n  .navbar-nav {\n    > li > a {\n      color: @navbar-inverse-link-color;\n\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-hover-color;\n        background-color: @navbar-inverse-link-hover-bg;\n      }\n    }\n    > .active > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-active-color;\n        background-color: @navbar-inverse-link-active-bg;\n      }\n    }\n    > .disabled > a {\n      &,\n      &:hover,\n      &:focus {\n        color: @navbar-inverse-link-disabled-color;\n        background-color: @navbar-inverse-link-disabled-bg;\n      }\n    }\n  }\n\n  // Darken the responsive nav toggle\n  .navbar-toggle {\n    border-color: @navbar-inverse-toggle-border-color;\n    &:hover,\n    &:focus {\n      background-color: @navbar-inverse-toggle-hover-bg;\n    }\n    .icon-bar {\n      background-color: @navbar-inverse-toggle-icon-bar-bg;\n    }\n  }\n\n  .navbar-collapse,\n  .navbar-form {\n    border-color: darken(@navbar-inverse-bg, 7%);\n  }\n\n  // Dropdowns\n  .navbar-nav {\n    > .open > a {\n      &,\n      &:hover,\n      &:focus {\n        background-color: @navbar-inverse-link-active-bg;\n        color: @navbar-inverse-link-active-color;\n      }\n    }\n\n    @media (max-width: @grid-float-breakpoint-max) {\n      // Dropdowns get custom display\n      .open .dropdown-menu {\n        > .dropdown-header {\n          border-color: @navbar-inverse-border;\n        }\n        .divider {\n          background-color: @navbar-inverse-border;\n        }\n        > li > a {\n          color: @navbar-inverse-link-color;\n          &:hover,\n          &:focus {\n            color: @navbar-inverse-link-hover-color;\n            background-color: @navbar-inverse-link-hover-bg;\n          }\n        }\n        > .active > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-inverse-link-active-color;\n            background-color: @navbar-inverse-link-active-bg;\n          }\n        }\n        > .disabled > a {\n          &,\n          &:hover,\n          &:focus {\n            color: @navbar-inverse-link-disabled-color;\n            background-color: @navbar-inverse-link-disabled-bg;\n          }\n        }\n      }\n    }\n  }\n\n  .navbar-link {\n    color: @navbar-inverse-link-color;\n    &:hover {\n      color: @navbar-inverse-link-hover-color;\n    }\n  }\n\n}\n","//\n// Utility classes\n// --------------------------------------------------\n\n\n// Floats\n// -------------------------\n\n.clearfix {\n  .clearfix();\n}\n.center-block {\n  .center-block();\n}\n.pull-right {\n  float: right !important;\n}\n.pull-left {\n  float: left !important;\n}\n\n\n// Toggling content\n// -------------------------\n\n// Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1\n.hide {\n  display: none !important;\n}\n.show {\n  display: block !important;\n}\n.invisible {\n  visibility: hidden;\n}\n.text-hide {\n  .text-hide();\n}\n\n\n// Hide from screenreaders and browsers\n//\n// Credit: HTML5 Boilerplate\n\n.hidden {\n  display: none !important;\n  visibility: hidden !important;\n}\n\n\n// For Affix plugin\n// -------------------------\n\n.affix {\n  position: fixed;\n}\n","//\n// Breadcrumbs\n// --------------------------------------------------\n\n\n.breadcrumb {\n  padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal;\n  margin-bottom: @line-height-computed;\n  list-style: none;\n  background-color: @breadcrumb-bg;\n  border-radius: @border-radius-base;\n\n  > li {\n    display: inline-block;\n\n    + li:before {\n      content: \"@{breadcrumb-separator}\\00a0\"; // Unicode space added since inline-block means non-collapsing white-space\n      padding: 0 5px;\n      color: @breadcrumb-color;\n    }\n  }\n\n  > .active {\n    color: @breadcrumb-active-color;\n  }\n}\n","//\n// Pagination (multiple pages)\n// --------------------------------------------------\n.pagination {\n  display: inline-block;\n  padding-left: 0;\n  margin: @line-height-computed 0;\n  border-radius: @border-radius-base;\n\n  > li {\n    display: inline; // Remove list-style and block-level defaults\n    > a,\n    > span {\n      position: relative;\n      float: left; // Collapse white-space\n      padding: @padding-base-vertical @padding-base-horizontal;\n      line-height: @line-height-base;\n      text-decoration: none;\n      color: @pagination-color;\n      background-color: @pagination-bg;\n      border: 1px solid @pagination-border;\n      margin-left: -1px;\n    }\n    &:first-child {\n      > a,\n      > span {\n        margin-left: 0;\n        .border-left-radius(@border-radius-base);\n      }\n    }\n    &:last-child {\n      > a,\n      > span {\n        .border-right-radius(@border-radius-base);\n      }\n    }\n  }\n\n  > li > a,\n  > li > span {\n    &:hover,\n    &:focus {\n      color: @pagination-hover-color;\n      background-color: @pagination-hover-bg;\n      border-color: @pagination-hover-border;\n    }\n  }\n\n  > .active > a,\n  > .active > span {\n    &,\n    &:hover,\n    &:focus {\n      z-index: 2;\n      color: @pagination-active-color;\n      background-color: @pagination-active-bg;\n      border-color: @pagination-active-border;\n      cursor: default;\n    }\n  }\n\n  > .disabled {\n    > span,\n    > span:hover,\n    > span:focus,\n    > a,\n    > a:hover,\n    > a:focus {\n      color: @pagination-disabled-color;\n      background-color: @pagination-disabled-bg;\n      border-color: @pagination-disabled-border;\n      cursor: not-allowed;\n    }\n  }\n}\n\n// Sizing\n// --------------------------------------------------\n\n// Large\n.pagination-lg {\n  .pagination-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @border-radius-large);\n}\n\n// Small\n.pagination-sm {\n  .pagination-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @border-radius-small);\n}\n","//\n// Pager pagination\n// --------------------------------------------------\n\n\n.pager {\n  padding-left: 0;\n  margin: @line-height-computed 0;\n  list-style: none;\n  text-align: center;\n  &:extend(.clearfix all);\n  li {\n    display: inline;\n    > a,\n    > span {\n      display: inline-block;\n      padding: 5px 14px;\n      background-color: @pager-bg;\n      border: 1px solid @pager-border;\n      border-radius: @pager-border-radius;\n    }\n\n    > a:hover,\n    > a:focus {\n      text-decoration: none;\n      background-color: @pager-hover-bg;\n    }\n  }\n\n  .next {\n    > a,\n    > span {\n      float: right;\n    }\n  }\n\n  .previous {\n    > a,\n    > span {\n      float: left;\n    }\n  }\n\n  .disabled {\n    > a,\n    > a:hover,\n    > a:focus,\n    > span {\n      color: @pager-disabled-color;\n      background-color: @pager-bg;\n      cursor: not-allowed;\n    }\n  }\n\n}\n","//\n// Labels\n// --------------------------------------------------\n\n.label {\n  display: inline;\n  padding: .2em .6em .3em;\n  font-size: 75%;\n  font-weight: bold;\n  line-height: 1;\n  color: @label-color;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: baseline;\n  border-radius: .25em;\n\n  // Add hover effects, but only for links\n  &[href] {\n    &:hover,\n    &:focus {\n      color: @label-link-hover-color;\n      text-decoration: none;\n      cursor: pointer;\n    }\n  }\n\n  // Empty labels collapse automatically (not available in IE8)\n  &:empty {\n    display: none;\n  }\n\n  // Quick fix for labels in buttons\n  .btn & {\n    position: relative;\n    top: -1px;\n  }\n}\n\n// Colors\n// Contextual variations (linked labels get darker on :hover)\n\n.label-default {\n  .label-variant(@label-default-bg);\n}\n\n.label-primary {\n  .label-variant(@label-primary-bg);\n}\n\n.label-success {\n  .label-variant(@label-success-bg);\n}\n\n.label-info {\n  .label-variant(@label-info-bg);\n}\n\n.label-warning {\n  .label-variant(@label-warning-bg);\n}\n\n.label-danger {\n  .label-variant(@label-danger-bg);\n}\n","//\n// Badges\n// --------------------------------------------------\n\n\n// Base classes\n.badge {\n  display: inline-block;\n  min-width: 10px;\n  padding: 3px 7px;\n  font-size: @font-size-small;\n  font-weight: @badge-font-weight;\n  color: @badge-color;\n  line-height: @badge-line-height;\n  vertical-align: baseline;\n  white-space: nowrap;\n  text-align: center;\n  background-color: @badge-bg;\n  border-radius: @badge-border-radius;\n\n  // Empty badges collapse automatically (not available in IE8)\n  &:empty {\n    display: none;\n  }\n\n  // Quick fix for badges in buttons\n  .btn & {\n    position: relative;\n    top: -1px;\n  }\n  .btn-xs & {\n    top: 0;\n    padding: 1px 5px;\n  }\n}\n\n// Hover state, but only for links\na.badge {\n  &:hover,\n  &:focus {\n    color: @badge-link-hover-color;\n    text-decoration: none;\n    cursor: pointer;\n  }\n}\n\n// Account for counters in navs\na.list-group-item.active > .badge,\n.nav-pills > .active > a > .badge {\n  color: @badge-active-color;\n  background-color: @badge-active-bg;\n}\n.nav-pills > li > a > .badge {\n  margin-left: 3px;\n}\n","//\n// Jumbotron\n// --------------------------------------------------\n\n\n.jumbotron {\n  padding: @jumbotron-padding;\n  margin-bottom: @jumbotron-padding;\n  color: @jumbotron-color;\n  background-color: @jumbotron-bg;\n\n  h1,\n  .h1 {\n    color: @jumbotron-heading-color;\n  }\n  p {\n    margin-bottom: (@jumbotron-padding / 2);\n    font-size: @jumbotron-font-size;\n    font-weight: 200;\n  }\n\n  .container & {\n    border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container\n  }\n\n  .container {\n    max-width: 100%;\n  }\n\n  @media screen and (min-width: @screen-sm-min) {\n    padding-top:    (@jumbotron-padding * 1.6);\n    padding-bottom: (@jumbotron-padding * 1.6);\n\n    .container & {\n      padding-left:  (@jumbotron-padding * 2);\n      padding-right: (@jumbotron-padding * 2);\n    }\n\n    h1,\n    .h1 {\n      font-size: (@font-size-base * 4.5);\n    }\n  }\n}\n","//\n// Alerts\n// --------------------------------------------------\n\n\n// Base styles\n// -------------------------\n\n.alert {\n  padding: @alert-padding;\n  margin-bottom: @line-height-computed;\n  border: 1px solid transparent;\n  border-radius: @alert-border-radius;\n\n  // Headings for larger alerts\n  h4 {\n    margin-top: 0;\n    // Specified for the h4 to prevent conflicts of changing @headings-color\n    color: inherit;\n  }\n  // Provide class for links that match alerts\n  .alert-link {\n    font-weight: @alert-link-font-weight;\n  }\n\n  // Improve alignment and spacing of inner content\n  > p,\n  > ul {\n    margin-bottom: 0;\n  }\n  > p + p {\n    margin-top: 5px;\n  }\n}\n\n// Dismissable alerts\n//\n// Expand the right padding and account for the close button's positioning.\n\n.alert-dismissable {\n padding-right: (@alert-padding + 20);\n\n  // Adjust close link position\n  .close {\n    position: relative;\n    top: -2px;\n    right: -21px;\n    color: inherit;\n  }\n}\n\n// Alternate styles\n//\n// Generate contextual modifier classes for colorizing the alert.\n\n.alert-success {\n  .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text);\n}\n.alert-info {\n  .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text);\n}\n.alert-warning {\n  .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text);\n}\n.alert-danger {\n  .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text);\n}\n","//\n// Progress bars\n// --------------------------------------------------\n\n\n// Bar animations\n// -------------------------\n\n// WebKit\n@-webkit-keyframes progress-bar-stripes {\n  from  { background-position: 40px 0; }\n  to    { background-position: 0 0; }\n}\n\n// Spec and IE10+\n@keyframes progress-bar-stripes {\n  from  { background-position: 40px 0; }\n  to    { background-position: 0 0; }\n}\n\n\n\n// Bar itself\n// -------------------------\n\n// Outer container\n.progress {\n  overflow: hidden;\n  height: @line-height-computed;\n  margin-bottom: @line-height-computed;\n  background-color: @progress-bg;\n  border-radius: @border-radius-base;\n  .box-shadow(inset 0 1px 2px rgba(0,0,0,.1));\n}\n\n// Bar of progress\n.progress-bar {\n  float: left;\n  width: 0%;\n  height: 100%;\n  font-size: @font-size-small;\n  line-height: @line-height-computed;\n  color: @progress-bar-color;\n  text-align: center;\n  background-color: @progress-bar-bg;\n  .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15));\n  .transition(width .6s ease);\n}\n\n// Striped bars\n.progress-striped .progress-bar {\n  #gradient > .striped();\n  background-size: 40px 40px;\n}\n\n// Call animation for the active one\n.progress.active .progress-bar {\n  .animation(progress-bar-stripes 2s linear infinite);\n}\n\n\n\n// Variations\n// -------------------------\n\n.progress-bar-success {\n  .progress-bar-variant(@progress-bar-success-bg);\n}\n\n.progress-bar-info {\n  .progress-bar-variant(@progress-bar-info-bg);\n}\n\n.progress-bar-warning {\n  .progress-bar-variant(@progress-bar-warning-bg);\n}\n\n.progress-bar-danger {\n  .progress-bar-variant(@progress-bar-danger-bg);\n}\n","// Media objects\n// Source: http://stubbornella.org/content/?p=497\n// --------------------------------------------------\n\n\n// Common styles\n// -------------------------\n\n// Clear the floats\n.media,\n.media-body {\n  overflow: hidden;\n  zoom: 1;\n}\n\n// Proper spacing between instances of .media\n.media,\n.media .media {\n  margin-top: 15px;\n}\n.media:first-child {\n  margin-top: 0;\n}\n\n// For images and videos, set to block\n.media-object {\n  display: block;\n}\n\n// Reset margins on headings for tighter default spacing\n.media-heading {\n  margin: 0 0 5px;\n}\n\n\n// Media image alignment\n// -------------------------\n\n.media {\n  > .pull-left {\n    margin-right: 10px;\n  }\n  > .pull-right {\n    margin-left: 10px;\n  }\n}\n\n\n// Media list variation\n// -------------------------\n\n// Undo default ul/ol styles\n.media-list {\n  padding-left: 0;\n  list-style: none;\n}\n","//\n// List groups\n// --------------------------------------------------\n\n\n// Base class\n//\n// Easily usable on <ul>, <ol>, or <div>.\n\n.list-group {\n  // No need to set list-style: none; since .list-group-item is block level\n  margin-bottom: 20px;\n  padding-left: 0; // reset padding because ul and ol\n}\n\n\n// Individual list items\n//\n// Use on `li`s or `div`s within the `.list-group` parent.\n\n.list-group-item {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n  // Place the border on the list items and negative margin up for better styling\n  margin-bottom: -1px;\n  background-color: @list-group-bg;\n  border: 1px solid @list-group-border;\n\n  // Round the first and last items\n  &:first-child {\n    .border-top-radius(@list-group-border-radius);\n  }\n  &:last-child {\n    margin-bottom: 0;\n    .border-bottom-radius(@list-group-border-radius);\n  }\n\n  // Align badges within list items\n  > .badge {\n    float: right;\n  }\n  > .badge + .badge {\n    margin-right: 5px;\n  }\n}\n\n\n// Linked list items\n//\n// Use anchor elements instead of `li`s or `div`s to create linked list items.\n// Includes an extra `.active` modifier class for showing selected items.\n\na.list-group-item {\n  color: @list-group-link-color;\n\n  .list-group-item-heading {\n    color: @list-group-link-heading-color;\n  }\n\n  // Hover state\n  &:hover,\n  &:focus {\n    text-decoration: none;\n    background-color: @list-group-hover-bg;\n  }\n\n  // Active class on item itself, not parent\n  &.active,\n  &.active:hover,\n  &.active:focus {\n    z-index: 2; // Place active items above their siblings for proper border styling\n    color: @list-group-active-color;\n    background-color: @list-group-active-bg;\n    border-color: @list-group-active-border;\n\n    // Force color to inherit for custom content\n    .list-group-item-heading {\n      color: inherit;\n    }\n    .list-group-item-text {\n      color: @list-group-active-text-color;\n    }\n  }\n}\n\n\n// Contextual variants\n//\n// Add modifier classes to change text and background color on individual items.\n// Organizationally, this must come after the `:hover` states.\n\n.list-group-item-variant(success; @state-success-bg; @state-success-text);\n.list-group-item-variant(info; @state-info-bg; @state-info-text);\n.list-group-item-variant(warning; @state-warning-bg; @state-warning-text);\n.list-group-item-variant(danger; @state-danger-bg; @state-danger-text);\n\n\n// Custom content options\n//\n// Extra classes for creating well-formatted content within `.list-group-item`s.\n\n.list-group-item-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n.list-group-item-text {\n  margin-bottom: 0;\n  line-height: 1.3;\n}\n","//\n// Panels\n// --------------------------------------------------\n\n\n// Base class\n.panel {\n  margin-bottom: @line-height-computed;\n  background-color: @panel-bg;\n  border: 1px solid transparent;\n  border-radius: @panel-border-radius;\n  .box-shadow(0 1px 1px rgba(0,0,0,.05));\n}\n\n// Panel contents\n.panel-body {\n  padding: @panel-body-padding;\n  &:extend(.clearfix all);\n}\n\n// Optional heading\n.panel-heading {\n  padding: 10px 15px;\n  border-bottom: 1px solid transparent;\n  .border-top-radius((@panel-border-radius - 1));\n\n  > .dropdown .dropdown-toggle {\n    color: inherit;\n  }\n}\n\n// Within heading, strip any `h*` tag of its default margins for spacing.\n.panel-title {\n  margin-top: 0;\n  margin-bottom: 0;\n  font-size: ceil((@font-size-base * 1.125));\n  color: inherit;\n\n  > a {\n    color: inherit;\n  }\n}\n\n// Optional footer (stays gray in every modifier class)\n.panel-footer {\n  padding: 10px 15px;\n  background-color: @panel-footer-bg;\n  border-top: 1px solid @panel-inner-border;\n  .border-bottom-radius((@panel-border-radius - 1));\n}\n\n\n// List groups in panels\n//\n// By default, space out list group content from panel headings to account for\n// any kind of custom content between the two.\n\n.panel {\n  > .list-group {\n    margin-bottom: 0;\n\n    .list-group-item {\n      border-width: 1px 0;\n      border-radius: 0;\n    }\n\n    // Add border top radius for first one\n    &:first-child {\n      .list-group-item:first-child {\n        border-top: 0;\n        .border-top-radius((@panel-border-radius - 1));\n      }\n    }\n    // Add border bottom radius for last one\n    &:last-child {\n      .list-group-item:last-child {\n        border-bottom: 0;\n        .border-bottom-radius((@panel-border-radius - 1));\n      }\n    }\n  }\n}\n// Collapse space between when there's no additional content.\n.panel-heading + .list-group {\n  .list-group-item:first-child {\n    border-top-width: 0;\n  }\n}\n\n\n// Tables in panels\n//\n// Place a non-bordered `.table` within a panel (not within a `.panel-body`) and\n// watch it go full width.\n\n.panel {\n  > .table,\n  > .table-responsive > .table {\n    margin-bottom: 0;\n  }\n  // Add border top radius for first one\n  > .table:first-child,\n  > .table-responsive:first-child > .table:first-child {\n    .border-top-radius((@panel-border-radius - 1));\n\n    > thead:first-child,\n    > tbody:first-child {\n      > tr:first-child {\n        td:first-child,\n        th:first-child {\n          border-top-left-radius: (@panel-border-radius - 1);\n        }\n        td:last-child,\n        th:last-child {\n          border-top-right-radius: (@panel-border-radius - 1);\n        }\n      }\n    }\n  }\n  // Add border bottom radius for last one\n  > .table:last-child,\n  > .table-responsive:last-child > .table:last-child {\n    .border-bottom-radius((@panel-border-radius - 1));\n\n    > tbody:last-child,\n    > tfoot:last-child {\n      > tr:last-child {\n        td:first-child,\n        th:first-child {\n          border-bottom-left-radius: (@panel-border-radius - 1);\n        }\n        td:last-child,\n        th:last-child {\n          border-bottom-right-radius: (@panel-border-radius - 1);\n        }\n      }\n    }\n  }\n  > .panel-body + .table,\n  > .panel-body + .table-responsive {\n    border-top: 1px solid @table-border-color;\n  }\n  > .table > tbody:first-child > tr:first-child th,\n  > .table > tbody:first-child > tr:first-child td {\n    border-top: 0;\n  }\n  > .table-bordered,\n  > .table-responsive > .table-bordered {\n    border: 0;\n    > thead,\n    > tbody,\n    > tfoot {\n      > tr {\n        > th:first-child,\n        > td:first-child {\n          border-left: 0;\n        }\n        > th:last-child,\n        > td:last-child {\n          border-right: 0;\n        }\n      }\n    }\n    > thead,\n    > tbody {\n      > tr:first-child {\n        > td,\n        > th {\n          border-bottom: 0;\n        }\n      }\n    }\n    > tbody,\n    > tfoot {\n      > tr:last-child {\n        > td,\n        > th {\n          border-bottom: 0;\n        }\n      }\n    }\n  }\n  > .table-responsive {\n    border: 0;\n    margin-bottom: 0;\n  }\n}\n\n\n// Collapsable panels (aka, accordion)\n//\n// Wrap a series of panels in `.panel-group` to turn them into an accordion with\n// the help of our collapse JavaScript plugin.\n\n.panel-group {\n  margin-bottom: @line-height-computed;\n\n  // Tighten up margin so it's only between panels\n  .panel {\n    margin-bottom: 0;\n    border-radius: @panel-border-radius;\n    overflow: hidden; // crop contents when collapsed\n    + .panel {\n      margin-top: 5px;\n    }\n  }\n\n  .panel-heading {\n    border-bottom: 0;\n    + .panel-collapse .panel-body {\n      border-top: 1px solid @panel-inner-border;\n    }\n  }\n  .panel-footer {\n    border-top: 0;\n    + .panel-collapse .panel-body {\n      border-bottom: 1px solid @panel-inner-border;\n    }\n  }\n}\n\n\n// Contextual variations\n.panel-default {\n  .panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);\n}\n.panel-primary {\n  .panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border);\n}\n.panel-success {\n  .panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);\n}\n.panel-info {\n  .panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);\n}\n.panel-warning {\n  .panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);\n}\n.panel-danger {\n  .panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);\n}\n","//\n// Wells\n// --------------------------------------------------\n\n\n// Base class\n.well {\n  min-height: 20px;\n  padding: 19px;\n  margin-bottom: 20px;\n  background-color: @well-bg;\n  border: 1px solid @well-border;\n  border-radius: @border-radius-base;\n  .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));\n  blockquote {\n    border-color: #ddd;\n    border-color: rgba(0,0,0,.15);\n  }\n}\n\n// Sizes\n.well-lg {\n  padding: 24px;\n  border-radius: @border-radius-large;\n}\n.well-sm {\n  padding: 9px;\n  border-radius: @border-radius-small;\n}\n","//\n// Close icons\n// --------------------------------------------------\n\n\n.close {\n  float: right;\n  font-size: (@font-size-base * 1.5);\n  font-weight: @close-font-weight;\n  line-height: 1;\n  color: @close-color;\n  text-shadow: @close-text-shadow;\n  .opacity(.2);\n\n  &:hover,\n  &:focus {\n    color: @close-color;\n    text-decoration: none;\n    cursor: pointer;\n    .opacity(.5);\n  }\n\n  // Additional properties for button version\n  // iOS requires the button element instead of an anchor tag.\n  // If you want the anchor version, it requires `href=\"#\"`.\n  button& {\n    padding: 0;\n    cursor: pointer;\n    background: transparent;\n    border: 0;\n    -webkit-appearance: none;\n  }\n}\n","//\n// Modals\n// --------------------------------------------------\n\n// .modal-open      - body class for killing the scroll\n// .modal           - container to scroll within\n// .modal-dialog    - positioning shell for the actual modal\n// .modal-content   - actual modal w/ bg and corners and shit\n\n// Kill the scroll on the body\n.modal-open {\n  overflow: hidden;\n}\n\n// Container that the modal scrolls within\n.modal {\n  display: none;\n  overflow: auto;\n  overflow-y: scroll;\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: @zindex-modal;\n  -webkit-overflow-scrolling: touch;\n\n  // Prevent Chrome on Windows from adding a focus outline. For details, see\n  // https://github.com/twbs/bootstrap/pull/10951.\n  outline: 0;\n\n  // When fading in the modal, animate it to slide down\n  &.fade .modal-dialog {\n    .translate(0, -25%);\n    .transition-transform(~\"0.3s ease-out\");\n  }\n  &.in .modal-dialog { .translate(0, 0)}\n}\n\n// Shell div to position the modal with bottom padding\n.modal-dialog {\n  position: relative;\n  width: auto;\n  margin: 10px;\n}\n\n// Actual modal\n.modal-content {\n  position: relative;\n  background-color: @modal-content-bg;\n  border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc)\n  border: 1px solid @modal-content-border-color;\n  border-radius: @border-radius-large;\n  .box-shadow(0 3px 9px rgba(0,0,0,.5));\n  background-clip: padding-box;\n  // Remove focus outline from opened modal\n  outline: none;\n}\n\n// Modal background\n.modal-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: @zindex-modal-background;\n  background-color: @modal-backdrop-bg;\n  // Fade for backdrop\n  &.fade { .opacity(0); }\n  &.in { .opacity(@modal-backdrop-opacity); }\n}\n\n// Modal header\n// Top section of the modal w/ title and dismiss\n.modal-header {\n  padding: @modal-title-padding;\n  border-bottom: 1px solid @modal-header-border-color;\n  min-height: (@modal-title-padding + @modal-title-line-height);\n}\n// Close icon\n.modal-header .close {\n  margin-top: -2px;\n}\n\n// Title text within header\n.modal-title {\n  margin: 0;\n  line-height: @modal-title-line-height;\n}\n\n// Modal body\n// Where all modal content resides (sibling of .modal-header and .modal-footer)\n.modal-body {\n  position: relative;\n  padding: @modal-inner-padding;\n}\n\n// Footer (for actions)\n.modal-footer {\n  margin-top: 15px;\n  padding: (@modal-inner-padding - 1) @modal-inner-padding @modal-inner-padding;\n  text-align: right; // right align buttons\n  border-top: 1px solid @modal-footer-border-color;\n  &:extend(.clearfix all); // clear it in case folks use .pull-* classes on buttons\n\n  // Properly space out buttons\n  .btn + .btn {\n    margin-left: 5px;\n    margin-bottom: 0; // account for input[type=\"submit\"] which gets the bottom margin like all other inputs\n  }\n  // but override that for button groups\n  .btn-group .btn + .btn {\n    margin-left: -1px;\n  }\n  // and override it for block buttons as well\n  .btn-block + .btn-block {\n    margin-left: 0;\n  }\n}\n\n// Scale up the modal\n@media (min-width: @screen-sm-min) {\n  // Automatically set modal's width for larger viewports\n  .modal-dialog {\n    width: @modal-md;\n    margin: 30px auto;\n  }\n  .modal-content {\n    .box-shadow(0 5px 15px rgba(0,0,0,.5));\n  }\n\n  // Modal sizes\n  .modal-sm { width: @modal-sm; }\n}\n\n@media (min-width: @screen-md-min) {\n  .modal-lg { width: @modal-lg; }\n}\n","//\n// Tooltips\n// --------------------------------------------------\n\n\n// Base class\n.tooltip {\n  position: absolute;\n  z-index: @zindex-tooltip;\n  display: block;\n  visibility: visible;\n  font-size: @font-size-small;\n  line-height: 1.4;\n  .opacity(0);\n\n  &.in     { .opacity(@tooltip-opacity); }\n  &.top    { margin-top:  -3px; padding: @tooltip-arrow-width 0; }\n  &.right  { margin-left:  3px; padding: 0 @tooltip-arrow-width; }\n  &.bottom { margin-top:   3px; padding: @tooltip-arrow-width 0; }\n  &.left   { margin-left: -3px; padding: 0 @tooltip-arrow-width; }\n}\n\n// Wrapper for the tooltip content\n.tooltip-inner {\n  max-width: @tooltip-max-width;\n  padding: 3px 8px;\n  color: @tooltip-color;\n  text-align: center;\n  text-decoration: none;\n  background-color: @tooltip-bg;\n  border-radius: @border-radius-base;\n}\n\n// Arrows\n.tooltip-arrow {\n  position: absolute;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.tooltip {\n  &.top .tooltip-arrow {\n    bottom: 0;\n    left: 50%;\n    margin-left: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-top-color: @tooltip-arrow-color;\n  }\n  &.top-left .tooltip-arrow {\n    bottom: 0;\n    left: @tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-top-color: @tooltip-arrow-color;\n  }\n  &.top-right .tooltip-arrow {\n    bottom: 0;\n    right: @tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-top-color: @tooltip-arrow-color;\n  }\n  &.right .tooltip-arrow {\n    top: 50%;\n    left: 0;\n    margin-top: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;\n    border-right-color: @tooltip-arrow-color;\n  }\n  &.left .tooltip-arrow {\n    top: 50%;\n    right: 0;\n    margin-top: -@tooltip-arrow-width;\n    border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-left-color: @tooltip-arrow-color;\n  }\n  &.bottom .tooltip-arrow {\n    top: 0;\n    left: 50%;\n    margin-left: -@tooltip-arrow-width;\n    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-bottom-color: @tooltip-arrow-color;\n  }\n  &.bottom-left .tooltip-arrow {\n    top: 0;\n    left: @tooltip-arrow-width;\n    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-bottom-color: @tooltip-arrow-color;\n  }\n  &.bottom-right .tooltip-arrow {\n    top: 0;\n    right: @tooltip-arrow-width;\n    border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;\n    border-bottom-color: @tooltip-arrow-color;\n  }\n}\n","//\n// Popovers\n// --------------------------------------------------\n\n\n.popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: @zindex-popover;\n  display: none;\n  max-width: @popover-max-width;\n  padding: 1px;\n  text-align: left; // Reset given new insertion method\n  background-color: @popover-bg;\n  background-clip: padding-box;\n  border: 1px solid @popover-fallback-border-color;\n  border: 1px solid @popover-border-color;\n  border-radius: @border-radius-large;\n  .box-shadow(0 5px 10px rgba(0,0,0,.2));\n\n  // Overrides for proper insertion\n  white-space: normal;\n\n  // Offset the popover to account for the popover arrow\n  &.top     { margin-top: -@popover-arrow-width; }\n  &.right   { margin-left: @popover-arrow-width; }\n  &.bottom  { margin-top: @popover-arrow-width; }\n  &.left    { margin-left: -@popover-arrow-width; }\n}\n\n.popover-title {\n  margin: 0; // reset heading margin\n  padding: 8px 14px;\n  font-size: @font-size-base;\n  font-weight: normal;\n  line-height: 18px;\n  background-color: @popover-title-bg;\n  border-bottom: 1px solid darken(@popover-title-bg, 5%);\n  border-radius: 5px 5px 0 0;\n}\n\n.popover-content {\n  padding: 9px 14px;\n}\n\n// Arrows\n//\n// .arrow is outer, .arrow:after is inner\n\n.popover > .arrow {\n  &,\n  &:after {\n    position: absolute;\n    display: block;\n    width: 0;\n    height: 0;\n    border-color: transparent;\n    border-style: solid;\n  }\n}\n.popover > .arrow {\n  border-width: @popover-arrow-outer-width;\n}\n.popover > .arrow:after {\n  border-width: @popover-arrow-width;\n  content: \"\";\n}\n\n.popover {\n  &.top > .arrow {\n    left: 50%;\n    margin-left: -@popover-arrow-outer-width;\n    border-bottom-width: 0;\n    border-top-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-top-color: @popover-arrow-outer-color;\n    bottom: -@popover-arrow-outer-width;\n    &:after {\n      content: \" \";\n      bottom: 1px;\n      margin-left: -@popover-arrow-width;\n      border-bottom-width: 0;\n      border-top-color: @popover-arrow-color;\n    }\n  }\n  &.right > .arrow {\n    top: 50%;\n    left: -@popover-arrow-outer-width;\n    margin-top: -@popover-arrow-outer-width;\n    border-left-width: 0;\n    border-right-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-right-color: @popover-arrow-outer-color;\n    &:after {\n      content: \" \";\n      left: 1px;\n      bottom: -@popover-arrow-width;\n      border-left-width: 0;\n      border-right-color: @popover-arrow-color;\n    }\n  }\n  &.bottom > .arrow {\n    left: 50%;\n    margin-left: -@popover-arrow-outer-width;\n    border-top-width: 0;\n    border-bottom-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-bottom-color: @popover-arrow-outer-color;\n    top: -@popover-arrow-outer-width;\n    &:after {\n      content: \" \";\n      top: 1px;\n      margin-left: -@popover-arrow-width;\n      border-top-width: 0;\n      border-bottom-color: @popover-arrow-color;\n    }\n  }\n\n  &.left > .arrow {\n    top: 50%;\n    right: -@popover-arrow-outer-width;\n    margin-top: -@popover-arrow-outer-width;\n    border-right-width: 0;\n    border-left-color: @popover-arrow-outer-fallback-color; // IE8 fallback\n    border-left-color: @popover-arrow-outer-color;\n    &:after {\n      content: \" \";\n      right: 1px;\n      border-right-width: 0;\n      border-left-color: @popover-arrow-color;\n      bottom: -@popover-arrow-width;\n    }\n  }\n\n}\n","//\n// Responsive: Utility classes\n// --------------------------------------------------\n\n\n// IE10 in Windows (Phone) 8\n//\n// Support for responsive views via media queries is kind of borked in IE10, for\n// Surface/desktop in split view and for Windows Phone 8. This particular fix\n// must be accompanied by a snippet of JavaScript to sniff the user agent and\n// apply some conditional CSS to *only* the Surface/desktop Windows 8. Look at\n// our Getting Started page for more information on this bug.\n//\n// For more information, see the following:\n//\n// Issue: https://github.com/twbs/bootstrap/issues/10497\n// Docs: http://getbootstrap.com/getting-started/#browsers\n// Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/\n\n@-ms-viewport {\n  width: device-width;\n}\n\n\n// Visibility utilities\n.visible-xs,\n.visible-sm,\n.visible-md,\n.visible-lg {\n  .responsive-invisibility();\n}\n\n.visible-xs {\n  @media (max-width: @screen-xs-max) {\n    .responsive-visibility();\n  }\n}\n.visible-sm {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    .responsive-visibility();\n  }\n}\n.visible-md {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    .responsive-visibility();\n  }\n}\n.visible-lg {\n  @media (min-width: @screen-lg-min) {\n    .responsive-visibility();\n  }\n}\n\n.hidden-xs {\n  @media (max-width: @screen-xs-max) {\n    .responsive-invisibility();\n  }\n}\n.hidden-sm {\n  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {\n    .responsive-invisibility();\n  }\n}\n.hidden-md {\n  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {\n    .responsive-invisibility();\n  }\n}\n.hidden-lg {\n  @media (min-width: @screen-lg-min) {\n    .responsive-invisibility();\n  }\n}\n\n\n// Print utilities\n//\n// Media queries are placed on the inside to be mixin-friendly.\n\n.visible-print {\n  .responsive-invisibility();\n\n  @media print {\n    .responsive-visibility();\n  }\n}\n\n.hidden-print {\n  @media print {\n    .responsive-invisibility();\n  }\n}\n"]}
\ No newline at end of file
diff --git a/setup/pub/bootstrap/css/bootstrap.min.css b/setup/pub/bootstrap/css/bootstrap.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..679272d25859d55e9931101ef56656e2c50e5ea5
--- /dev/null
+++ b/setup/pub/bootstrap/css/bootstrap.min.css
@@ -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/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.eot b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.eot
new file mode 100644
index 0000000000000000000000000000000000000000..4a4ca865d67e86f961bc6e2ef00bffa4e34bb9ed
Binary files /dev/null and b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.eot differ
diff --git a/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.svg b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.svg
new file mode 100644
index 0000000000000000000000000000000000000000..e3e2dc739dd851f2d7d291be032e30b909e3e95f
--- /dev/null
+++ b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.svg
@@ -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/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.ttf b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..67fa00bf83801d2fa568546b982c80d27f6ef74e
Binary files /dev/null and b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.ttf differ
diff --git a/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.woff b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.woff
new file mode 100644
index 0000000000000000000000000000000000000000..8c54182aa5d4d1ab3c9171976b615c1dcb1dc187
Binary files /dev/null and b/setup/pub/bootstrap/fonts/glyphicons-halflings-regular.woff differ
diff --git a/setup/pub/bootstrap/js/bootstrap.js b/setup/pub/bootstrap/js/bootstrap.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ae571b6da5be9c7dcd95ba25896ae39e1917445
--- /dev/null
+++ b/setup/pub/bootstrap/js/bootstrap.js
@@ -0,0 +1,1951 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
+
+/* ========================================================================
+ * Bootstrap: transition.js v3.1.1
+ * http://getbootstrap.com/javascript/#transitions
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
+  // ============================================================
+
+  function transitionEnd() {
+    var el = document.createElement('bootstrap')
+
+    var transEndEventNames = {
+      'WebkitTransition' : 'webkitTransitionEnd',
+      'MozTransition'    : 'transitionend',
+      'OTransition'      : 'oTransitionEnd otransitionend',
+      'transition'       : 'transitionend'
+    }
+
+    for (var name in transEndEventNames) {
+      if (el.style[name] !== undefined) {
+        return { end: transEndEventNames[name] }
+      }
+    }
+
+    return false // explicit for ie8 (  ._.)
+  }
+
+  // http://blog.alexmaccaw.com/css-transitions
+  $.fn.emulateTransitionEnd = function (duration) {
+    var called = false, $el = this
+    $(this).one($.support.transition.end, function () { called = true })
+    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
+    setTimeout(callback, duration)
+    return this
+  }
+
+  $(function () {
+    $.support.transition = transitionEnd()
+  })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: alert.js v3.1.1
+ * http://getbootstrap.com/javascript/#alerts
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // ALERT CLASS DEFINITION
+  // ======================
+
+  var dismiss = '[data-dismiss="alert"]'
+  var Alert   = function (el) {
+    $(el).on('click', dismiss, this.close)
+  }
+
+  Alert.prototype.close = function (e) {
+    var $this    = $(this)
+    var selector = $this.attr('data-target')
+
+    if (!selector) {
+      selector = $this.attr('href')
+      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
+    }
+
+    var $parent = $(selector)
+
+    if (e) e.preventDefault()
+
+    if (!$parent.length) {
+      $parent = $this.hasClass('alert') ? $this : $this.parent()
+    }
+
+    $parent.trigger(e = $.Event('close.bs.alert'))
+
+    if (e.isDefaultPrevented()) return
+
+    $parent.removeClass('in')
+
+    function removeElement() {
+      $parent.trigger('closed.bs.alert').remove()
+    }
+
+    $.support.transition && $parent.hasClass('fade') ?
+      $parent
+        .one($.support.transition.end, removeElement)
+        .emulateTransitionEnd(150) :
+      removeElement()
+  }
+
+
+  // ALERT PLUGIN DEFINITION
+  // =======================
+
+  var old = $.fn.alert
+
+  $.fn.alert = function (option) {
+    return this.each(function () {
+      var $this = $(this)
+      var data  = $this.data('bs.alert')
+
+      if (!data) $this.data('bs.alert', (data = new Alert(this)))
+      if (typeof option == 'string') data[option].call($this)
+    })
+  }
+
+  $.fn.alert.Constructor = Alert
+
+
+  // ALERT NO CONFLICT
+  // =================
+
+  $.fn.alert.noConflict = function () {
+    $.fn.alert = old
+    return this
+  }
+
+
+  // ALERT DATA-API
+  // ==============
+
+  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: button.js v3.1.1
+ * http://getbootstrap.com/javascript/#buttons
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // BUTTON PUBLIC CLASS DEFINITION
+  // ==============================
+
+  var Button = function (element, options) {
+    this.$element  = $(element)
+    this.options   = $.extend({}, Button.DEFAULTS, options)
+    this.isLoading = false
+  }
+
+  Button.DEFAULTS = {
+    loadingText: 'loading...'
+  }
+
+  Button.prototype.setState = function (state) {
+    var d    = 'disabled'
+    var $el  = this.$element
+    var val  = $el.is('input') ? 'val' : 'html'
+    var data = $el.data()
+
+    state = state + 'Text'
+
+    if (!data.resetText) $el.data('resetText', $el[val]())
+
+    $el[val](data[state] || this.options[state])
+
+    // push to event loop to allow forms to submit
+    setTimeout($.proxy(function () {
+      if (state == 'loadingText') {
+        this.isLoading = true
+        $el.addClass(d).attr(d, d)
+      } else if (this.isLoading) {
+        this.isLoading = false
+        $el.removeClass(d).removeAttr(d)
+      }
+    }, this), 0)
+  }
+
+  Button.prototype.toggle = function () {
+    var changed = true
+    var $parent = this.$element.closest('[data-toggle="buttons"]')
+
+    if ($parent.length) {
+      var $input = this.$element.find('input')
+      if ($input.prop('type') == 'radio') {
+        if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
+        else $parent.find('.active').removeClass('active')
+      }
+      if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
+    }
+
+    if (changed) this.$element.toggleClass('active')
+  }
+
+
+  // BUTTON PLUGIN DEFINITION
+  // ========================
+
+  var old = $.fn.button
+
+  $.fn.button = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.button')
+      var options = typeof option == 'object' && option
+
+      if (!data) $this.data('bs.button', (data = new Button(this, options)))
+
+      if (option == 'toggle') data.toggle()
+      else if (option) data.setState(option)
+    })
+  }
+
+  $.fn.button.Constructor = Button
+
+
+  // BUTTON NO CONFLICT
+  // ==================
+
+  $.fn.button.noConflict = function () {
+    $.fn.button = old
+    return this
+  }
+
+
+  // BUTTON DATA-API
+  // ===============
+
+  $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
+    var $btn = $(e.target)
+    if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
+    $btn.button('toggle')
+    e.preventDefault()
+  })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: carousel.js v3.1.1
+ * http://getbootstrap.com/javascript/#carousel
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // CAROUSEL CLASS DEFINITION
+  // =========================
+
+  var Carousel = function (element, options) {
+    this.$element    = $(element)
+    this.$indicators = this.$element.find('.carousel-indicators')
+    this.options     = options
+    this.paused      =
+    this.sliding     =
+    this.interval    =
+    this.$active     =
+    this.$items      = null
+
+    this.options.pause == 'hover' && this.$element
+      .on('mouseenter', $.proxy(this.pause, this))
+      .on('mouseleave', $.proxy(this.cycle, this))
+  }
+
+  Carousel.DEFAULTS = {
+    interval: 5000,
+    pause: 'hover',
+    wrap: true
+  }
+
+  Carousel.prototype.cycle =  function (e) {
+    e || (this.paused = false)
+
+    this.interval && clearInterval(this.interval)
+
+    this.options.interval
+      && !this.paused
+      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
+
+    return this
+  }
+
+  Carousel.prototype.getActiveIndex = function () {
+    this.$active = this.$element.find('.item.active')
+    this.$items  = this.$active.parent().children()
+
+    return this.$items.index(this.$active)
+  }
+
+  Carousel.prototype.to = function (pos) {
+    var that        = this
+    var activeIndex = this.getActiveIndex()
+
+    if (pos > (this.$items.length - 1) || pos < 0) return
+
+    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
+    if (activeIndex == pos) return this.pause().cycle()
+
+    return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
+  }
+
+  Carousel.prototype.pause = function (e) {
+    e || (this.paused = true)
+
+    if (this.$element.find('.next, .prev').length && $.support.transition) {
+      this.$element.trigger($.support.transition.end)
+      this.cycle(true)
+    }
+
+    this.interval = clearInterval(this.interval)
+
+    return this
+  }
+
+  Carousel.prototype.next = function () {
+    if (this.sliding) return
+    return this.slide('next')
+  }
+
+  Carousel.prototype.prev = function () {
+    if (this.sliding) return
+    return this.slide('prev')
+  }
+
+  Carousel.prototype.slide = function (type, next) {
+    var $active   = this.$element.find('.item.active')
+    var $next     = next || $active[type]()
+    var isCycling = this.interval
+    var direction = type == 'next' ? 'left' : 'right'
+    var fallback  = type == 'next' ? 'first' : 'last'
+    var that      = this
+
+    if (!$next.length) {
+      if (!this.options.wrap) return
+      $next = this.$element.find('.item')[fallback]()
+    }
+
+    if ($next.hasClass('active')) return this.sliding = false
+
+    var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
+    this.$element.trigger(e)
+    if (e.isDefaultPrevented()) return
+
+    this.sliding = true
+
+    isCycling && this.pause()
+
+    if (this.$indicators.length) {
+      this.$indicators.find('.active').removeClass('active')
+      this.$element.one('slid.bs.carousel', function () {
+        var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
+        $nextIndicator && $nextIndicator.addClass('active')
+      })
+    }
+
+    if ($.support.transition && this.$element.hasClass('slide')) {
+      $next.addClass(type)
+      $next[0].offsetWidth // force reflow
+      $active.addClass(direction)
+      $next.addClass(direction)
+      $active
+        .one($.support.transition.end, function () {
+          $next.removeClass([type, direction].join(' ')).addClass('active')
+          $active.removeClass(['active', direction].join(' '))
+          that.sliding = false
+          setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
+        })
+        .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
+    } else {
+      $active.removeClass('active')
+      $next.addClass('active')
+      this.sliding = false
+      this.$element.trigger('slid.bs.carousel')
+    }
+
+    isCycling && this.cycle()
+
+    return this
+  }
+
+
+  // CAROUSEL PLUGIN DEFINITION
+  // ==========================
+
+  var old = $.fn.carousel
+
+  $.fn.carousel = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.carousel')
+      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
+      var action  = typeof option == 'string' ? option : options.slide
+
+      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
+      if (typeof option == 'number') data.to(option)
+      else if (action) data[action]()
+      else if (options.interval) data.pause().cycle()
+    })
+  }
+
+  $.fn.carousel.Constructor = Carousel
+
+
+  // CAROUSEL NO CONFLICT
+  // ====================
+
+  $.fn.carousel.noConflict = function () {
+    $.fn.carousel = old
+    return this
+  }
+
+
+  // CAROUSEL DATA-API
+  // =================
+
+  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
+    var $this   = $(this), href
+    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+    var options = $.extend({}, $target.data(), $this.data())
+    var slideIndex = $this.attr('data-slide-to')
+    if (slideIndex) options.interval = false
+
+    $target.carousel(options)
+
+    if (slideIndex = $this.attr('data-slide-to')) {
+      $target.data('bs.carousel').to(slideIndex)
+    }
+
+    e.preventDefault()
+  })
+
+  $(window).on('load', function () {
+    $('[data-ride="carousel"]').each(function () {
+      var $carousel = $(this)
+      $carousel.carousel($carousel.data())
+    })
+  })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: collapse.js v3.1.1
+ * http://getbootstrap.com/javascript/#collapse
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // COLLAPSE PUBLIC CLASS DEFINITION
+  // ================================
+
+  var Collapse = function (element, options) {
+    this.$element      = $(element)
+    this.options       = $.extend({}, Collapse.DEFAULTS, options)
+    this.transitioning = null
+
+    if (this.options.parent) this.$parent = $(this.options.parent)
+    if (this.options.toggle) this.toggle()
+  }
+
+  Collapse.DEFAULTS = {
+    toggle: true
+  }
+
+  Collapse.prototype.dimension = function () {
+    var hasWidth = this.$element.hasClass('width')
+    return hasWidth ? 'width' : 'height'
+  }
+
+  Collapse.prototype.show = function () {
+    if (this.transitioning || this.$element.hasClass('in')) return
+
+    var startEvent = $.Event('show.bs.collapse')
+    this.$element.trigger(startEvent)
+    if (startEvent.isDefaultPrevented()) return
+
+    var actives = this.$parent && this.$parent.find('> .panel > .in')
+
+    if (actives && actives.length) {
+      var hasData = actives.data('bs.collapse')
+      if (hasData && hasData.transitioning) return
+      actives.collapse('hide')
+      hasData || actives.data('bs.collapse', null)
+    }
+
+    var dimension = this.dimension()
+
+    this.$element
+      .removeClass('collapse')
+      .addClass('collapsing')
+      [dimension](0)
+
+    this.transitioning = 1
+
+    var complete = function () {
+      this.$element
+        .removeClass('collapsing')
+        .addClass('collapse in')
+        [dimension]('auto')
+      this.transitioning = 0
+      this.$element.trigger('shown.bs.collapse')
+    }
+
+    if (!$.support.transition) return complete.call(this)
+
+    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
+
+    this.$element
+      .one($.support.transition.end, $.proxy(complete, this))
+      .emulateTransitionEnd(350)
+      [dimension](this.$element[0][scrollSize])
+  }
+
+  Collapse.prototype.hide = function () {
+    if (this.transitioning || !this.$element.hasClass('in')) return
+
+    var startEvent = $.Event('hide.bs.collapse')
+    this.$element.trigger(startEvent)
+    if (startEvent.isDefaultPrevented()) return
+
+    var dimension = this.dimension()
+
+    this.$element
+      [dimension](this.$element[dimension]())
+      [0].offsetHeight
+
+    this.$element
+      .addClass('collapsing')
+      .removeClass('collapse')
+      .removeClass('in')
+
+    this.transitioning = 1
+
+    var complete = function () {
+      this.transitioning = 0
+      this.$element
+        .trigger('hidden.bs.collapse')
+        .removeClass('collapsing')
+        .addClass('collapse')
+    }
+
+    if (!$.support.transition) return complete.call(this)
+
+    this.$element
+      [dimension](0)
+      .one($.support.transition.end, $.proxy(complete, this))
+      .emulateTransitionEnd(350)
+  }
+
+  Collapse.prototype.toggle = function () {
+    this[this.$element.hasClass('in') ? 'hide' : 'show']()
+  }
+
+
+  // COLLAPSE PLUGIN DEFINITION
+  // ==========================
+
+  var old = $.fn.collapse
+
+  $.fn.collapse = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.collapse')
+      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
+
+      if (!data && options.toggle && option == 'show') option = !option
+      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
+      if (typeof option == 'string') data[option]()
+    })
+  }
+
+  $.fn.collapse.Constructor = Collapse
+
+
+  // COLLAPSE NO CONFLICT
+  // ====================
+
+  $.fn.collapse.noConflict = function () {
+    $.fn.collapse = old
+    return this
+  }
+
+
+  // COLLAPSE DATA-API
+  // =================
+
+  $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
+    var $this   = $(this), href
+    var target  = $this.attr('data-target')
+        || e.preventDefault()
+        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
+    var $target = $(target)
+    var data    = $target.data('bs.collapse')
+    var option  = data ? 'toggle' : $this.data()
+    var parent  = $this.attr('data-parent')
+    var $parent = parent && $(parent)
+
+    if (!data || !data.transitioning) {
+      if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
+      $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
+    }
+
+    $target.collapse(option)
+  })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: dropdown.js v3.1.1
+ * http://getbootstrap.com/javascript/#dropdowns
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // DROPDOWN CLASS DEFINITION
+  // =========================
+
+  var backdrop = '.dropdown-backdrop'
+  var toggle   = '[data-toggle=dropdown]'
+  var Dropdown = function (element) {
+    $(element).on('click.bs.dropdown', this.toggle)
+  }
+
+  Dropdown.prototype.toggle = function (e) {
+    var $this = $(this)
+
+    if ($this.is('.disabled, :disabled')) return
+
+    var $parent  = getParent($this)
+    var isActive = $parent.hasClass('open')
+
+    clearMenus()
+
+    if (!isActive) {
+      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
+        // if mobile we use a backdrop because click events don't delegate
+        $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
+      }
+
+      var relatedTarget = { relatedTarget: this }
+      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
+
+      if (e.isDefaultPrevented()) return
+
+      $parent
+        .toggleClass('open')
+        .trigger('shown.bs.dropdown', relatedTarget)
+
+      $this.focus()
+    }
+
+    return false
+  }
+
+  Dropdown.prototype.keydown = function (e) {
+    if (!/(38|40|27)/.test(e.keyCode)) return
+
+    var $this = $(this)
+
+    e.preventDefault()
+    e.stopPropagation()
+
+    if ($this.is('.disabled, :disabled')) return
+
+    var $parent  = getParent($this)
+    var isActive = $parent.hasClass('open')
+
+    if (!isActive || (isActive && e.keyCode == 27)) {
+      if (e.which == 27) $parent.find(toggle).focus()
+      return $this.click()
+    }
+
+    var desc = ' li:not(.divider):visible a'
+    var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
+
+    if (!$items.length) return
+
+    var index = $items.index($items.filter(':focus'))
+
+    if (e.keyCode == 38 && index > 0)                 index--                        // up
+    if (e.keyCode == 40 && index < $items.length - 1) index++                        // down
+    if (!~index)                                      index = 0
+
+    $items.eq(index).focus()
+  }
+
+  function clearMenus(e) {
+    $(backdrop).remove()
+    $(toggle).each(function () {
+      var $parent = getParent($(this))
+      var relatedTarget = { relatedTarget: this }
+      if (!$parent.hasClass('open')) return
+      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
+      if (e.isDefaultPrevented()) return
+      $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
+    })
+  }
+
+  function getParent($this) {
+    var selector = $this.attr('data-target')
+
+    if (!selector) {
+      selector = $this.attr('href')
+      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+    }
+
+    var $parent = selector && $(selector)
+
+    return $parent && $parent.length ? $parent : $this.parent()
+  }
+
+
+  // DROPDOWN PLUGIN DEFINITION
+  // ==========================
+
+  var old = $.fn.dropdown
+
+  $.fn.dropdown = function (option) {
+    return this.each(function () {
+      var $this = $(this)
+      var data  = $this.data('bs.dropdown')
+
+      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
+      if (typeof option == 'string') data[option].call($this)
+    })
+  }
+
+  $.fn.dropdown.Constructor = Dropdown
+
+
+  // DROPDOWN NO CONFLICT
+  // ====================
+
+  $.fn.dropdown.noConflict = function () {
+    $.fn.dropdown = old
+    return this
+  }
+
+
+  // APPLY TO STANDARD DROPDOWN ELEMENTS
+  // ===================================
+
+  $(document)
+    .on('click.bs.dropdown.data-api', clearMenus)
+    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
+    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
+    .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: modal.js v3.1.1
+ * http://getbootstrap.com/javascript/#modals
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // MODAL CLASS DEFINITION
+  // ======================
+
+  var Modal = function (element, options) {
+    this.options   = options
+    this.$element  = $(element)
+    this.$backdrop =
+    this.isShown   = null
+
+    if (this.options.remote) {
+      this.$element
+        .find('.modal-content')
+        .load(this.options.remote, $.proxy(function () {
+          this.$element.trigger('loaded.bs.modal')
+        }, this))
+    }
+  }
+
+  Modal.DEFAULTS = {
+    backdrop: true,
+    keyboard: true,
+    show: true
+  }
+
+  Modal.prototype.toggle = function (_relatedTarget) {
+    return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
+  }
+
+  Modal.prototype.show = function (_relatedTarget) {
+    var that = this
+    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
+
+    this.$element.trigger(e)
+
+    if (this.isShown || e.isDefaultPrevented()) return
+
+    this.isShown = true
+
+    this.escape()
+
+    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+
+    this.backdrop(function () {
+      var transition = $.support.transition && that.$element.hasClass('fade')
+
+      if (!that.$element.parent().length) {
+        that.$element.appendTo(document.body) // don't move modals dom position
+      }
+
+      that.$element
+        .show()
+        .scrollTop(0)
+
+      if (transition) {
+        that.$element[0].offsetWidth // force reflow
+      }
+
+      that.$element
+        .addClass('in')
+        .attr('aria-hidden', false)
+
+      that.enforceFocus()
+
+      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
+
+      transition ?
+        that.$element.find('.modal-dialog') // wait for modal to slide in
+          .one($.support.transition.end, function () {
+            that.$element.focus().trigger(e)
+          })
+          .emulateTransitionEnd(300) :
+        that.$element.focus().trigger(e)
+    })
+  }
+
+  Modal.prototype.hide = function (e) {
+    if (e) e.preventDefault()
+
+    e = $.Event('hide.bs.modal')
+
+    this.$element.trigger(e)
+
+    if (!this.isShown || e.isDefaultPrevented()) return
+
+    this.isShown = false
+
+    this.escape()
+
+    $(document).off('focusin.bs.modal')
+
+    this.$element
+      .removeClass('in')
+      .attr('aria-hidden', true)
+      .off('click.dismiss.bs.modal')
+
+    $.support.transition && this.$element.hasClass('fade') ?
+      this.$element
+        .one($.support.transition.end, $.proxy(this.hideModal, this))
+        .emulateTransitionEnd(300) :
+      this.hideModal()
+  }
+
+  Modal.prototype.enforceFocus = function () {
+    $(document)
+      .off('focusin.bs.modal') // guard against infinite focus loop
+      .on('focusin.bs.modal', $.proxy(function (e) {
+        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
+          this.$element.focus()
+        }
+      }, this))
+  }
+
+  Modal.prototype.escape = function () {
+    if (this.isShown && this.options.keyboard) {
+      this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
+        e.which == 27 && this.hide()
+      }, this))
+    } else if (!this.isShown) {
+      this.$element.off('keyup.dismiss.bs.modal')
+    }
+  }
+
+  Modal.prototype.hideModal = function () {
+    var that = this
+    this.$element.hide()
+    this.backdrop(function () {
+      that.removeBackdrop()
+      that.$element.trigger('hidden.bs.modal')
+    })
+  }
+
+  Modal.prototype.removeBackdrop = function () {
+    this.$backdrop && this.$backdrop.remove()
+    this.$backdrop = null
+  }
+
+  Modal.prototype.backdrop = function (callback) {
+    var animate = this.$element.hasClass('fade') ? 'fade' : ''
+
+    if (this.isShown && this.options.backdrop) {
+      var doAnimate = $.support.transition && animate
+
+      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
+        .appendTo(document.body)
+
+      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
+        if (e.target !== e.currentTarget) return
+        this.options.backdrop == 'static'
+          ? this.$element[0].focus.call(this.$element[0])
+          : this.hide.call(this)
+      }, this))
+
+      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
+
+      this.$backdrop.addClass('in')
+
+      if (!callback) return
+
+      doAnimate ?
+        this.$backdrop
+          .one($.support.transition.end, callback)
+          .emulateTransitionEnd(150) :
+        callback()
+
+    } else if (!this.isShown && this.$backdrop) {
+      this.$backdrop.removeClass('in')
+
+      $.support.transition && this.$element.hasClass('fade') ?
+        this.$backdrop
+          .one($.support.transition.end, callback)
+          .emulateTransitionEnd(150) :
+        callback()
+
+    } else if (callback) {
+      callback()
+    }
+  }
+
+
+  // MODAL PLUGIN DEFINITION
+  // =======================
+
+  var old = $.fn.modal
+
+  $.fn.modal = function (option, _relatedTarget) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.modal')
+      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
+
+      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
+      if (typeof option == 'string') data[option](_relatedTarget)
+      else if (options.show) data.show(_relatedTarget)
+    })
+  }
+
+  $.fn.modal.Constructor = Modal
+
+
+  // MODAL NO CONFLICT
+  // =================
+
+  $.fn.modal.noConflict = function () {
+    $.fn.modal = old
+    return this
+  }
+
+
+  // MODAL DATA-API
+  // ==============
+
+  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
+    var $this   = $(this)
+    var href    = $this.attr('href')
+    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
+    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
+
+    if ($this.is('a')) e.preventDefault()
+
+    $target
+      .modal(option, this)
+      .one('hide', function () {
+        $this.is(':visible') && $this.focus()
+      })
+  })
+
+  $(document)
+    .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
+    .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: tooltip.js v3.1.1
+ * http://getbootstrap.com/javascript/#tooltip
+ * Inspired by the original jQuery.tipsy by Jason Frame
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // TOOLTIP PUBLIC CLASS DEFINITION
+  // ===============================
+
+  var Tooltip = function (element, options) {
+    this.type       =
+    this.options    =
+    this.enabled    =
+    this.timeout    =
+    this.hoverState =
+    this.$element   = null
+
+    this.init('tooltip', element, options)
+  }
+
+  Tooltip.DEFAULTS = {
+    animation: true,
+    placement: 'top',
+    selector: false,
+    template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
+    trigger: 'hover focus',
+    title: '',
+    delay: 0,
+    html: false,
+    container: false
+  }
+
+  Tooltip.prototype.init = function (type, element, options) {
+    this.enabled  = true
+    this.type     = type
+    this.$element = $(element)
+    this.options  = this.getOptions(options)
+
+    var triggers = this.options.trigger.split(' ')
+
+    for (var i = triggers.length; i--;) {
+      var trigger = triggers[i]
+
+      if (trigger == 'click') {
+        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
+      } else if (trigger != 'manual') {
+        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
+        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
+
+        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
+        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
+      }
+    }
+
+    this.options.selector ?
+      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
+      this.fixTitle()
+  }
+
+  Tooltip.prototype.getDefaults = function () {
+    return Tooltip.DEFAULTS
+  }
+
+  Tooltip.prototype.getOptions = function (options) {
+    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
+
+    if (options.delay && typeof options.delay == 'number') {
+      options.delay = {
+        show: options.delay,
+        hide: options.delay
+      }
+    }
+
+    return options
+  }
+
+  Tooltip.prototype.getDelegateOptions = function () {
+    var options  = {}
+    var defaults = this.getDefaults()
+
+    this._options && $.each(this._options, function (key, value) {
+      if (defaults[key] != value) options[key] = value
+    })
+
+    return options
+  }
+
+  Tooltip.prototype.enter = function (obj) {
+    var self = obj instanceof this.constructor ?
+      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
+
+    clearTimeout(self.timeout)
+
+    self.hoverState = 'in'
+
+    if (!self.options.delay || !self.options.delay.show) return self.show()
+
+    self.timeout = setTimeout(function () {
+      if (self.hoverState == 'in') self.show()
+    }, self.options.delay.show)
+  }
+
+  Tooltip.prototype.leave = function (obj) {
+    var self = obj instanceof this.constructor ?
+      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
+
+    clearTimeout(self.timeout)
+
+    self.hoverState = 'out'
+
+    if (!self.options.delay || !self.options.delay.hide) return self.hide()
+
+    self.timeout = setTimeout(function () {
+      if (self.hoverState == 'out') self.hide()
+    }, self.options.delay.hide)
+  }
+
+  Tooltip.prototype.show = function () {
+    var e = $.Event('show.bs.' + this.type)
+
+    if (this.hasContent() && this.enabled) {
+      this.$element.trigger(e)
+
+      if (e.isDefaultPrevented()) return
+      var that = this;
+
+      var $tip = this.tip()
+
+      this.setContent()
+
+      if (this.options.animation) $tip.addClass('fade')
+
+      var placement = typeof this.options.placement == 'function' ?
+        this.options.placement.call(this, $tip[0], this.$element[0]) :
+        this.options.placement
+
+      var autoToken = /\s?auto?\s?/i
+      var autoPlace = autoToken.test(placement)
+      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
+
+      $tip
+        .detach()
+        .css({ top: 0, left: 0, display: 'block' })
+        .addClass(placement)
+
+      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
+
+      var pos          = this.getPosition()
+      var actualWidth  = $tip[0].offsetWidth
+      var actualHeight = $tip[0].offsetHeight
+
+      if (autoPlace) {
+        var $parent = this.$element.parent()
+
+        var orgPlacement = placement
+        var docScroll    = document.documentElement.scrollTop || document.body.scrollTop
+        var parentWidth  = this.options.container == 'body' ? window.innerWidth  : $parent.outerWidth()
+        var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
+        var parentLeft   = this.options.container == 'body' ? 0 : $parent.offset().left
+
+        placement = placement == 'bottom' && pos.top   + pos.height  + actualHeight - docScroll > parentHeight  ? 'top'    :
+                    placement == 'top'    && pos.top   - docScroll   - actualHeight < 0                         ? 'bottom' :
+                    placement == 'right'  && pos.right + actualWidth > parentWidth                              ? 'left'   :
+                    placement == 'left'   && pos.left  - actualWidth < parentLeft                               ? 'right'  :
+                    placement
+
+        $tip
+          .removeClass(orgPlacement)
+          .addClass(placement)
+      }
+
+      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
+
+      this.applyPlacement(calculatedOffset, placement)
+      this.hoverState = null
+
+      var complete = function() {
+        that.$element.trigger('shown.bs.' + that.type)
+      }
+
+      $.support.transition && this.$tip.hasClass('fade') ?
+        $tip
+          .one($.support.transition.end, complete)
+          .emulateTransitionEnd(150) :
+        complete()
+    }
+  }
+
+  Tooltip.prototype.applyPlacement = function (offset, placement) {
+    var replace
+    var $tip   = this.tip()
+    var width  = $tip[0].offsetWidth
+    var height = $tip[0].offsetHeight
+
+    // manually read margins because getBoundingClientRect includes difference
+    var marginTop = parseInt($tip.css('margin-top'), 10)
+    var marginLeft = parseInt($tip.css('margin-left'), 10)
+
+    // we must check for NaN for ie 8/9
+    if (isNaN(marginTop))  marginTop  = 0
+    if (isNaN(marginLeft)) marginLeft = 0
+
+    offset.top  = offset.top  + marginTop
+    offset.left = offset.left + marginLeft
+
+    // $.fn.offset doesn't round pixel values
+    // so we use setOffset directly with our own function B-0
+    $.offset.setOffset($tip[0], $.extend({
+      using: function (props) {
+        $tip.css({
+          top: Math.round(props.top),
+          left: Math.round(props.left)
+        })
+      }
+    }, offset), 0)
+
+    $tip.addClass('in')
+
+    // check to see if placing tip in new offset caused the tip to resize itself
+    var actualWidth  = $tip[0].offsetWidth
+    var actualHeight = $tip[0].offsetHeight
+
+    if (placement == 'top' && actualHeight != height) {
+      replace = true
+      offset.top = offset.top + height - actualHeight
+    }
+
+    if (/bottom|top/.test(placement)) {
+      var delta = 0
+
+      if (offset.left < 0) {
+        delta       = offset.left * -2
+        offset.left = 0
+
+        $tip.offset(offset)
+
+        actualWidth  = $tip[0].offsetWidth
+        actualHeight = $tip[0].offsetHeight
+      }
+
+      this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
+    } else {
+      this.replaceArrow(actualHeight - height, actualHeight, 'top')
+    }
+
+    if (replace) $tip.offset(offset)
+  }
+
+  Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
+    this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
+  }
+
+  Tooltip.prototype.setContent = function () {
+    var $tip  = this.tip()
+    var title = this.getTitle()
+
+    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
+    $tip.removeClass('fade in top bottom left right')
+  }
+
+  Tooltip.prototype.hide = function () {
+    var that = this
+    var $tip = this.tip()
+    var e    = $.Event('hide.bs.' + this.type)
+
+    function complete() {
+      if (that.hoverState != 'in') $tip.detach()
+      that.$element.trigger('hidden.bs.' + that.type)
+    }
+
+    this.$element.trigger(e)
+
+    if (e.isDefaultPrevented()) return
+
+    $tip.removeClass('in')
+
+    $.support.transition && this.$tip.hasClass('fade') ?
+      $tip
+        .one($.support.transition.end, complete)
+        .emulateTransitionEnd(150) :
+      complete()
+
+    this.hoverState = null
+
+    return this
+  }
+
+  Tooltip.prototype.fixTitle = function () {
+    var $e = this.$element
+    if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
+      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
+    }
+  }
+
+  Tooltip.prototype.hasContent = function () {
+    return this.getTitle()
+  }
+
+  Tooltip.prototype.getPosition = function () {
+    var el = this.$element[0]
+    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
+      width: el.offsetWidth,
+      height: el.offsetHeight
+    }, this.$element.offset())
+  }
+
+  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
+    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2  } :
+           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2  } :
+           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
+        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width   }
+  }
+
+  Tooltip.prototype.getTitle = function () {
+    var title
+    var $e = this.$element
+    var o  = this.options
+
+    title = $e.attr('data-original-title')
+      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
+
+    return title
+  }
+
+  Tooltip.prototype.tip = function () {
+    return this.$tip = this.$tip || $(this.options.template)
+  }
+
+  Tooltip.prototype.arrow = function () {
+    return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
+  }
+
+  Tooltip.prototype.validate = function () {
+    if (!this.$element[0].parentNode) {
+      this.hide()
+      this.$element = null
+      this.options  = null
+    }
+  }
+
+  Tooltip.prototype.enable = function () {
+    this.enabled = true
+  }
+
+  Tooltip.prototype.disable = function () {
+    this.enabled = false
+  }
+
+  Tooltip.prototype.toggleEnabled = function () {
+    this.enabled = !this.enabled
+  }
+
+  Tooltip.prototype.toggle = function (e) {
+    var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
+    self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
+  }
+
+  Tooltip.prototype.destroy = function () {
+    clearTimeout(this.timeout)
+    this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
+  }
+
+
+  // TOOLTIP PLUGIN DEFINITION
+  // =========================
+
+  var old = $.fn.tooltip
+
+  $.fn.tooltip = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.tooltip')
+      var options = typeof option == 'object' && option
+
+      if (!data && option == 'destroy') return
+      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
+      if (typeof option == 'string') data[option]()
+    })
+  }
+
+  $.fn.tooltip.Constructor = Tooltip
+
+
+  // TOOLTIP NO CONFLICT
+  // ===================
+
+  $.fn.tooltip.noConflict = function () {
+    $.fn.tooltip = old
+    return this
+  }
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: popover.js v3.1.1
+ * http://getbootstrap.com/javascript/#popovers
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // POPOVER PUBLIC CLASS DEFINITION
+  // ===============================
+
+  var Popover = function (element, options) {
+    this.init('popover', element, options)
+  }
+
+  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
+
+  Popover.DEFAULTS = $.extend({}, $.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>'
+  })
+
+
+  // NOTE: POPOVER EXTENDS tooltip.js
+  // ================================
+
+  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
+
+  Popover.prototype.constructor = Popover
+
+  Popover.prototype.getDefaults = function () {
+    return Popover.DEFAULTS
+  }
+
+  Popover.prototype.setContent = function () {
+    var $tip    = this.tip()
+    var title   = this.getTitle()
+    var content = this.getContent()
+
+    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
+    $tip.find('.popover-content')[ // we use append for html objects to maintain js events
+      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
+    ](content)
+
+    $tip.removeClass('fade top bottom left right in')
+
+    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
+    // this manually by checking the contents.
+    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
+  }
+
+  Popover.prototype.hasContent = function () {
+    return this.getTitle() || this.getContent()
+  }
+
+  Popover.prototype.getContent = function () {
+    var $e = this.$element
+    var o  = this.options
+
+    return $e.attr('data-content')
+      || (typeof o.content == 'function' ?
+            o.content.call($e[0]) :
+            o.content)
+  }
+
+  Popover.prototype.arrow = function () {
+    return this.$arrow = this.$arrow || this.tip().find('.arrow')
+  }
+
+  Popover.prototype.tip = function () {
+    if (!this.$tip) this.$tip = $(this.options.template)
+    return this.$tip
+  }
+
+
+  // POPOVER PLUGIN DEFINITION
+  // =========================
+
+  var old = $.fn.popover
+
+  $.fn.popover = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.popover')
+      var options = typeof option == 'object' && option
+
+      if (!data && option == 'destroy') return
+      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
+      if (typeof option == 'string') data[option]()
+    })
+  }
+
+  $.fn.popover.Constructor = Popover
+
+
+  // POPOVER NO CONFLICT
+  // ===================
+
+  $.fn.popover.noConflict = function () {
+    $.fn.popover = old
+    return this
+  }
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: scrollspy.js v3.1.1
+ * http://getbootstrap.com/javascript/#scrollspy
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // SCROLLSPY CLASS DEFINITION
+  // ==========================
+
+  function ScrollSpy(element, options) {
+    var href
+    var process  = $.proxy(this.process, this)
+
+    this.$element       = $(element).is('body') ? $(window) : $(element)
+    this.$body          = $('body')
+    this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
+    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
+    this.selector       = (this.options.target
+      || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+      || '') + ' .nav li > a'
+    this.offsets        = $([])
+    this.targets        = $([])
+    this.activeTarget   = null
+
+    this.refresh()
+    this.process()
+  }
+
+  ScrollSpy.DEFAULTS = {
+    offset: 10
+  }
+
+  ScrollSpy.prototype.refresh = function () {
+    var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
+
+    this.offsets = $([])
+    this.targets = $([])
+
+    var self     = this
+    var $targets = this.$body
+      .find(this.selector)
+      .map(function () {
+        var $el   = $(this)
+        var href  = $el.data('target') || $el.attr('href')
+        var $href = /^#./.test(href) && $(href)
+
+        return ($href
+          && $href.length
+          && $href.is(':visible')
+          && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
+      })
+      .sort(function (a, b) { return a[0] - b[0] })
+      .each(function () {
+        self.offsets.push(this[0])
+        self.targets.push(this[1])
+      })
+  }
+
+  ScrollSpy.prototype.process = function () {
+    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
+    var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
+    var maxScroll    = scrollHeight - this.$scrollElement.height()
+    var offsets      = this.offsets
+    var targets      = this.targets
+    var activeTarget = this.activeTarget
+    var i
+
+    if (scrollTop >= maxScroll) {
+      return activeTarget != (i = targets.last()[0]) && this.activate(i)
+    }
+
+    if (activeTarget && scrollTop <= offsets[0]) {
+      return activeTarget != (i = targets[0]) && this.activate(i)
+    }
+
+    for (i = offsets.length; i--;) {
+      activeTarget != targets[i]
+        && scrollTop >= offsets[i]
+        && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
+        && this.activate( targets[i] )
+    }
+  }
+
+  ScrollSpy.prototype.activate = function (target) {
+    this.activeTarget = target
+
+    $(this.selector)
+      .parentsUntil(this.options.target, '.active')
+      .removeClass('active')
+
+    var selector = this.selector +
+        '[data-target="' + target + '"],' +
+        this.selector + '[href="' + target + '"]'
+
+    var active = $(selector)
+      .parents('li')
+      .addClass('active')
+
+    if (active.parent('.dropdown-menu').length) {
+      active = active
+        .closest('li.dropdown')
+        .addClass('active')
+    }
+
+    active.trigger('activate.bs.scrollspy')
+  }
+
+
+  // SCROLLSPY PLUGIN DEFINITION
+  // ===========================
+
+  var old = $.fn.scrollspy
+
+  $.fn.scrollspy = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.scrollspy')
+      var options = typeof option == 'object' && option
+
+      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
+      if (typeof option == 'string') data[option]()
+    })
+  }
+
+  $.fn.scrollspy.Constructor = ScrollSpy
+
+
+  // SCROLLSPY NO CONFLICT
+  // =====================
+
+  $.fn.scrollspy.noConflict = function () {
+    $.fn.scrollspy = old
+    return this
+  }
+
+
+  // SCROLLSPY DATA-API
+  // ==================
+
+  $(window).on('load', function () {
+    $('[data-spy="scroll"]').each(function () {
+      var $spy = $(this)
+      $spy.scrollspy($spy.data())
+    })
+  })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: tab.js v3.1.1
+ * http://getbootstrap.com/javascript/#tabs
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // TAB CLASS DEFINITION
+  // ====================
+
+  var Tab = function (element) {
+    this.element = $(element)
+  }
+
+  Tab.prototype.show = function () {
+    var $this    = this.element
+    var $ul      = $this.closest('ul:not(.dropdown-menu)')
+    var selector = $this.data('target')
+
+    if (!selector) {
+      selector = $this.attr('href')
+      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+    }
+
+    if ($this.parent('li').hasClass('active')) return
+
+    var previous = $ul.find('.active:last a')[0]
+    var e        = $.Event('show.bs.tab', {
+      relatedTarget: previous
+    })
+
+    $this.trigger(e)
+
+    if (e.isDefaultPrevented()) return
+
+    var $target = $(selector)
+
+    this.activate($this.parent('li'), $ul)
+    this.activate($target, $target.parent(), function () {
+      $this.trigger({
+        type: 'shown.bs.tab',
+        relatedTarget: previous
+      })
+    })
+  }
+
+  Tab.prototype.activate = function (element, container, callback) {
+    var $active    = container.find('> .active')
+    var transition = callback
+      && $.support.transition
+      && $active.hasClass('fade')
+
+    function next() {
+      $active
+        .removeClass('active')
+        .find('> .dropdown-menu > .active')
+        .removeClass('active')
+
+      element.addClass('active')
+
+      if (transition) {
+        element[0].offsetWidth // reflow for transition
+        element.addClass('in')
+      } else {
+        element.removeClass('fade')
+      }
+
+      if (element.parent('.dropdown-menu')) {
+        element.closest('li.dropdown').addClass('active')
+      }
+
+      callback && callback()
+    }
+
+    transition ?
+      $active
+        .one($.support.transition.end, next)
+        .emulateTransitionEnd(150) :
+      next()
+
+    $active.removeClass('in')
+  }
+
+
+  // TAB PLUGIN DEFINITION
+  // =====================
+
+  var old = $.fn.tab
+
+  $.fn.tab = function ( option ) {
+    return this.each(function () {
+      var $this = $(this)
+      var data  = $this.data('bs.tab')
+
+      if (!data) $this.data('bs.tab', (data = new Tab(this)))
+      if (typeof option == 'string') data[option]()
+    })
+  }
+
+  $.fn.tab.Constructor = Tab
+
+
+  // TAB NO CONFLICT
+  // ===============
+
+  $.fn.tab.noConflict = function () {
+    $.fn.tab = old
+    return this
+  }
+
+
+  // TAB DATA-API
+  // ============
+
+  $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
+    e.preventDefault()
+    $(this).tab('show')
+  })
+
+}(jQuery);
+
+/* ========================================================================
+ * Bootstrap: affix.js v3.1.1
+ * http://getbootstrap.com/javascript/#affix
+ * ========================================================================
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
+
+
++function ($) {
+  'use strict';
+
+  // AFFIX CLASS DEFINITION
+  // ======================
+
+  var Affix = function (element, options) {
+    this.options = $.extend({}, Affix.DEFAULTS, options)
+    this.$window = $(window)
+      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
+      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
+
+    this.$element     = $(element)
+    this.affixed      =
+    this.unpin        =
+    this.pinnedOffset = null
+
+    this.checkPosition()
+  }
+
+  Affix.RESET = 'affix affix-top affix-bottom'
+
+  Affix.DEFAULTS = {
+    offset: 0
+  }
+
+  Affix.prototype.getPinnedOffset = function () {
+    if (this.pinnedOffset) return this.pinnedOffset
+    this.$element.removeClass(Affix.RESET).addClass('affix')
+    var scrollTop = this.$window.scrollTop()
+    var position  = this.$element.offset()
+    return (this.pinnedOffset = position.top - scrollTop)
+  }
+
+  Affix.prototype.checkPositionWithEventLoop = function () {
+    setTimeout($.proxy(this.checkPosition, this), 1)
+  }
+
+  Affix.prototype.checkPosition = function () {
+    if (!this.$element.is(':visible')) return
+
+    var scrollHeight = $(document).height()
+    var scrollTop    = this.$window.scrollTop()
+    var position     = this.$element.offset()
+    var offset       = this.options.offset
+    var offsetTop    = offset.top
+    var offsetBottom = offset.bottom
+
+    if (this.affixed == 'top') position.top += scrollTop
+
+    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
+    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
+    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
+
+    var affix = this.unpin   != null && (scrollTop + this.unpin <= position.top) ? false :
+                offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
+                offsetTop    != null && (scrollTop <= offsetTop) ? 'top' : false
+
+    if (this.affixed === affix) return
+    if (this.unpin) this.$element.css('top', '')
+
+    var affixType = 'affix' + (affix ? '-' + affix : '')
+    var e         = $.Event(affixType + '.bs.affix')
+
+    this.$element.trigger(e)
+
+    if (e.isDefaultPrevented()) return
+
+    this.affixed = affix
+    this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
+
+    this.$element
+      .removeClass(Affix.RESET)
+      .addClass(affixType)
+      .trigger($.Event(affixType.replace('affix', 'affixed')))
+
+    if (affix == 'bottom') {
+      this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
+    }
+  }
+
+
+  // AFFIX PLUGIN DEFINITION
+  // =======================
+
+  var old = $.fn.affix
+
+  $.fn.affix = function (option) {
+    return this.each(function () {
+      var $this   = $(this)
+      var data    = $this.data('bs.affix')
+      var options = typeof option == 'object' && option
+
+      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
+      if (typeof option == 'string') data[option]()
+    })
+  }
+
+  $.fn.affix.Constructor = Affix
+
+
+  // AFFIX NO CONFLICT
+  // =================
+
+  $.fn.affix.noConflict = function () {
+    $.fn.affix = old
+    return this
+  }
+
+
+  // AFFIX DATA-API
+  // ==============
+
+  $(window).on('load', function () {
+    $('[data-spy="affix"]').each(function () {
+      var $spy = $(this)
+      var data = $spy.data()
+
+      data.offset = data.offset || {}
+
+      if (data.offsetBottom) data.offset.bottom = data.offsetBottom
+      if (data.offsetTop)    data.offset.top    = data.offsetTop
+
+      $spy.affix(data)
+    })
+  })
+
+}(jQuery);
diff --git a/setup/pub/bootstrap/js/bootstrap.min.js b/setup/pub/bootstrap/js/bootstrap.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..b04a0e82fffee109e8cd5e48b3f3aa2a9b2aceff
--- /dev/null
+++ b/setup/pub/bootstrap/js/bootstrap.min.js
@@ -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/setup/pub/images/ajax-loader.gif b/setup/pub/images/ajax-loader.gif
new file mode 100644
index 0000000000000000000000000000000000000000..3288d1035d70bb86517e2c233f1a904e41f06b29
Binary files /dev/null and b/setup/pub/images/ajax-loader.gif differ
diff --git a/setup/pub/magento/setup/add-database.js b/setup/pub/magento/setup/add-database.js
new file mode 100644
index 0000000000000000000000000000000000000000..d090dbaf86d20d4f75548c601dfd23fddff46244
--- /dev/null
+++ b/setup/pub/magento/setup/add-database.js
@@ -0,0 +1,74 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+'use strict';
+angular.module('add-database', ['ngStorage'])
+    .controller('addDatabaseController', ['$scope', '$state', '$localStorage', '$http', '$timeout', function ($scope, $state, $localStorage, $http, $timeout) {
+        $scope.db = {
+            useExistingDb: 1,
+            useAccess: 1
+        };
+
+        if ($localStorage.db) {
+            $scope.db = $localStorage.db;
+        }
+
+    $scope.testConnection = function () {
+        $http.post('data/database', $scope.db)
+            .success(function (data) {
+                $scope.testConnection.result = data;
+            })
+            .then(function () {
+                $scope.testConnection.pressed = true;
+                $timeout(function () {
+                    $scope.testConnection.pressed = false;
+                }, 2500);
+            });
+    };
+
+        $scope.$on('nextState', function () {
+            $localStorage.db = $scope.db;
+        });
+
+        // Listens on form validate event, dispatched by parent controller
+        $scope.$on('validate-' + $state.current.id, function() {
+            $scope.validate();
+        });
+
+        // Dispatch 'validation-response' event to parent controller
+        $scope.validate = function() {
+            if ($scope.database.$valid) {
+                $scope.$emit('validation-response', true);
+            } else {
+                $scope.$emit('validation-response', false);
+                $scope.database.submitted = true;
+            }
+        }
+
+        // Update 'submitted' flag
+        $scope.$watch(function() { return $scope.database.$valid }, function(valid) {
+            if (valid) {
+                $scope.database.submitted = false;
+            }
+        });
+    }]);
diff --git a/downloader/template/install/footer.phtml b/setup/pub/magento/setup/app.js
similarity index 51%
rename from downloader/template/install/footer.phtml
rename to setup/pub/magento/setup/app.js
index b5d8f6d00a6e7128fa48745fdbdcfa3b9822d703..9cf4013f86a4c998f2b5637e95d2ab47d4403e6f 100644
--- a/downloader/template/install/footer.phtml
+++ b/setup/pub/magento/setup/app.js
@@ -1,4 +1,3 @@
-<?php
 /**
  * Magento
  *
@@ -21,28 +20,38 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-?>
-            <!-- [end] content -->
-            </div>
-        </div>
 
-            <!-- [end] center -->
-    </div>
-        <!-- [end] middle -->
+'use strict';
+var app = angular.module(
+    'magentoSetup',
+    [
+        'ui.router',
+        'ui.bootstrap',
+        'main',
+        'landing',
+        'readiness-check',
+        'add-database',
+        'web-configuration',
+        'customize-your-store',
+        'create-admin-account',
+        'install',
+        'success'
+    ]);
 
-        <!-- [start] footer -->
-    <div class="footer-container">
-        <div class="footer">
-        <p class="legality">
-            Help Us to Keep Magento Healthy - <a href="http://www.magentocommerce.com/bug-tracking" id="bug_tracking_link"><strong>Report All Bugs</strong></a> (Downloader ver. <?php echo \Magento\Downloader\Controller::getVersion();?>)<br/>
-
-<script type="text/javascript">
-    $('bug_tracking_link').target = "varien_external";
-</script>
-            <?php echo $this->template('copyright.phtml'); ?>
-         </p>
-        </div>
-    </div>
-        <!-- [end] footer -->
-    </body>
-</html>
+app.config(function ($stateProvider) {
+    app.stateProvider = $stateProvider;
+})
+.config(function($provide) {
+    $provide.decorator('$state', function($delegate, $stateParams) {
+        $delegate.forceReload = function() {
+            return $delegate.go($delegate.current, $stateParams, {
+                reload: true,
+                inherit: false,
+                notify: true
+            });
+        };
+        return $delegate;
+    });
+}).run(function ($rootScope, $state) {
+    $rootScope.$state = $state;
+});
diff --git a/setup/pub/magento/setup/create-admin-account.js b/setup/pub/magento/setup/create-admin-account.js
new file mode 100644
index 0000000000000000000000000000000000000000..b9f53a3d483275db1b63d460308549700f19c54a
--- /dev/null
+++ b/setup/pub/magento/setup/create-admin-account.js
@@ -0,0 +1,109 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+'use strict';
+angular.module('create-admin-account', ['ngStorage'])
+    .controller('createAdminAccountController', ['$scope', '$state', '$localStorage', function ($scope, $state, $localStorage) {
+        $scope.admin = {
+            'passwordStatus': {
+                class: 'none',
+                label: 'None'
+            }
+        };
+
+        $scope.passwordStatusChange = function () {
+            if (angular.isUndefined($scope.admin.password)) {
+                return;
+            }
+            var p = $scope.admin.password;
+            if (p.length > 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/) && p.match(/[!@#$%^*()_\/\\\-\+=]+/)) {
+                $scope.admin.passwordStatus.class = 'strong';
+                $scope.admin.passwordStatus.label = 'Strong';
+            } else if (p.length > 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/)) {
+                $scope.admin.passwordStatus.class = 'good';
+                $scope.admin.passwordStatus.label = 'Good';
+            } else if (p.length > 6 && p.match(/[\d]+/) && p.match(/[a-zA-Z]+/)) {
+                $scope.admin.passwordStatus.class = 'weak';
+                $scope.admin.passwordStatus.label = 'Weak';
+            } else if (p.length > 6) {
+                $scope.admin.passwordStatus.class = 'to-short';
+                $scope.admin.passwordStatus.label = 'To Short';
+            } else {
+                $scope.admin.passwordStatus.class = 'none';
+                $scope.admin.passwordStatus.label = 'None';
+            }
+        };
+
+        if ($localStorage.admin) {
+            $scope.admin = $localStorage.admin;
+        }
+
+        $scope.$on('nextState', function () {
+            $localStorage.admin = $scope.admin;
+        });
+
+        // Listens on form validate event, dispatched by parent controller
+        $scope.$on('validate-' + $state.current.id, function() {
+            $scope.validate();
+        });
+
+        // Dispatch 'validation-response' event to parent controller
+        $scope.validate = function() {
+            if ($scope.account.$valid) {
+                $scope.$emit('validation-response', true);
+            } else {
+                $scope.$emit('validation-response', false);
+                $scope.account.submitted = true;
+            }
+        }
+
+        // Update 'submitted' flag
+        $scope.$watch(function() { return $scope.account.$valid }, function(valid) {
+            if (valid) {
+                $scope.account.submitted = false;
+            }
+        });
+    }])
+    .directive('confirmPassword', function() {
+        return {
+            require: 'ngModel',
+            restrict: 'A',
+            link: function (scope, elem, attrs, ctrl) {
+                scope.$watch(function () {
+                    return scope.$eval(attrs.confirmPassword) === ctrl.$modelValue;
+                }, function (value) {
+                    ctrl.$setValidity('confirmPassword', value);
+                });
+
+                ctrl.$parsers.push(function (value) {
+                    if (angular.isUndefined(value) || value === '') {
+                        ctrl.$setValidity('confirmPassword', true);
+                        return value;
+                    }
+                    var validated = value === scope.confirmPassword;
+                    ctrl.$setValidity('confirmPassword', validated);
+                    return value;
+                });
+            }
+        };
+    });
diff --git a/setup/pub/magento/setup/css/app.css b/setup/pub/magento/setup/css/app.css
new file mode 100644
index 0000000000000000000000000000000000000000..1524d682add85b24c4bf68d340ac1455677e072c
--- /dev/null
+++ b/setup/pub/magento/setup/css/app.css
@@ -0,0 +1,168 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+.step-controls {
+    padding: 10px;
+    margin: 20px;
+    text-align: right;
+}
+
+.required {
+    color: red;
+}
+.collapsed-options {
+    margin-top:20px;
+    margin-bottom:20px;
+}
+a.collapsed-options {
+    padding-top: 7px;
+    color: #000;
+    font-weight: bold;
+    white-space: nowrap;
+}
+
+.readiness-check-landing {
+    text-align: center;
+    width: 550px;
+    margin-top: 50px;
+}
+.readiness-check-landing > * {
+    padding: 20px;
+    margin: 20px;
+}
+.rediness-check-items > div {
+    padding: 20px;
+}
+.rediness-check-info {
+    margin: 10px 0 10px 20px;
+    width: 70%;
+}
+.rediness-check-info > ul {
+    margin-top: 10px;
+}
+.rediness-check-block {
+    padding: 20px;
+}
+.rediness-check-panel-right {
+    float:right;
+}
+
+.bs-callout {
+    -moz-border-bottom-colors: none;
+    -moz-border-left-colors: none;
+    -moz-border-right-colors: none;
+    -moz-border-top-colors: none;
+    border-color: #eee;
+    border-image: none;
+    border-radius: 3px;
+    border-style: solid;
+    border-width: 1px 1px 1px 5px;
+    margin: 20px 0;
+    padding: 20px;
+}
+.bs-callout h4 {
+    margin-bottom: 5px;
+    margin-top: 0;
+}
+.bs-callout-danger {
+    border-left-color: #d9534f;
+}
+.bs-callout-danger h4 {
+    color: #d9534f;
+}
+.bs-callout-warning {
+    border-left-color: #f0ad4e;
+}
+.bs-callout-warning h4 {
+    color: #f0ad4e;
+}
+.bs-callout-info {
+    border-left-color: #5bc0de;
+}
+.bs-callout-info h4 {
+    color: #5bc0de;
+}
+
+.tooltip-inner {
+    padding: 9px 14px;
+    color: #000;
+    background-color: #eee;
+    border: 1px solid #ccc;
+}
+.tooltip.right .tooltip-arrow {
+    border-right-color: #ccc;
+}
+
+.password-strength > div {
+    background-color: #ffffff;
+    margin: 2px;
+    min-height: 5px;
+}
+.password-strength-none > div {}
+.password-strength-to-short > div:first-child {
+    background-color: #d9534f;
+}
+.password-strength-weak > div:first-child, .password-strength-weak > div:nth-child(2) {
+    background-color: #ffcc33;
+}
+.password-strength-good > div:first-child, .password-strength-good > div:nth-child(2), .password-strength-good > div:nth-child(3) {
+    background-color: #3c763d;
+}
+.password-strength-strong > div {
+    background-color: #3c763d;
+}
+
+.highlight {
+    background-color: #f7f7f9;
+    border: 1px solid #e1e1e8;
+    border-radius: 4px;
+    margin-bottom: 14px;
+    padding: 9px 14px;
+}
+.highlight pre {
+    background-color: transparent;
+    border: 0 none;
+    margin-bottom: 0;
+    margin-top: 0;
+    padding: 0;
+    white-space: nowrap;
+    word-break: normal;
+}
+.error-container {
+    display: block;
+    padding: 6px 12px;
+    margin-top: 2px;
+    color: #a94442;
+    background-color: #f2dede;
+    border-color: #a94442;
+    border-radius: 4px;
+}
+.bold {
+    font-weight: bold;
+}
+.p-top-10 {
+    padding: 10px;
+}
+.disabled {
+    pointer-events: none;
+    cursor: default;
+}
\ No newline at end of file
diff --git a/downloader/skin/install/ie7minus.css b/setup/pub/magento/setup/customize-your-store.js
similarity index 62%
rename from downloader/skin/install/ie7minus.css
rename to setup/pub/magento/setup/customize-your-store.js
index 639b942b07cd6d9ffddf2255a700fc6c0f925668..af42f5b21fc887366734917647c2013a094ba671 100644
--- a/downloader/skin/install/ie7minus.css
+++ b/setup/pub/magento/setup/customize-your-store.js
@@ -21,18 +21,21 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 
-#nav li.parent { margin-bottom:-3px; }
-.one-page-checkout { position:relative; }
-.group-select .legend { position:relative; zoom:1; }
+'use strict';
+angular.module('customize-your-store', ['ngStorage'])
+    .controller('customizeYourStoreController', ['$scope', '$localStorage', function ($scope, $localStorage) {
+        $scope.store = {
+            timezone: 'America/Los_Angeles',
+            currency: 'USD',
+            language: 'en_US',
+            useSampleData: false
+        };
 
-/* Min-height for IE */
-.login-box .content { height:180px; }
-.content-box { height:250px; }
-#main { height:400px; }
+        if ($localStorage.store) {
+            $scope.store = $localStorage.store;
+        }
 
-.validation-advice { height:15px; }
-.error-msg, .success-msg, .note-msg { height:23px; }
-.currency-switcher h4 { height:21px; }
-.base-mini .head h4, .shopping-cart-collaterals h4 { height:16px; }
-.login-box h4 { height:16px; }
-.login-box .content { height:230px; }
+        $scope.$on('nextState', function () {
+            $localStorage.store = $scope.store;
+        });
+    }]);
diff --git a/setup/pub/magento/setup/install.js b/setup/pub/magento/setup/install.js
new file mode 100644
index 0000000000000000000000000000000000000000..04ace8ac1adbc553202e544d1c2809c1057d99e9
--- /dev/null
+++ b/setup/pub/magento/setup/install.js
@@ -0,0 +1,92 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+'use strict';
+angular.module('install', ['ngStorage'])
+    .controller('installController', ['$scope', '$sce', '$timeout', '$localStorage', '$rootScope', 'progress', function ($scope, $sce, $timeout, $localStorage, $rootScope, progress) {
+        $scope.finished = false;
+        $scope.isStart = false;
+        $scope.console = false;
+        $scope.disabled = false;
+        $scope.toggleConsole = function () {
+            $scope.console = $scope.console === false;
+        };
+
+        $scope.checkProgress = function () {
+            $scope.isStart = true;
+            $scope.disabled = true;
+            progress.get(function (response) {
+
+                var log = '';
+                response.data.console.forEach(function (message) {
+                    log = log + message + '<br>';
+                });
+                $scope.log = $sce.trustAsHtml(log);
+
+                if (response.data.success) {
+                    $scope.progress = response.data.progress;
+                    $scope.progressText = response.data.progress + '%';
+
+                    $timeout(function() {
+                        if (!$scope.finished) {
+                            $scope.checkProgress();
+                        }
+                    }, 1500);
+                } else {
+                    $scope.progress = 100;
+                    $scope.progressText = $scope.errorStatus;
+                    $scope.error = true;
+                    $scope.disabled = false;
+                    $rootScope.isMenuEnabled = true;
+                }
+            });
+        };
+
+        $scope.start = function () {
+            var data = {
+                'db': $localStorage.db,
+                'admin': $localStorage.admin,
+                'store': $localStorage.store,
+                'config': $localStorage.config
+            };
+            $rootScope.isMenuEnabled = false;
+            progress.post(data, function (response) {
+                $localStorage.config.encrypt.key = response.key;
+                if (response.success) {
+                    $scope.finished = true;
+                    $scope.nextState();
+                }
+            });
+            $scope.checkProgress();
+        };
+    }])
+    .service('progress', ['$http', function ($http) {
+        return {
+            get: function (callback) {
+                $http.get('install/progress').then(callback);
+            },
+            post: function (data, callback) {
+                $http.post('install/start', data).success(callback);
+            }
+        };
+    }]);
\ No newline at end of file
diff --git a/downloader/template/exception.phtml b/setup/pub/magento/setup/landing.js
similarity index 67%
rename from downloader/template/exception.phtml
rename to setup/pub/magento/setup/landing.js
index a1c286343ab9433667fb4bfab29c9875050a3310..5e8deae04eb114a403133fd0e2cd01da5e1036bd 100644
--- a/downloader/template/exception.phtml
+++ b/setup/pub/magento/setup/landing.js
@@ -1,4 +1,3 @@
-<?php
 /**
  * Magento
  *
@@ -21,14 +20,17 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
-?>
-<?php echo $this->template($this->controller()->isInstalled() ? 'header.phtml' : 'install/header.phtml') ?>
 
-<h2>Exception caught:</h2>
-<br/>
-<h3><?php echo $this->get('exception')->getMessage() ?></h3>
-<br/>
-<h4>Backtrace:</h4>
-<pre><?php echo $this->get('exception')->getTraceAsString() ?></pre>
-
-<?php echo $this->template($this->controller()->isInstalled() ? 'footer.phtml' : 'install/footer.phtml') ?>
+'use strict';
+angular.module('landing', ['ngStorage'])
+    .controller('landingController', [
+        '$scope',
+        '$location',
+        '$localStorage',
+        function ($scope, $location, $localStorage) {
+            $scope.selectLanguage = function () {
+                $localStorage.lang = $scope.modelLanguage;
+                window.location = '/setup/' + $scope.modelLanguage + '/index';
+            };
+        }
+    ]);
diff --git a/setup/pub/magento/setup/main.js b/setup/pub/magento/setup/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..0b4a7e4eed020560f0a2cabc67032d1cd8ad24f7
--- /dev/null
+++ b/setup/pub/magento/setup/main.js
@@ -0,0 +1,117 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+'use strict';
+var main = angular.module('main', []);
+main.controller('navigationController', ['$scope', '$state', '$rootScope', 'navigationService', function ($scope, $state, $rootScope, navigationService) {
+    navigationService.load();
+    $rootScope.isMenuEnabled = true;
+    $scope.itemStatus = function (order) {
+        return $state.$current.order <= order || !$rootScope.isMenuEnabled;
+    };
+}])
+.controller('mainController', [
+    '$scope', '$state', 'navigationService',
+    function ($scope, $state, navigationService) {
+        $scope.$on('$stateChangeSuccess', function (event, state) {
+            $scope.class = 'col-lg-9';
+            if (state.main) {
+                $scope.class = 'col-lg-offset-3 col-lg-6';
+            }
+        });
+
+        $scope.nextState = function () {
+            if ($scope.validate()) {
+                $scope.$broadcast('nextState', $state.$current);
+                $state.go(navigationService.getNextState().id);
+            }
+        };
+
+        $scope.previousState = function () {
+            $state.go(navigationService.getPreviousState().id);
+        };
+
+        // Flag indicating the validity of the form
+        $scope.valid = true;
+
+        // Check the validity of the form
+        $scope.validate = function() {
+            if ($state.current.validate) {
+                $scope.$broadcast('validate-' + $state.current.id);
+            }
+            return $scope.valid;
+        };
+
+        // Listens on 'validation-response' event, dispatched by descendant controller
+        $scope.$on('validation-response', function(event, data) {
+            $scope.valid = data;
+            event.stopPropagation();
+        });
+    }
+])
+.service('navigationService', ['$location', '$state', '$http', function ($location, $state, $http) {
+    return {
+        mainState: {},
+        states: [],
+        load: function () {
+            var self = this;
+            $http.get('data/states').success(function (data) {
+                var currentState = $location.path().replace('/', '');
+                var isCurrentStateFound = false;
+                self.states = data.nav;
+                data.nav.forEach(function (item) {
+                    app.stateProvider.state(item.id, item);
+                    if (item.default) {
+                        self.mainState = item;
+                    }
+
+                    if (currentState == item.url) {
+                        $state.go(item.id);
+                        isCurrentStateFound = true;
+                    }
+                });
+                if (!isCurrentStateFound) {
+                    $state.go(self.mainState.id);
+                }
+            });
+        },
+        getNextState: function () {
+            var nItem = {};
+            this.states.forEach(function (item) {
+                if (item.order == $state.$current.order + 1) {
+                    nItem = item;
+                }
+            });
+            return nItem;
+        },
+        getPreviousState: function () {
+            var nItem = {};
+            this.states.forEach(function (item) {
+                if (item.order == $state.$current.order - 1) {
+                    nItem = item;
+                }
+            });
+            return nItem;
+        }
+    }
+}]);
diff --git a/setup/pub/magento/setup/readiness-check.js b/setup/pub/magento/setup/readiness-check.js
new file mode 100644
index 0000000000000000000000000000000000000000..55dcef6a8f0ed83be0060785f0393545a618142a
--- /dev/null
+++ b/setup/pub/magento/setup/readiness-check.js
@@ -0,0 +1,158 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+'use strict';
+angular.module('readiness-check', [])
+    .constant('COUNTER', 1)
+    .controller('readinessCheckController', ['$rootScope', '$scope', '$http', '$timeout', 'COUNTER', function ($rootScope, $scope, $http, $timeout, COUNTER) {
+        $scope.progressCounter = COUNTER;
+        $scope.startProgress = function() {
+            ++$scope.progressCounter;
+        };
+        $scope.stopProgress = function() {
+            --$scope.progressCounter;
+            if ($scope.progressCounter == COUNTER) {
+                $scope.resetProgress();
+            }
+        };
+        $scope.resetProgress = function() {
+            $scope.progressCounter = 0;
+        };
+        $rootScope.checkingInProgress = function() {
+            return $scope.progressCounter > 0;
+        };
+
+        $scope.completed = false;
+        $scope.hasErrors = false;
+
+        $scope.version = {
+            visible: false,
+            processed: false,
+            expanded: false
+        };
+        $scope.extensions = {
+            visible: false,
+            processed: false,
+            expanded: false
+        };
+        $scope.permissions = {
+            visible: false,
+            processed: false,
+            expanded: false
+        };
+
+        $scope.items = {
+            'php-version': {
+                url:'data/php-version',
+                show: function() {
+                    $scope.startProgress();
+                    $scope.version.visible = true;
+                },
+                process: function(data) {
+                    $scope.version.processed = true;
+                    angular.extend($scope.version, data);
+                    $scope.updateOnProcessed($scope.version.responseType);
+                    $scope.stopProgress();
+                }
+            },
+            'php-extensions': {
+                url:'data/php-extensions',
+                show: function() {
+                    $scope.startProgress();
+                    $scope.extensions.visible = true;
+                },
+                process: function(data) {
+                    $scope.extensions.processed = true;
+                    angular.extend($scope.extensions, data);
+                    $scope.updateOnProcessed($scope.extensions.responseType);
+                    $scope.stopProgress();
+                }
+            },
+            'file-permissions': {
+                url:'data/file-permissions',
+                show: function() {
+                    $scope.startProgress();
+                    $scope.permissions.visible = true;
+                },
+                process: function(data) {
+                    $scope.permissions.processed = true;
+                    angular.extend($scope.permissions, data);
+                    $scope.updateOnProcessed($scope.permissions.responseType);
+                    $scope.stopProgress();
+                }
+            }
+        };
+
+        $scope.isCompleted = function() {
+            return $scope.version.processed
+                && $scope.extensions.processed
+                && $scope.permissions.processed;
+        };
+
+        $scope.updateOnProcessed = function(value) {
+            $rootScope.hasErrors = $scope.hasErrors || (value != 'success');
+        };
+
+        $scope.updateOnError = function(obj) {
+            obj.expanded = true;
+        };
+
+        $scope.updateOnSuccess = function(obj) {
+            obj.expanded = false;
+        };
+
+        $scope.updateOnExpand = function(obj) {
+            obj.expanded = !obj.expanded;
+        };
+
+        $scope.hasItem = function(haystack, needle) {
+            return haystack.indexOf(needle) > -1;
+        };
+
+        $scope.query = function(item) {
+            return $http.get(item.url)
+                .success(function(data) { item.process(data) });
+        };
+
+        $scope.progress = function() {
+            var timeout = 0;
+            angular.forEach($scope.items, function(item) {
+                timeout += 1000;
+                $timeout(function() {
+                    item.show();
+                }, timeout);
+            });
+            angular.forEach($scope.items, function(item) {
+                timeout += 500;
+                $timeout(function() {
+                    $scope.query(item);
+                }, timeout);
+            });
+        };
+
+        $scope.$on('$stateChangeSuccess', function (event, nextState) {
+            if (nextState.id == 'root.readiness-check.progress') {
+                $scope.progress();
+            }
+        });
+    }]);
diff --git a/app/code/Magento/Connect/etc/adminhtml/acl.xml b/setup/pub/magento/setup/success.js
similarity index 75%
rename from app/code/Magento/Connect/etc/adminhtml/acl.xml
rename to setup/pub/magento/setup/success.js
index fe72bba37e6c4e1ddcb4e260e75ec0820d5afd0a..c8792bb135d4b53891fd61d69b2a3260c06cb337 100644
--- a/app/code/Magento/Connect/etc/adminhtml/acl.xml
+++ b/setup/pub/magento/setup/success.js
@@ -1,5 +1,3 @@
-<?xml version="1.0"?>
-<!--
 /**
  * Magento
  *
@@ -22,9 +20,11 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
--->
-<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Acl/etc/acl.xsd">
-    <acl>
-        <resources />
-    </acl>
-</config>
+
+'use strict';
+angular.module('success', ['ngStorage'])
+    .controller('successController', ['$scope', '$localStorage', function ($scope, $localStorage) {
+        $scope.db     = $localStorage.db;
+        $scope.admin  = $localStorage.admin;
+        $scope.config = $localStorage.config;
+    }]);
\ No newline at end of file
diff --git a/setup/pub/magento/setup/web-configuration.js b/setup/pub/magento/setup/web-configuration.js
new file mode 100644
index 0000000000000000000000000000000000000000..4355f358b5138dea87305ea935b8a55fac639773
--- /dev/null
+++ b/setup/pub/magento/setup/web-configuration.js
@@ -0,0 +1,85 @@
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+
+'use strict';
+angular.module('web-configuration', ['ngStorage'])
+    .controller('webConfigurationController', ['$scope', '$state', '$localStorage', function ($scope, $state, $localStorage) {
+        $scope.config = {
+            address: {
+                web: 'http://www.example.com/',
+                admin: 'admin'
+            },
+            https: {
+                front: true,
+                admin: true
+            },
+            rewrites: {
+                allowed: true
+            },
+            encrypt: {
+                key: '',
+                type: 'magento'
+            },
+            advanced: {
+                expanded: false
+            }
+        };
+
+        if ($localStorage.config) {
+            $scope.config = $localStorage.config;
+        }
+
+        $scope.$on('nextState', function () {
+            $localStorage.config = $scope.config;
+        });
+
+        $scope.updateOnExpand = function(obj) {
+            obj.expanded = !obj.expanded;
+        }
+
+        $scope.showEncryptKey = function() {
+            return angular.equals($scope.config.encrypt.type, 'user');
+        }
+
+        // Listens on form validate event, dispatched by parent controller
+        $scope.$on('validate-' + $state.current.id, function() {
+            $scope.validate();
+        });
+
+        // Dispatch 'validation-response' event to parent controller
+        $scope.validate = function() {
+            if ($scope.webconfig.$valid) {
+                $scope.$emit('validation-response', true);
+            } else {
+                $scope.$emit('validation-response', false);
+                $scope.webconfig.submitted = true;
+            }
+        }
+
+        // Update 'submitted' flag
+        $scope.$watch(function() { return $scope.webconfig.$valid }, function(valid) {
+            if (valid) {
+                $scope.webconfig.submitted = false;
+            }
+        });
+    }]);
\ No newline at end of file