<commit_before>'use strict';

kiwiWeb.config(function ($stateProvider, $urlRouterProvider) {

  // Routing Configuration

  $urlRouterProvider.otherwise('/home');

  $stateProvider
  .state('home', {
    url: '/home',
    templateUrl: 'app/home/home.tpl.html',
    controller: 'HomeCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/home/home.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('products', {
    url: '/products',
    templateUrl: 'app/products/products.tpl.html',
    controller: 'ProductsCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/products.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('residential', {
    url: '/residential',
    templateUrl: 'app/products/residential/residential.tpl.html',
    controller: 'ResidentialCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/residential/residential.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('business', {
    url: '/business',
    templateUrl: 'app/products/business/business.tpl.html',
    controller: 'BusinessCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/business/business.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('dedicated', {
    url: '/dedicated',
    templateUrl: 'app/products/dedicated/dedicated.tpl.html',
    controller: 'DedicatedCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/dedicated/dedicated.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('metromesh', {
    url: '/metromesh',
    templateUrl: 'app/products/metromesh/metromesh.tpl.html',
    controller: 'MetroMeshCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/metromesh/metromesh.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('faq', {
    url: '/faq/:section',
    templateUrl: 'app/products/faq/faq.tpl.html',
    controller: 'FaqCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/faq/faq.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('sales', {
    url: '/sales/:product',
    templateUrl: 'app/products/sales/sales.tpl.html',
    controller: 'SalesCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/sales/sales.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      client: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/sales/client.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      location: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/sales/location.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('about', {
    url: '/about',
    templateUrl: 'app/company/about/about.tpl.html',
    controller: 'AboutCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/about/about.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('concesion', {
    url: '/concesion',
    templateUrl: 'app/company/concesion/concesion.tpl.html',
    controller: 'ConcesionCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/concesion/concesion.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('careers', {
    url: '/careers',
    templateUrl: 'app/company/careers/careers.tpl.html',
    controller: 'CareersCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/careers/careers.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('apply', {
    url: '/apply',
    templateUrl: 'app/company/apply/apply.tpl.html',
    controller: 'ApplyCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/apply/apply.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('stories', {
    url: '/stories',
    templateUrl: 'app/company/stories/stories.tpl.html',
    controller: 'StoriesCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/stories/stories.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('privacy', {
    url: '/privacy',
    templateUrl: 'app/company/privacy/privacy.tpl.html',
    controller: 'PrivacyCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/privacy/privacy.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('contact', {
    url: '/contact',
    templateUrl: 'app/contact/contact.tpl.html',
    controller: 'ContactCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/contact/contact.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      contact: function($http) {
        return $http({
          method: 'GET',
          url: 'app/contact/form.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('dashboard', {
    abstract: true,
    url: '/dashboard',
    templateUrl: 'app/customer/dashboard/dashboard.tpl.html',
    controller: 'DashboardCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/customer/dashboard/dashboard.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('dashboard.anon', {
    url: '/anon',
    views: {
      'signUp' : {
        templateUrl: 'app/customer/signUp/signUp.tpl.html',
        controller: 'SignUpCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signUp/signUp.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      },
      'signIn' : {
        templateUrl: 'app/customer/signIn/signIn.tpl.html',
        controller: 'SignInCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signIn/signIn.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      }
    }
  })
  .state('pay', {
    url: '/pay',
    templateUrl: 'app/customer/pay/pay.tpl.html',
    controller: 'PayCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/customer/pay/pay.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('refer', {
    abstract: true,
    url: '/refer',
    templateUrl: 'app/customer/refer/refer.tpl.html',
    controller: 'ReferCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/customer/refer/refer.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('refer.anon', {
    url: '/anon',
    views: {
      'signUp' : {
        templateUrl: 'app/customer/signUp/signUp.tpl.html',
        controller: 'SignUpCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signUp/signUp.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      },
      'signIn' : {
        templateUrl: 'app/customer/signIn/signIn.tpl.html',
        controller: 'SignInCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signIn/signIn.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      }
    }
  })
  .state('support', {
    url: '/support',
    templateUrl: 'app/support/support.tpl.html',
    controller: 'SupportCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/support/support.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      support: function($http) {
        return $http({
          method: 'GET',
          url: 'app/support/form.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('status', {
    url: '/status',
    templateUrl: 'app/support/status/status.tpl.html',
    controller: 'StatusCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/support/status/status.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  });
});
<commit_msg>Adds apply dependencies.<commit_after>'use strict';

kiwiWeb.config(function ($stateProvider, $urlRouterProvider) {

  // Routing Configuration

  $urlRouterProvider.otherwise('/home');

  $stateProvider
  .state('home', {
    url: '/home',
    templateUrl: 'app/home/home.tpl.html',
    controller: 'HomeCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/home/home.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('products', {
    url: '/products',
    templateUrl: 'app/products/products.tpl.html',
    controller: 'ProductsCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/products.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('residential', {
    url: '/residential',
    templateUrl: 'app/products/residential/residential.tpl.html',
    controller: 'ResidentialCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/residential/residential.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('business', {
    url: '/business',
    templateUrl: 'app/products/business/business.tpl.html',
    controller: 'BusinessCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/business/business.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('dedicated', {
    url: '/dedicated',
    templateUrl: 'app/products/dedicated/dedicated.tpl.html',
    controller: 'DedicatedCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/dedicated/dedicated.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('metromesh', {
    url: '/metromesh',
    templateUrl: 'app/products/metromesh/metromesh.tpl.html',
    controller: 'MetroMeshCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/metromesh/metromesh.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('faq', {
    url: '/faq/:section',
    templateUrl: 'app/products/faq/faq.tpl.html',
    controller: 'FaqCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/faq/faq.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('sales', {
    url: '/sales/:product',
    templateUrl: 'app/products/sales/sales.tpl.html',
    controller: 'SalesCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/sales/sales.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      client: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/sales/client.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      location: function($http) {
        return $http({
          method: 'GET',
          url: 'app/products/sales/location.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('about', {
    url: '/about',
    templateUrl: 'app/company/about/about.tpl.html',
    controller: 'AboutCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/about/about.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('concesion', {
    url: '/concesion',
    templateUrl: 'app/company/concesion/concesion.tpl.html',
    controller: 'ConcesionCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/concesion/concesion.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('careers', {
    url: '/careers',
    templateUrl: 'app/company/careers/careers.tpl.html',
    controller: 'CareersCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/careers/careers.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('apply', {
    url: '/apply',
    templateUrl: 'app/company/apply/apply.tpl.html',
    controller: 'ApplyCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/apply/apply.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      apply: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/apply/form.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('stories', {
    url: '/stories',
    templateUrl: 'app/company/stories/stories.tpl.html',
    controller: 'StoriesCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/stories/stories.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('privacy', {
    url: '/privacy',
    templateUrl: 'app/company/privacy/privacy.tpl.html',
    controller: 'PrivacyCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/company/privacy/privacy.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('contact', {
    url: '/contact',
    templateUrl: 'app/contact/contact.tpl.html',
    controller: 'ContactCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/contact/contact.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      contact: function($http) {
        return $http({
          method: 'GET',
          url: 'app/contact/form.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('dashboard', {
    abstract: true,
    url: '/dashboard',
    templateUrl: 'app/customer/dashboard/dashboard.tpl.html',
    controller: 'DashboardCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/customer/dashboard/dashboard.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('dashboard.anon', {
    url: '/anon',
    views: {
      'signUp' : {
        templateUrl: 'app/customer/signUp/signUp.tpl.html',
        controller: 'SignUpCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signUp/signUp.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      },
      'signIn' : {
        templateUrl: 'app/customer/signIn/signIn.tpl.html',
        controller: 'SignInCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signIn/signIn.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      }
    }
  })
  .state('pay', {
    url: '/pay',
    templateUrl: 'app/customer/pay/pay.tpl.html',
    controller: 'PayCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/customer/pay/pay.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('refer', {
    abstract: true,
    url: '/refer',
    templateUrl: 'app/customer/refer/refer.tpl.html',
    controller: 'ReferCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/customer/refer/refer.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('refer.anon', {
    url: '/anon',
    views: {
      'signUp' : {
        templateUrl: 'app/customer/signUp/signUp.tpl.html',
        controller: 'SignUpCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signUp/signUp.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      },
      'signIn' : {
        templateUrl: 'app/customer/signIn/signIn.tpl.html',
        controller: 'SignInCtrl',
        resolve: {
          lang: function($http) {
            return $http({
              method: 'GET',
              url: 'app/customer/signIn/signIn.lang.es.json'
            })
            .then(function(data) {
              return data;
            });
          }
        }
      }
    }
  })
  .state('support', {
    url: '/support',
    templateUrl: 'app/support/support.tpl.html',
    controller: 'SupportCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/support/support.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      },
      support: function($http) {
        return $http({
          method: 'GET',
          url: 'app/support/form.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  })
  .state('status', {
    url: '/status',
    templateUrl: 'app/support/status/status.tpl.html',
    controller: 'StatusCtrl',
    resolve: {
      lang: function($http) {
        return $http({
          method: 'GET',
          url: 'app/support/status/status.lang.es.json'
        })
        .then(function(data) {
          return data;
        });
      }
    }
  });
});
<|endoftext|>


<commit_before>import Wrapper from '../client/Wrapper';

import Bookmarks from '../client/bookmarks/Bookmarks';
import Drafts from '../client/post/Write/Drafts';
import Replies from '../client/replies/Replies';
import Activity from '../client/activity/Activity';
import Wallet from '../client/wallet/Wallet';
import Editor from '../client/post/Write/Write';
import Settings from '../client/settings/Settings';
import ProfileSettings from '../client/settings/ProfileSettings';
import Invite from '../client/invite/Invite';
import User from '../client/user/User';
import UserProfile from '../client/user/UserProfile';
import UserComments from '../client/user/UserComments';
import UserFollowers from '../client/user/UserFollowers';
import UserFollowing from '../client/user/UserFollowing';
import UserReblogs from '../client/user/UserReblogs';
import UserWallet from '../client/user/UserWallet';
import UserActivity from '../client/activity/UserActivity';
import Post from '../client/post/Post';
import Page from '../client/feed/Page';
import Discover from '../client/discover/Discover';
import Search from '../client/search/Search';
import Notifications from '../client/notifications/Notifications';
import Error404 from '../client/statics/Error404';
import ExitPage from '../client/statics/ExitPage';

const routes = [
  {
    component: Wrapper,
    routes: [
      {
        path: '/bookmarks',
        exact: true,
        component: Bookmarks,
      },
      {
        path: '/drafts',
        exact: true,
        component: Drafts,
      },
      {
        path: '/replies',
        exact: true,
        component: Replies,
      },
      {
        path: '/activity',
        exact: true,
        component: Activity,
      },
      {
        path: '/wallet',
        exact: true,
        component: Wallet,
      },
      {
        path: '/editor',
        component: Editor,
      },
      {
        path: '/settings',
        exact: true,
        component: Settings,
      },
      {
        path: '/edit-profile',
        exact: true,
        component: ProfileSettings,
      },
      {
        path: '/invite',
        exact: true,
        component: Invite,
      },
      {
        path: '/notifications',
        exact: true,
        component: Notifications,
      },
      {
        path: '/@:name/(comments|followers|followed|reblogs|feed|transfers|activity)?',
        component: User,
        exact: true,
        routes: [
          {
            path: '/@:name',
            exact: true,
            component: UserProfile,
          },
          {
            path: '/@:name/comments',
            exact: true,
            component: UserComments,
          },
          {
            path: '/@:name/followers',
            exact: true,
            component: UserFollowers,
          },
          {
            path: '/@:name/followed',
            exact: true,
            component: UserFollowing,
          },
          {
            path: '/@:name/reblogs',
            exact: true,
            component: UserReblogs,
          },
          {
            path: '/@:name/transfers',
            exact: true,
            component: UserWallet,
          },
          {
            path: '/@:name/activity',
            exact: true,
            component: UserActivity,
          },
        ],
      },
      {
        path: '/discover',
        exact: true,
        component: Discover,
      },
      {
        path: '/:category?/@:author/:permlink',
        component: Post,
      },
      {
        path: '/search',
        component: Search,
      },
      {
        path: '/exit',
        component: ExitPage,
      },
      {
        path: '/:sortBy(trending|created|active|hot|promoted)?/:category?',
        component: Page,
      },
      {
        path: '*',
        component: Error404,
      },
    ],
  },
];

export default routes;
<commit_msg>Only show editor for /editor (#2097)<commit_after>import Wrapper from '../client/Wrapper';

import Bookmarks from '../client/bookmarks/Bookmarks';
import Drafts from '../client/post/Write/Drafts';
import Replies from '../client/replies/Replies';
import Activity from '../client/activity/Activity';
import Wallet from '../client/wallet/Wallet';
import Editor from '../client/post/Write/Write';
import Settings from '../client/settings/Settings';
import ProfileSettings from '../client/settings/ProfileSettings';
import Invite from '../client/invite/Invite';
import User from '../client/user/User';
import UserProfile from '../client/user/UserProfile';
import UserComments from '../client/user/UserComments';
import UserFollowers from '../client/user/UserFollowers';
import UserFollowing from '../client/user/UserFollowing';
import UserReblogs from '../client/user/UserReblogs';
import UserWallet from '../client/user/UserWallet';
import UserActivity from '../client/activity/UserActivity';
import Post from '../client/post/Post';
import Page from '../client/feed/Page';
import Discover from '../client/discover/Discover';
import Search from '../client/search/Search';
import Notifications from '../client/notifications/Notifications';
import Error404 from '../client/statics/Error404';
import ExitPage from '../client/statics/ExitPage';

const routes = [
  {
    component: Wrapper,
    routes: [
      {
        path: '/bookmarks',
        exact: true,
        component: Bookmarks,
      },
      {
        path: '/drafts',
        exact: true,
        component: Drafts,
      },
      {
        path: '/replies',
        exact: true,
        component: Replies,
      },
      {
        path: '/activity',
        exact: true,
        component: Activity,
      },
      {
        path: '/wallet',
        exact: true,
        component: Wallet,
      },
      {
        path: '/editor',
        component: Editor,
        exact: true,
      },
      {
        path: '/settings',
        exact: true,
        component: Settings,
      },
      {
        path: '/edit-profile',
        exact: true,
        component: ProfileSettings,
      },
      {
        path: '/invite',
        exact: true,
        component: Invite,
      },
      {
        path: '/notifications',
        exact: true,
        component: Notifications,
      },
      {
        path: '/@:name/(comments|followers|followed|reblogs|feed|transfers|activity)?',
        component: User,
        exact: true,
        routes: [
          {
            path: '/@:name',
            exact: true,
            component: UserProfile,
          },
          {
            path: '/@:name/comments',
            exact: true,
            component: UserComments,
          },
          {
            path: '/@:name/followers',
            exact: true,
            component: UserFollowers,
          },
          {
            path: '/@:name/followed',
            exact: true,
            component: UserFollowing,
          },
          {
            path: '/@:name/reblogs',
            exact: true,
            component: UserReblogs,
          },
          {
            path: '/@:name/transfers',
            exact: true,
            component: UserWallet,
          },
          {
            path: '/@:name/activity',
            exact: true,
            component: UserActivity,
          },
        ],
      },
      {
        path: '/discover',
        exact: true,
        component: Discover,
      },
      {
        path: '/:category?/@:author/:permlink',
        component: Post,
      },
      {
        path: '/search',
        component: Search,
      },
      {
        path: '/exit',
        component: ExitPage,
      },
      {
        path: '/:sortBy(trending|created|active|hot|promoted)?/:category?',
        component: Page,
      },
      {
        path: '*',
        component: Error404,
      },
    ],
  },
];

export default routes;
<|endoftext|>


<commit_before>function x_axis(args) {
    var svg = d3.select(args.target + ' svg');
    var g;
    var min_x;
    var max_x;

    args.scalefns.xf = function(di) {
        return args.scales.X(di[args.x_accessor]);
    }

    var last_i;
    if (args.chart_type == 'line'){
        for(var i=0; i<args.data.length; i++) {
            last_i = args.data[i].length-1;

            if(args.data[i][0][args.x_accessor] < min_x || !min_x)
                min_x = args.data[i][0][args.x_accessor];

            if(args.data[i][last_i][args.x_accessor] > max_x || !max_x)
                max_x = args.data[i][last_i][args.x_accessor];
        }
    } else if (args.chart_type == 'point') {
        max_x = d3.max(args.data[0], function(d){return d[args.x_accessor]});
        min_x = d3.min(args.data[0], function(d){return d[args.x_accessor]});
    }
    else if (args.chart_type == 'histogram') {
        min_x = d3.min(args.data[0], function(d){return d[args.x_accessor]});
        max_x = d3.max(args.data[0], function(d){return d[args.x_accessor]});

        //force override xax_format
        //todo revisit to see if this makes sense
        args.xax_format = function(f) {
            if (f < 1.0) {
                //don't scale tiny values
                return args.yax_units + d3.round(f, args.decimals);
            }
            else {
                var pf = d3.formatPrefix(f);
                return args.xax_units + pf.scale(f) + pf.symbol;
            }
        }
    } else if (args.chart_type = 'bar') {

        //min_x = d3.min(args.data[0], function(d){return d[args.value_accessor]});
        min_x = 0; // TODO: think about what actually makes sense.
        max_x = d3.max(args.data[0], function(d){return d[args.x_accessor]});
        args.xax_format = function(f) {
            if (f < 1.0) {
                //don't scale tiny values
                return args.yax_units + d3.round(f, args.decimals);
            }
            else {
                var pf = d3.formatPrefix(f);
                return args.xax_units + pf.scale(f) + pf.symbol;
            }
        }
    }

    min_x = args.min_x ? args.min_x : min_x;
    max_x = args.max_x ? args.max_x : max_x;
    args.x_axis_negative = false;
    if (!args.time_series) {
        if (min_x < 0){
            min_x = min_x  - (max_x * (args.inflator-1));
            args.x_axis_negative = true;
        }
    }

    // this is for some charts that might need additional buffer, such as the bar chart.
    var additional_buffer;

    if (args.chart_type == 'bar'){
        additional_buffer = args.buffer*5;
    } else {
        additional_buffer = 0;
    }

    args.scales.X = (args.time_series)
        ? d3.time.scale()
        : d3.scale.linear();
    args.scales.X
        .domain([min_x, max_x])
        .range([args.left + args.buffer, args.width - args.right - args.buffer - additional_buffer]);

    //remove the old x-axis, add new one
    if($(args.target + ' svg .x-axis').length > 0) {
        $(args.target + ' svg .x-axis')
            .remove();
    }

    if (!args.x_axis) return this;

    //x axis
    g = svg.append('g')
        .classed('x-axis', true)
        .classed('x-axis-small', args.use_small_class);

    var last_i = args.scales.X.ticks(args.xax_count).length-1;

    //are we adding a label?
    if(args.x_label) {
        g.append('text')
            .attr('class', 'label')
            .attr('x', function() {
                return args.left + args.buffer
                    + ((args.width - args.right - args.buffer)
                        - (args.left + args.buffer)) / 2;
            })
            .attr('y', args.height - args.bottom / 2)
            .attr('dy', '.50em')
            .attr('text-anchor', 'middle')
            .text(function(d) {
                return args.x_label;
            })
    }

    if(args.chart_type != 'bar' && !args.x_extended_ticks && !args.y_extended_ticks) {
        //extend axis line across bottom, rather than from domain's min..max
        g.append('line')
            .attr('x1',
                args.concise == false ?
                args.left + args.buffer :
                args.scales.X(args.scales.X.ticks(args.xax_count)[0]))
            .attr('x2',
                args.concise == false ?
                args.width - args.right - args.buffer :
                args.scales.X(args.scales.X.ticks(args.xax_count)[last_i]))
            .attr('y1', args.height - args.bottom)
            .attr('y2', args.height - args.bottom);
    }

    //add x ticks
    g.selectAll('.xax-ticks')
        .data(args.scales.X.ticks(args.xax_count)).enter()
            .append('line')
                .attr('x1', args.scales.X)
                .attr('x2', args.scales.X)
                .attr('y1', args.height - args.bottom)
                .attr('y2', function() {
                    return (args.x_extended_ticks)
                        ? args.top
                        : args.height - args.bottom + args.xax_tick;
                })
                .attr('class', function() {
                    if(args.x_extended_ticks)
                        return 'extended-x-ticks';
                });
    g.selectAll('.xax-labels')
        .data(args.scales.X.ticks(args.xax_count)).enter()
            .append('text')
                .attr('x', args.scales.X)
                .attr('y', args.height - args.bottom + args.xax_tick * 7 / 3)
                .attr('dy', '.50em')
                .attr('text-anchor', 'middle')
                .text(function(d) {
                    return args.xax_units + args.xax_format(d);
                })

    //are we adding years to x-axis
    if (args.time_series && args.show_years) {
        var min_x;
        var max_x;

        for (var i=0; i<args.data.length; i++) {
            last_i = args.data[i].length-1;

            if(args.data[i][0][args.x_accessor] < min_x || !min_x)
                min_x = args.data[i][0][args.x_accessor];
            if(args.data[i][last_i][args.x_accessor] > max_x || !max_x)
                max_x = args.data[i][last_i][args.x_accessor];
        }

        var years = d3.time.years(min_x, max_x);

        if (years.length == 0){
            var first_tick = args.scales.X.ticks(args.xax_count)[0];
            years = [first_tick];
        }

        //append year marker to x-axis group
        g = g.append('g')
            .classed('year-marker', true)
            .classed('year-marker-small', args.use_small_class);

        g.selectAll('.year_marker')
            .data(years).enter()
                .append('line')
                    .attr('x1', args.scales.X)
                    .attr('x2', args.scales.X)
                    .attr('y1', args.top)
                    .attr('y2', args.height - args.bottom);

        var yformat = d3.time.format('%Y');
        g.selectAll('.year_marker')
            .data(years).enter()
                .append('text')
                    .attr('x', args.scales.X)
                    .attr('y', args.height - args.buffer + args.xax_tick)
                    .attr('dy', args.use_small_class ? -3 : (args.y_extended_ticks) ? -6 : 0 )
                    .attr('text-anchor', 'middle')
                    .text(function(d) {
                        return yformat(d);
                    });
    };

    return this;
}
<commit_msg>Fix issue #141<commit_after>function x_axis(args) {
    var svg = d3.select(args.target + ' svg');
    var g;
    var min_x;
    var max_x;

    args.scalefns.xf = function(di) {
        return args.scales.X(di[args.x_accessor]);
    }

    var last_i;
    if (args.chart_type == 'line'){
        for(var i=0; i<args.data.length; i++) {
            last_i = args.data[i].length-1;

            if(args.data[i][0][args.x_accessor] < min_x || !min_x)
                min_x = args.data[i][0][args.x_accessor];

            if(args.data[i][last_i][args.x_accessor] > max_x || !max_x)
                max_x = args.data[i][last_i][args.x_accessor];
        }
    } else if (args.chart_type == 'point') {
        max_x = d3.max(args.data[0], function(d){return d[args.x_accessor]});
        min_x = d3.min(args.data[0], function(d){return d[args.x_accessor]});
    }
    else if (args.chart_type == 'histogram') {
        min_x = d3.min(args.data[0], function(d){return d[args.x_accessor]});
        max_x = d3.max(args.data[0], function(d){return d[args.x_accessor]});

        //force override xax_format
        //todo revisit to see if this makes sense
        args.xax_format = function(f) {
            if (f < 1.0) {
                //don't scale tiny values
                return args.yax_units + d3.round(f, args.decimals);
            }
            else {
                var pf = d3.formatPrefix(f);
                return args.xax_units + pf.scale(f) + pf.symbol;
            }
        }
    } else if (args.chart_type = 'bar') {

        //min_x = d3.min(args.data[0], function(d){return d[args.value_accessor]});
        min_x = 0; // TODO: think about what actually makes sense.
        max_x = d3.max(args.data[0], function(d){return d[args.x_accessor]});
        args.xax_format = function(f) {
            if (f < 1.0) {
                //don't scale tiny values
                return args.yax_units + d3.round(f, args.decimals);
            }
            else {
                var pf = d3.formatPrefix(f);
                return args.xax_units + pf.scale(f) + pf.symbol;
            }
        }
    }

    min_x = args.min_x ? args.min_x : min_x;
    max_x = args.max_x ? args.max_x : max_x;
    args.x_axis_negative = false;
    if (!args.time_series) {
        if (min_x < 0){
            min_x = min_x  - (max_x * (args.inflator-1));
            args.x_axis_negative = true;
        }
    }

    // this is for some charts that might need additional buffer, such as the bar chart.
    var additional_buffer;

    if (args.chart_type == 'bar'){
        additional_buffer = args.buffer*5;
    } else {
        additional_buffer = 0;
    }

    args.scales.X = (args.time_series)
        ? d3.time.scale()
        : d3.scale.linear();
    args.scales.X
        .domain([min_x, max_x])
        .range([args.left + args.buffer, args.width - args.right - args.buffer - additional_buffer]);

    //remove the old x-axis, add new one
    if($(args.target + ' svg .x-axis').length > 0) {
        $(args.target + ' svg .x-axis')
            .remove();
    }

    if (!args.x_axis) return this;

    //x axis
    g = svg.append('g')
        .classed('x-axis', true)
        .classed('x-axis-small', args.use_small_class);

    var last_i = args.scales.X.ticks(args.xax_count).length-1;

    //are we adding a label?
    if(args.x_label) {
        g.append('text')
            .attr('class', 'label')
            .attr('x', function() {
                return args.left + args.buffer
                    + ((args.width - args.right - args.buffer)
                        - (args.left + args.buffer)) / 2;
            })
            .attr('y', args.height - args.bottom / 2)
            .attr('dy', '.50em')
            .attr('text-anchor', 'middle')
            .text(function(d) {
                return args.x_label;
            })
    }

    if(args.chart_type != 'bar' && !args.x_extended_ticks && !args.y_extended_ticks) {
        //extend axis line across bottom, rather than from domain's min..max
        g.append('line')
            .attr('x1',
                (args.concise == false || args.xax_count == 0)
                    ? args.left + args.buffer
                    : args.scales.X(args.scales.X.ticks(args.xax_count)[0])
            )
            .attr('x2',
                (args.concise == false || args.xax_count == 0)
                    ? args.width - args.right - args.buffer
                    : args.scales.X(args.scales.X.ticks(args.xax_count)[last_i])
            )
            .attr('y1', args.height - args.bottom)
            .attr('y2', args.height - args.bottom);
    }

    //add x ticks
    g.selectAll('.xax-ticks')
        .data(args.scales.X.ticks(args.xax_count)).enter()
            .append('line')
                .attr('x1', args.scales.X)
                .attr('x2', args.scales.X)
                .attr('y1', args.height - args.bottom)
                .attr('y2', function() {
                    return (args.x_extended_ticks)
                        ? args.top
                        : args.height - args.bottom + args.xax_tick;
                })
                .attr('class', function() {
                    if(args.x_extended_ticks)
                        return 'extended-x-ticks';
                });
    g.selectAll('.xax-labels')
        .data(args.scales.X.ticks(args.xax_count)).enter()
            .append('text')
                .attr('x', args.scales.X)
                .attr('y', args.height - args.bottom + args.xax_tick * 7 / 3)
                .attr('dy', '.50em')
                .attr('text-anchor', 'middle')
                .text(function(d) {
                    return args.xax_units + args.xax_format(d);
                })

    //are we adding years to x-axis
    if (args.time_series && args.show_years) {
        var min_x;
        var max_x;

        for (var i=0; i<args.data.length; i++) {
            last_i = args.data[i].length-1;

            if(args.data[i][0][args.x_accessor] < min_x || !min_x)
                min_x = args.data[i][0][args.x_accessor];
            if(args.data[i][last_i][args.x_accessor] > max_x || !max_x)
                max_x = args.data[i][last_i][args.x_accessor];
        }

        var years = d3.time.years(min_x, max_x);

        if (years.length == 0){
            var first_tick = args.scales.X.ticks(args.xax_count)[0];
            years = [first_tick];
        }

        //append year marker to x-axis group
        g = g.append('g')
            .classed('year-marker', true)
            .classed('year-marker-small', args.use_small_class);

        g.selectAll('.year_marker')
            .data(years).enter()
                .append('line')
                    .attr('x1', args.scales.X)
                    .attr('x2', args.scales.X)
                    .attr('y1', args.top)
                    .attr('y2', args.height - args.bottom);

        var yformat = d3.time.format('%Y');
        g.selectAll('.year_marker')
            .data(years).enter()
                .append('text')
                    .attr('x', args.scales.X)
                    .attr('y', args.height - args.buffer + args.xax_tick)
                    .attr('dy', args.use_small_class ? -3 : (args.y_extended_ticks) ? -6 : 0 )
                    .attr('text-anchor', 'middle')
                    .text(function(d) {
                        return yformat(d);
                    });
    };

    return this;
}
<|endoftext|>


<commit_before>/*#ifndef(UMD)*/
"use strict";
/*global _gpfGenericFactory*/ // Create any class by passing the right number of parameters
/*global _gpfMainContext*/ // Main context object
/*exported _gpfArraySlice*/ // Slice an array-like object
/*exported _gpfIsISO8601String*/ // Check if the string is an ISO 8601 representation of a date
/*exported _gpfJsCommentsRegExp*/ // Find all JavaScript comments
/*#endif*/

/*eslint-disable no-proto*/ // Used for compatibility reasons
/*jshint -W103*/

var _gpfArrayPrototypeSlice = Array.prototype.slice;

/**
 * Slice an array-like object
 *
 * @param {Object} array array-like parameter (arguments, Array)
 * @param {Number} from
 * @param {Number} [to=undefined] to
 * @return {Array}
 */
function _gpfArraySlice (array, from, to) {
    return _gpfArrayPrototypeSlice.call(array, from || 0, to || array.length + 1);
}

function _pad (number) {
    if (10 > number) {
        return "0" + number;
    }
    return number;
}

//region Polyfills for missing 'standard' methods

var _gpfCompatibility = {

    Array: {
        on: Array,

        methods: {

            // Introduced with JavaScript 1.6
            every: function (callback) {
                var thisArg = arguments[1],
                    len = this.length,
                    idx;
                for (idx = 0; idx < len; ++idx) {
                    if (!callback.call(thisArg, this[idx], idx, this)) {
                        return false;
                    }
                }
                return true;
            },

            // Introduced with JavaScript 1.6
            filter: function (callback) {
                var thisArg = arguments[1],
                    result = [],
                    len = this.length,
                    idx,
                    item;
                for (idx = 0; idx < len; ++idx) {
                    item = this[idx];
                    if (callback.call(thisArg, this[idx], idx, this)) {
                        result.push(item);
                    }
                }
                return result;
            },

            // Introduced with JavaScript 1.6
            forEach: function (callback) {
                var thisArg = arguments[1],
                    len = this.length,
                    idx;
                for (idx = 0; idx < len; ++idx) {
                    callback.call(thisArg, this[idx], idx, this);
                }
            },

            // Introduced with JavaScript 1.5
            indexOf: function (searchElement) {
                var fromIndex = arguments[1],
                    index = fromIndex || 0,
                    thisLength = this.length;
                while (index < thisLength) {
                    if (this[index] === searchElement) {
                        return index;
                    }
                    ++index;
                }
                return -1;
            },

            // Introduced with JavaScript 1.6
            map: function (callback) {
                var thisArg = arguments[1],
                    thisLength = this.length,
                    result = new Array(thisLength),
                    index;
                for (index = 0; index < thisLength; ++index) {
                    result[index] = callback.call(thisArg, this[index], index, this);
                }
                return result;
            },

            // Introduced with JavaScript 1.8
            reduce: function (callback) {
                var initialValue = arguments[1],
                    thisLength = this.length,
                    index = 0,
                    value;
                if (undefined === initialValue) {
                    value = this[index++];
                } else {
                    value = initialValue;
                }
                for (; index < thisLength; ++index) {
                    value = callback(value, this[index], index, this);
                }
                return value;
            }

        },

        statics: {

            // Introduced with ECMAScript 2015
            from: function (arrayLike) {
                var length = arrayLike.length,
                    array = [],
                    index,
                    callback = arguments[1],
                    thisArg = arguments[2];
                if ("string" === typeof arrayLike) {
                    // Required for cscript
                    for (index = 0; index < length; ++index) {
                        array.push(arrayLike.charAt(index));
                    }

                } else {
                    for (index = 0; index < length; ++index) {
                        array.push(arrayLike[index]);
                    }
                }
                if ("function" === typeof callback) {
                    array = array.map(callback, thisArg);
                }
                return array;
            }

        }

    },

    Function: {
        on: Function,

        methods: {

            // Introduced with JavaScript 1.8.5
            bind: function (thisArg) {
                var me = this,
                    prependArgs = _gpfArrayPrototypeSlice.call(arguments, 1);
                return function () {
                    var args = _gpfArrayPrototypeSlice.call(arguments, 0);
                    me.apply(thisArg, prependArgs.concat(args));
                };
            }

        }

    },

    Object: {
        on: Object,

        statics: {

            create: (function () {
                function Temp () {}
                return function (O) {
                    Temp.prototype = O;
                    var obj = new Temp();
                    Temp.prototype = null;
                    /* istanbul ignore if */ // NodeJS does not use __proto__
                    if (!obj.__proto__) {
                        obj.__proto__ = O;
                    }
                    return obj;
                };
            }()),

            getPrototypeOf: function (object) {
                // May break if the constructor has been tampered with
                return object.__proto__ || object.constructor.prototype;
            },

            // Introduced with JavaScript 1.8.5
            keys: function (object) {
                var result = [],
                    key;
                for (key in object) {
                    if (object.hasOwnProperty(key)) {
                        result.push(key);
                    }
                }
                return result;
            },

            // Introduced with JavaScript 1.8.5
            values: function (object) {
                var result = [],
                    key;
                for (key in object) {
                    if (object.hasOwnProperty(key)) {
                        result.push(object[key]);
                    }
                }
                return result;
            }

        }

    },

    String: {
        on: String,

        methods: {

            // Introduced with JavaScript 1.8.1
            trim: (function () {
                var rtrim = new RegExp("^[\\s\uFEFF\xA0]+|[\\s\uFEFF\xA0]+$", "g");
                return function () {
                    return this.replace(rtrim, "");
                };
            }())

        }

    },

    Date: {
        on: Date,

        methods: {

            // Introduced with JavaScript 1.8
            toISOString: function () {
                return [
                    this.getUTCFullYear(),
                    "-",
                    _pad(this.getUTCMonth() + 1),
                    "-",
                    _pad(this.getUTCDate()),
                    "T",
                    _pad(this.getUTCHours()),
                    ":",
                    _pad(this.getUTCMinutes()),
                    ":",
                    _pad(this.getUTCSeconds()),
                    ".",
                    (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5),
                    "Z"
                ].join("");
            }

        }

    }

};

(function () {
    var type,
        overrides;

    function install (dictionary, methods) {
        for (var name in methods) {
            /* istanbul ignore else */
            if (methods.hasOwnProperty(name)) {
                /* istanbul ignore if */ // NodeJS environment already contains all methods
                if (undefined === dictionary[name]) {
                    dictionary[name] = methods[name];
                }
            }
        }
    }

    for (type in _gpfCompatibility) {
        /* istanbul ignore else */
        if (_gpfCompatibility.hasOwnProperty(type)) {
            overrides = _gpfCompatibility[type];
            var on = overrides.on;
            if (overrides.methods) {
                install(on.prototype, overrides.methods);
            }
            if (overrides.statics) {
                install(on, overrides.statics);
            }
        }
    }

}());

//endregion

//region Function name

// Get the name of a function if bound to the call
var _gpfJsCommentsRegExp =  new RegExp("//.*$|/\\*(?:[^\\*]*|\\*[^/]*)\\*/", "gm");
function _gpfGetFunctionName () {
    // Use simple parsing
    /*jshint validthis:true*/
    var functionSource = Function.prototype.toString.call(this), //eslint-disable-line no-invalid-this
        functionKeywordPos = functionSource.indexOf("function"),
        parameterListStartPos = functionSource.indexOf("(", functionKeywordPos);
    return functionSource
            .substr(functionKeywordPos + 9, parameterListStartPos - functionKeywordPos - 9)
            .replace(_gpfJsCommentsRegExp, "") // remove comments
            .trim();
}

// Handling function name properly
/* istanbul ignore if */ // NodeJS exposes Function.prototype.name
if ((function () {
    /* istanbul ignore next */ // Will never be evaluated
    function functionName () {}
    return functionName.name !== "functionName";
})()) {

    Function.prototype.compatibleName = _gpfGetFunctionName;

} else {

    /**
     * Return function name
     *
     * @return {String}
     */
    Function.prototype.compatibleName = function () {
        return this.name;
    };

}

//endregion

//region Date override

var _gpfISO8601RegExp = new RegExp([
    "^([0-9][0-9][0-9][0-9])",
    "\\-",
    "([0-9][0-9])",
    "\\-",
    "([0-9][0-9])",
    "(?:T",
    "([0-9][0-9])",
    "\\:",
    "([0-9][0-9])",
    "\\:",
    "([0-9][0-9])",
    "(?:\\.",
    "([0-9][0-9][0-9])",
    "Z)?)?$"
].join(""));

/**
 * Check if the string is an ISO 8601 representation of a date
 * Supports long and short syntax.
 *
 * @param {String} value
 * @returns {Number[]} 7 numbers composing the date (Month is 0-based)
 */
function _gpfIsISO8601String (value) {
    var matchResult,
        matchedDigits,
        result,
        len,
        idx;
    if ("string" === typeof value) {
        _gpfISO8601RegExp.lastIndex = 0;
        matchResult = _gpfISO8601RegExp.exec(value);
        if (matchResult) {
            result = [];
            len = matchResult.length - 1; // 0 is the recognized string
            for (idx = 0; idx < len; ++idx) {
                matchedDigits = matchResult[idx + 1];
                if (matchedDigits) {
                    result.push(parseInt(matchResult[idx + 1], 10));
                } else {
                    result.push(0);
                }
            }
            // Month must be corrected (0-based)
            --result[1];
            // Some validation
            if (result[1] < 12
                && result[2] < 32
                && result[3] < 24
                && result[4] < 60
                && result[5] < 60) {
                return result;
            }
        }
    }
}

// Backup original Date constructor
var _GpfGenuineDate = _gpfMainContext.Date;

/**
 * Date constructor supporting ISO 8601 format
 *
 * @returns {Date}
 */
function _GpfDate () {
    var firstArgument = arguments[0],
        values = _gpfIsISO8601String(firstArgument);
    if (values) {
        return new _GpfGenuineDate(_GpfGenuineDate.UTC.apply(_GpfGenuineDate.UTC, values));
    }
    return _gpfGenericFactory.apply(_GpfGenuineDate, arguments);
}

// Copy members
[
    "prototype", // Ensure instanceof
    "UTC",
    "parse",
    "now"
].forEach(function (member) {
    _GpfDate[member] = _GpfGenuineDate[member];
});

(function () {
    var supported = false;
    // Test if ISO 8601 format variations are supported
    try {
        var longDate = new Date("2003-01-22T22:45:34.075Z"),
            shortDate = new Date("2003-01-22");
        supported = 2003 === longDate.getUTCFullYear()
            && 0 === longDate.getUTCMonth()
            && 22 === longDate.getUTCDate()
            && 22 === longDate.getUTCHours()
            && 45 === longDate.getUTCMinutes()
            && 34 === longDate.getUTCSeconds()
            && 75 === longDate.getUTCMilliseconds()
            && 2003 === shortDate.getUTCFullYear()
            && 0 === shortDate.getUTCMonth()
            && 22 === shortDate.getUTCDate();
    } catch (e) {} //eslint-disable-line no-empty
    /* istanbul ignore if */ // NodeJS environment supports ISO 8601 format
    if (!supported) {
        // Replace constructor with new one
        _gpfMainContext.Date = _GpfDate;
    }

}());

//endregion

/*#ifndef(UMD)*/

gpf.internals._gpfCompatibility = _gpfCompatibility;
gpf.internals._gpfGetFunctionName = _gpfGetFunctionName;
gpf.internals._gpfIsISO8601String = _gpfIsISO8601String;
gpf.internals._GpfDate = _GpfDate;

/*#endif*/
<commit_msg>Split compatibility sources<commit_after>/*#ifndef(UMD)*/
"use strict";
/*global _gpfCompatibility*/ // Polyfills for missing 'standard' methods
/*#endif*/

(function () {
    var type,
        overrides;

    function install (dictionary, methods) {
        for (var name in methods) {
            /* istanbul ignore else */
            if (methods.hasOwnProperty(name)) {
                /* istanbul ignore if */ // NodeJS environment already contains all methods
                if (undefined === dictionary[name]) {
                    dictionary[name] = methods[name];
                }
            }
        }
    }

    for (type in _gpfCompatibility) {
        /* istanbul ignore else */
        if (_gpfCompatibility.hasOwnProperty(type)) {
            overrides = _gpfCompatibility[type];
            var on = overrides.on;
            if (overrides.methods) {
                install(on.prototype, overrides.methods);
            }
            if (overrides.statics) {
                install(on, overrides.statics);
            }
        }
    }

}());

/*#ifndef(UMD)*/

gpf.internals._gpfCompatibility = _gpfCompatibility;

/*#endif*/
<|endoftext|>


<commit_before>/*#ifndef(UMD)*/
"use strict";
/*exported _gpfArraySlice*/
/*#endif*/

var _gpfArrayPrototypeSlice = Array.prototype.slice;

/**
 * Slice an array-like object
 *
 * @param {Object} array array-like parameter (arguments, Array)
 * @param {Number} from
 * @param {Number} [to=undefined] to
 * @return {Array}
 */
function _gpfArraySlice (array, from, to) {
    return _gpfArrayPrototypeSlice.apply(array, [from || 0, to || array.length + 1]);
}

if (undefined === Array.prototype.every) {

    // Introduced with JavaScript 1.6
    Array.prototype.every = function (callback, thisArg) {
        var len = this.length,
            idx;
        for (idx = 0; idx < len; ++idx) {
            if (!callback.apply(thisArg, [this[idx], idx, this])) {
                return false;
            }
        }
        return true;
    };
}

if (undefined === Array.prototype.filter) {

    // Introduced with JavaScript 1.6
    Array.prototype.filter = function (callback, thisArg) {
        var result = [],
            len = this.length,
            idx,
            item;
        for (idx = 0; idx < len; ++idx) {
            item = this[idx];
            if (callback.apply(thisArg, [this[idx], idx, this])) {
                result.push(item);
            }
        }
        return result;
    };
}

if (undefined === Array.prototype.forEach) {

    // Introduced with JavaScript 1.6
    Array.prototype.forEach = function (callback, thisArg) {
        var len = this.length,
            idx;
        for (idx = 0; idx < len; ++idx) {
            callback.apply(thisArg, [this[idx], idx, this]);
        }
    };
}

if (undefined === Array.prototype.indexOf) {

    // Introduced with JavaScript 1.5
    Array.prototype.indexOf = function (searchElement, fromIndex) {
        var index = fromIndex || 0,
            thisLength = this.length;
        while (index < thisLength) {
            if (this[index] === searchElement) {
                return index;
            }
            ++index;
        }
        return -1;
    };

}

if (undefined === Array.prototype.map) {

    // Introduced with JavaScript 1.6
    Array.prototype.map = function (callback, thisArg) {
        var thisLength = this.length,
            result = new Array(thisLength),
            index;
        for (index = 0; index < thisLength; ++index) {
            result[index] = callback.apply(thisArg, [this[index], index, this]);
        }
        return result;
    };

}

if (undefined === Array.prototype.reduce) {

    // Introduced with JavaScript 1.8
    Array.prototype.reduce = function (callback, initialValue) {
        var thisLength = this.length,
            index = 0,
            value;
        if (undefined === initialValue) {
            value = this[index++];
        } else {
            value = initialValue;
        }
        for (; index < thisLength; ++index) {
            value = callback(value, this[index], index, this);
        }
        return value;
    };

}

if (undefined === Function.prototype.bind) {

    // Introduced with JavaScript 1.8.5
    Function.prototype.bind = function (thisArg) {
        var me = this,
            prependArgs = _gpfArraySlice(arguments, 1);
        return function() {
            var args = _gpfArraySlice(arguments, 0);
            me.apply(thisArg, prependArgs.concat(args));
        };
    };

}

// Handling function name properly
if ((function () {
    function functionName() {}
    return functionName.name !== "functionName";
})()) {

    (function () {

        var comments = new RegExp("//.*$|/\\*.*\\*/", "g");

        Function.prototype.compatibleName = function () {
            // Use simple parsing as a first step
            // TODO leverage JS parser to implement this properly
            var functionSource = Function.prototype.toString.apply(this),
                functionKeywordPos = functionSource.indexOf("function"),
                parameterListStartPos = functionSource.indexOf("(", functionKeywordPos);
            return functionSource
                    .substr(functionKeywordPos + 9, parameterListStartPos - functionKeywordPos - 9)
                    .replace(comments, "") // remove comments
                    .trim();
        };

    }());

} else {

    /**
     * Return function name
     *
     * @return {String}
     */
    Function.prototype.compatibleName = function () {
        return this.name;
    };

}

/*eslint-disable no-proto*/ // Used for compatibility reasons

if (undefined === Object.create) {

    /*jshint -W103*/
    Object.create = (function() {
        function Temp() {}
        return function (O) {
            Temp.prototype = O;
            var obj = new Temp();
            Temp.prototype = null;
            if (!obj.__proto__) {
                obj.__proto__ = O;
            }
            return obj;
        };
    }());

}

if (undefined === Object.getPrototypeOf) {

    Object.getPrototypeOf = function (object){
        // May break if the constructor has been tampered with
        return object.__proto__ || object.constructor.prototype;
    };
    /*jshint +W103*/

}

if (undefined === String.prototype.trim) {

    // Introduced with JavaScript 1.8.1
    (function () {
        var rtrim = new RegExp("^[\\s\uFEFF\xA0]+|[\\s\uFEFF\xA0]+$", "g");
        String.prototype.trim = function() {
            return this.replace(rtrim, "");
        };
    }());

}
<commit_msg>Eslint fixes<commit_after>/*#ifndef(UMD)*/
"use strict";
/*exported _gpfArraySlice*/
/*#endif*/

var _gpfArrayPrototypeSlice = Array.prototype.slice;

/**
 * Slice an array-like object
 *
 * @param {Object} array array-like parameter (arguments, Array)
 * @param {Number} from
 * @param {Number} [to=undefined] to
 * @return {Array}
 */
function _gpfArraySlice (array, from, to) {
    return _gpfArrayPrototypeSlice.apply(array, [from || 0, to || array.length + 1]);
}

if (undefined === Array.prototype.every) {

    // Introduced with JavaScript 1.6
    Array.prototype.every = function (callback, thisArg) {
        var len = this.length,
            idx;
        for (idx = 0; idx < len; ++idx) {
            if (!callback.apply(thisArg, [this[idx], idx, this])) {
                return false;
            }
        }
        return true;
    };
}

if (undefined === Array.prototype.filter) {

    // Introduced with JavaScript 1.6
    Array.prototype.filter = function (callback, thisArg) {
        var result = [],
            len = this.length,
            idx,
            item;
        for (idx = 0; idx < len; ++idx) {
            item = this[idx];
            if (callback.apply(thisArg, [this[idx], idx, this])) {
                result.push(item);
            }
        }
        return result;
    };
}

if (undefined === Array.prototype.forEach) {

    // Introduced with JavaScript 1.6
    Array.prototype.forEach = function (callback, thisArg) {
        var len = this.length,
            idx;
        for (idx = 0; idx < len; ++idx) {
            callback.apply(thisArg, [this[idx], idx, this]);
        }
    };
}

if (undefined === Array.prototype.indexOf) {

    // Introduced with JavaScript 1.5
    Array.prototype.indexOf = function (searchElement, fromIndex) {
        var index = fromIndex || 0,
            thisLength = this.length;
        while (index < thisLength) {
            if (this[index] === searchElement) {
                return index;
            }
            ++index;
        }
        return -1;
    };

}

if (undefined === Array.prototype.map) {

    // Introduced with JavaScript 1.6
    Array.prototype.map = function (callback, thisArg) {
        var thisLength = this.length,
            result = new Array(thisLength),
            index;
        for (index = 0; index < thisLength; ++index) {
            result[index] = callback.apply(thisArg, [this[index], index, this]);
        }
        return result;
    };

}

if (undefined === Array.prototype.reduce) {

    // Introduced with JavaScript 1.8
    Array.prototype.reduce = function (callback, initialValue) {
        var thisLength = this.length,
            index = 0,
            value;
        if (undefined === initialValue) {
            value = this[index++];
        } else {
            value = initialValue;
        }
        for (; index < thisLength; ++index) {
            value = callback(value, this[index], index, this);
        }
        return value;
    };

}

if (undefined === Function.prototype.bind) {

    // Introduced with JavaScript 1.8.5
    Function.prototype.bind = function (thisArg) {
        var me = this,
            prependArgs = _gpfArraySlice(arguments, 1);
        return function () {
            var args = _gpfArraySlice(arguments, 0);
            me.apply(thisArg, prependArgs.concat(args));
        };
    };

}

// Handling function name properly
if ((function () {
    function functionName () {}
    return functionName.name !== "functionName";
})()) {

    (function () {

        var comments = new RegExp("//.*$|/\\*.*\\*/", "g");

        Function.prototype.compatibleName = function () {
            // Use simple parsing as a first step
            // TODO leverage JS parser to implement this properly
            var functionSource = Function.prototype.toString.apply(this),
                functionKeywordPos = functionSource.indexOf("function"),
                parameterListStartPos = functionSource.indexOf("(", functionKeywordPos);
            return functionSource
                    .substr(functionKeywordPos + 9, parameterListStartPos - functionKeywordPos - 9)
                    .replace(comments, "") // remove comments
                    .trim();
        };

    }());

} else {

    /**
     * Return function name
     *
     * @return {String}
     */
    Function.prototype.compatibleName = function () {
        return this.name;
    };

}

/*eslint-disable no-proto*/ // Used for compatibility reasons

if (undefined === Object.create) {

    /*jshint -W103*/
    Object.create = (function () {
        function Temp () {}
        return function (O) {
            Temp.prototype = O;
            var obj = new Temp();
            Temp.prototype = null;
            if (!obj.__proto__) {
                obj.__proto__ = O;
            }
            return obj;
        };
    }());

}

if (undefined === Object.getPrototypeOf) {

    Object.getPrototypeOf = function (object) {
        // May break if the constructor has been tampered with
        return object.__proto__ || object.constructor.prototype;
    };
    /*jshint +W103*/

}

if (undefined === String.prototype.trim) {

    // Introduced with JavaScript 1.8.1
    (function () {
        var rtrim = new RegExp("^[\\s\uFEFF\xA0]+|[\\s\uFEFF\xA0]+$", "g");
        String.prototype.trim = function () {
            return this.replace(rtrim, "");
        };
    }());

}
<|endoftext|>


<commit_before>const test = require('tape');
const _ = require('lodash');

module.exports = (compose) => {

  test('compose ignores non objects', assert => {
    const stamp = compose(0, 'a', null, undefined, {}, NaN, /regexp/);
    const subject = _.values(stamp.compose).filter(_.negate(_.isEmpty));
    const expected = _.values(compose().compose);

    assert.deepEqual(subject, expected,
      'should not add any descriptor data');

    assert.end();
  });

  test('compose in order', assert => {
    const initOrder = [];
    const getInitDescriptor = (value) => {
      return {initializers: [() => initOrder.push(value)]};
    };

    const stamp = compose(
      compose(getInitDescriptor(0)),
      compose(getInitDescriptor(1), getInitDescriptor(2))
        .compose(getInitDescriptor(3), getInitDescriptor(4)),
      getInitDescriptor(5)
    );
    stamp();
    const expected = [0, 1, 2, 3, 4, 5];

    assert.deepEqual(initOrder, expected,
      'should compose in proper order');

    assert.end();
  });

  test('compose is detachable', assert => {
    const detachedCompose = compose().compose;

    assert.notEqual(compose, detachedCompose,
      'stamp .compose function must be a different object to "compose"');

    assert.end();
  });

  test('detached compose does not inherit previous descriptor', assert => {
    const detachedCompose = compose({properties: {foo: 1}}).compose;
    const obj = detachedCompose()();
    const expected = undefined;

    assert.equal(obj.foo, expected,
      'detached compose method should not inherit parent descriptor data');

    assert.end();
  });

  test('compose is replaceable', assert => {
    let counter = 0;

    function newCompose() {
      counter++;
      return compose({staticProperties: {compose: newCompose}}, this, arguments);
    }

    newCompose().compose().compose();
    const expected = 3;

    assert.equal(counter, expected,
      'should inherit new compose function');

    assert.end();
  });

  test('replaced compose method is always a new object', assert => {
    function newCompose() {
      return compose({staticProperties: {compose: newCompose}}, this, arguments);
    }

    const stamp1 = newCompose();
    const compose1 = stamp1.compose;
    const stamp2 = stamp1.compose();
    const compose2 = stamp2.compose;

    assert.notEqual(compose1, compose2, 'should be different objects');

    assert.end();
  });

  test('replaced compose method is always a function', assert => {
    function newCompose() {
      return compose({staticProperties: {compose: 'rubbish'}}, this, arguments);
    }

    const overridenCompose = newCompose().compose().compose;
    const actual = _.isFunction(overridenCompose);
    const expected = true;

    assert.equal(actual, expected, 'should be a function');

    assert.end();
  });

};
<commit_msg>Add a test to crank up coverage up to 100%<commit_after>const test = require('tape');
const _ = require('lodash');

module.exports = (compose) => {

  test('compose ignores non objects', assert => {
    const stamp = compose(0, 'a', null, undefined, {}, NaN, /regexp/);
    const subject = _.values(stamp.compose).filter(_.negate(_.isEmpty));
    const expected = _.values(compose().compose);

    assert.deepEqual(subject, expected,
      'should not add any descriptor data');

    assert.end();
  });

  test('compose in order', assert => {
    const initOrder = [];
    const getInitDescriptor = (value) => {
      return {initializers: [() => initOrder.push(value)]};
    };

    const stamp = compose(
      compose(getInitDescriptor(0)),
      compose(getInitDescriptor(1), getInitDescriptor(2))
        .compose(getInitDescriptor(3), getInitDescriptor(4)),
      getInitDescriptor(5)
    );
    stamp();
    const expected = [0, 1, 2, 3, 4, 5];

    assert.deepEqual(initOrder, expected,
      'should compose in proper order');

    assert.end();
  });

  test('compose is detachable', assert => {
    const detachedCompose = compose().compose;

    assert.notEqual(compose, detachedCompose,
      'stamp .compose function must be a different object to "compose"');

    assert.end();
  });

  test('detached compose does not inherit previous descriptor', assert => {
    const detachedCompose = compose({properties: {foo: 1}}).compose;
    const obj = detachedCompose()();
    const expected = undefined;

    assert.equal(obj.foo, expected,
      'detached compose method should not inherit parent descriptor data');

    assert.end();
  });

  test('compose is replaceable', assert => {
    let counter = 0;

    function newCompose() {
      counter++;
      return compose({staticProperties: {compose: newCompose}}, this, arguments);
    }

    newCompose().compose().compose();
    const expected = 3;

    assert.equal(counter, expected,
      'should inherit new compose function');

    assert.end();
  });

  test('replaced compose method is always a new object', assert => {
    function newCompose() {
      return compose({staticProperties: {compose: newCompose}}, this, arguments);
    }

    const stamp1 = newCompose();
    const compose1 = stamp1.compose;
    const stamp2 = stamp1.compose();
    const compose2 = stamp2.compose;

    assert.notEqual(compose1, compose2, 'should be different objects');

    assert.end();
  });

  test('replaced compose method is always a function', assert => {
    function newCompose() {
      return compose({staticProperties: {compose: 'rubbish'}}, this, arguments);
    }

    const overridenCompose = newCompose().compose().compose;
    const actual = _.isFunction(overridenCompose);
    const expected = true;

    assert.equal(actual, expected, 'should be a function');

    assert.end();
  });

  test('broken stamp', assert => {
    const brokenStamp = compose();
    delete brokenStamp.compose;

    const instance = brokenStamp();
    assert.ok(instance);

    assert.end();
  });

};
<|endoftext|>


<commit_before>/* @flow */

import { getPayPalDomain } from '@paypal/sdk-client/src';

export function getCheckoutUrl() : string {
    return `${ getPayPalDomain() }${ window.__CHECKOUT_URI__ || __PAYPAL_CHECKOUT__.__URI__.__CHECKOUT__ }`;
}

export function getButtonUrl() : string {
    return `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__BUTTONS__ }`;
}

export function getCardUrl() : string {
    return `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__CARD_FIELDS__ }`;
}

export function getMenuUrl() : string {
    return `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__MENU__ }`;
}

export const DEFAULT_POPUP_SIZE = {
    WIDTH:  500,
    HEIGHT: 590
};
<commit_msg>Reduce popup dimension<commit_after>/* @flow */

import { getPayPalDomain } from '@paypal/sdk-client/src';

export function getCheckoutUrl() : string {
    return `${ getPayPalDomain() }${ window.__CHECKOUT_URI__ || __PAYPAL_CHECKOUT__.__URI__.__CHECKOUT__ }`;
}

export function getButtonUrl() : string {
    return `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__BUTTONS__ }`;
}

export function getCardUrl() : string {
    return `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__CARD_FIELDS__ }`;
}

export function getMenuUrl() : string {
    return `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__MENU__ }`;
}

export const DEFAULT_POPUP_SIZE = {
    WIDTH:  480,
    HEIGHT: 590
};
<|endoftext|>


<commit_before>export const SERVER_URL = 'http://127.0.0.1:5000';
export const API_VERSION = 'api/v1';
export const ANALYTIC_USER_ID = 'UA-00000000-0';
<commit_msg>Return server url back.<commit_after>export const SERVER_URL = 'https://heutagogy.herokuapp.com';
export const API_VERSION = 'api/v1';
export const ANALYTIC_USER_ID = 'UA-00000000-0';
<|endoftext|>


<commit_before>/**
 * @author mrdoob / http://mrdoob.com/
 * @author mikael emtinger / http://gomo.se/
 * @author alteredq / http://alteredqualia.com/
 * @author WestLangley / http://github.com/WestLangley
 */

THREE.Object3D = function () {

	this.id = THREE.Object3DIdCount ++;
	this.uuid = THREE.Math.generateUUID();

	this.name = '';

	this.parent = undefined;
	this.children = [];

	this.up = THREE.Object3D.DefaultUp.clone();

	var scope = this;

	var position = new THREE.Vector3();
	var rotation = new THREE.Euler();
	var quaternion = new THREE.Quaternion();
	var scale = new THREE.Vector3( 1, 1, 1 );

	rotation.onChange( function () {
		quaternion.setFromEuler( rotation, false );
	} );

	quaternion.onChange( function () {
		rotation.setFromQuaternion( quaternion, undefined, false );
	} );

	Object.defineProperties( this, {
		position: {
			enumerable: true,
			value: position
		},
		rotation: {
			enumerable: true,
			value: rotation
		},
		quaternion: {
			enumerable: true,
			value: quaternion
		},
		scale: {
			enumerable: true,
			value: scale
		},
	} );

	this.renderDepth = null;

	this.rotationAutoUpdate = true;

	this.matrix = new THREE.Matrix4();
	this.matrixWorld = new THREE.Matrix4();

	this.matrixAutoUpdate = true;
	this.matrixWorldNeedsUpdate = false;

	this.visible = true;

	this.castShadow = false;
	this.receiveShadow = false;

	this.frustumCulled = true;

	this.userData = {};

};

THREE.Object3D.DefaultUp = new THREE.Vector3( 0, 1, 0 );

THREE.Object3D.prototype = {

	constructor: THREE.Object3D,

	get eulerOrder () {

		console.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );

		return this.rotation.order;

	},

	set eulerOrder ( value ) {

		console.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );

		this.rotation.order = value;

	},

	get useQuaternion () {

		console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );

	},

	set useQuaternion ( value ) {

		console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );

	},

	applyMatrix: function ( matrix ) {

		this.matrix.multiplyMatrices( matrix, this.matrix );

		this.matrix.decompose( this.position, this.quaternion, this.scale );

	},

	setRotationFromAxisAngle: function ( axis, angle ) {

		// assumes axis is normalized

		this.quaternion.setFromAxisAngle( axis, angle );

	},

	setRotationFromEuler: function ( euler ) {

		this.quaternion.setFromEuler( euler, true );

	},

	setRotationFromMatrix: function ( m ) {

		// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

		this.quaternion.setFromRotationMatrix( m );

	},

	setRotationFromQuaternion: function ( q ) {

		// assumes q is normalized

		this.quaternion.copy( q );

	},

	rotateOnAxis: function () {

		// rotate object on axis in object space
		// axis is assumed to be normalized

		var q1 = new THREE.Quaternion();

		return function ( axis, angle ) {

			q1.setFromAxisAngle( axis, angle );

			this.quaternion.multiply( q1 );

			return this;

		}

	}(),

	rotateX: function () {

		var v1 = new THREE.Vector3( 1, 0, 0 );

		return function ( angle ) {

			return this.rotateOnAxis( v1, angle );

		};

	}(),

	rotateY: function () {

		var v1 = new THREE.Vector3( 0, 1, 0 );

		return function ( angle ) {

			return this.rotateOnAxis( v1, angle );

		};

	}(),

	rotateZ: function () {

		var v1 = new THREE.Vector3( 0, 0, 1 );

		return function ( angle ) {

			return this.rotateOnAxis( v1, angle );

		};

	}(),

	translateOnAxis: function () {

		// translate object by distance along axis in object space
		// axis is assumed to be normalized

		var v1 = new THREE.Vector3();

		return function ( axis, distance ) {

			v1.copy( axis ).applyQuaternion( this.quaternion );

			this.position.add( v1.multiplyScalar( distance ) );

			return this;

		}

	}(),

	translate: function ( distance, axis ) {

		console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
		return this.translateOnAxis( axis, distance );

	},

	translateX: function () {

		var v1 = new THREE.Vector3( 1, 0, 0 );

		return function ( distance ) {

			return this.translateOnAxis( v1, distance );

		};

	}(),

	translateY: function () {

		var v1 = new THREE.Vector3( 0, 1, 0 );

		return function ( distance ) {

			return this.translateOnAxis( v1, distance );

		};

	}(),

	translateZ: function () {

		var v1 = new THREE.Vector3( 0, 0, 1 );

		return function ( distance ) {

			return this.translateOnAxis( v1, distance );

		};

	}(),

	localToWorld: function ( vector ) {

		return vector.applyMatrix4( this.matrixWorld );

	},

	worldToLocal: function () {

		var m1 = new THREE.Matrix4();

		return function ( vector ) {

			return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) );

		};

	}(),

	lookAt: function () {

		// This routine does not support objects with rotated and/or translated parent(s)

		var m1 = new THREE.Matrix4();

		return function ( vector ) {

			m1.lookAt( vector, this.position, this.up );

			this.quaternion.setFromRotationMatrix( m1 );

		};

	}(),

	add: function ( object ) {

		if ( arguments.length > 1 ) {

			for ( var i = 0; i < arguments.length; i++ ) {

				this.add( arguments[ i ] );

			}

			return this;

		};

		if ( object === this ) {

			console.warn( "THREE.Object3D.add: An object can't be added as a child of itself." );
			return this;

		}

		if ( object instanceof THREE.Object3D ) {

			if ( object.parent !== undefined ) {

				object.parent.remove( object );

			}

			object.parent = this;
			object.dispatchEvent( { type: 'added' } );

			this.children.push( object );

			// add to scene

			var scene = this;

			while ( scene.parent !== undefined ) {

				scene = scene.parent;

			}

			if ( scene !== undefined && scene instanceof THREE.Scene )  {

				scene.__addObject( object );

			}

		}

		return this;

	},

	remove: function ( object ) {

		if ( arguments.length > 1 ) {

			for ( var i = 0; i < arguments.length; i++ ) {

				this.remove( arguments[ i ] );

			}

		};

		var index = this.children.indexOf( object );

		if ( index !== - 1 ) {

			object.parent = undefined;
			object.dispatchEvent( { type: 'removed' } );

			this.children.splice( index, 1 );

			// remove from scene

			var scene = this;

			while ( scene.parent !== undefined ) {

				scene = scene.parent;

			}

			if ( scene !== undefined && scene instanceof THREE.Scene ) {

				scene.__removeObject( object );

			}

		}

	},

	raycast: function () {},

	traverse: function ( callback ) {

		callback( this );

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			this.children[ i ].traverse( callback );

		}

	},

	getObjectById: function ( id, recursive ) {

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			var child = this.children[ i ];

			if ( child.id === id ) {

				return child;

			}

			if ( recursive === true ) {

				child = child.getObjectById( id, recursive );

				if ( child !== undefined ) {

					return child;

				}

			}

		}

		return undefined;

	},

	getObjectByName: function ( name, recursive ) {

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			var child = this.children[ i ];

			if ( child.name === name ) {

				return child;

			}

			if ( recursive === true ) {

				child = child.getObjectByName( name, recursive );

				if ( child !== undefined ) {

					return child;

				}

			}

		}

		return undefined;

	},

	getChildByName: function ( name, recursive ) {

		console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
		return this.getObjectByName( name, recursive );

	},

	updateMatrix: function () {

		this.matrix.compose( this.position, this.quaternion, this.scale );

		this.matrixWorldNeedsUpdate = true;

	},

	updateMatrixWorld: function ( force ) {

		if ( this.matrixAutoUpdate === true ) this.updateMatrix();

		if ( this.matrixWorldNeedsUpdate === true || force === true ) {

			if ( this.parent === undefined ) {

				this.matrixWorld.copy( this.matrix );

			} else {

				this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );

			}

			this.matrixWorldNeedsUpdate = false;

			force = true;

		}

		// update children

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			this.children[ i ].updateMatrixWorld( force );

		}

	},

	clone: function ( object, recursive ) {

		if ( object === undefined ) object = new THREE.Object3D();
		if ( recursive === undefined ) recursive = true;

		object.name = this.name;

		object.up.copy( this.up );

		object.position.copy( this.position );
		object.quaternion.copy( this.quaternion );
		object.scale.copy( this.scale );

		object.renderDepth = this.renderDepth;

		object.rotationAutoUpdate = this.rotationAutoUpdate;

		object.matrix.copy( this.matrix );
		object.matrixWorld.copy( this.matrixWorld );

		object.matrixAutoUpdate = this.matrixAutoUpdate;
		object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;

		object.visible = this.visible;

		object.castShadow = this.castShadow;
		object.receiveShadow = this.receiveShadow;

		object.frustumCulled = this.frustumCulled;

		object.userData = JSON.parse( JSON.stringify( this.userData ) );

		if ( recursive === true ) {

			for ( var i = 0; i < this.children.length; i ++ ) {

				var child = this.children[ i ];
				object.add( child.clone() );

			}

		}

		return object;

	}

};

THREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype );

THREE.Object3DIdCount = 0;
<commit_msg>Object3D: Added traverseVisible.<commit_after>/**
 * @author mrdoob / http://mrdoob.com/
 * @author mikael emtinger / http://gomo.se/
 * @author alteredq / http://alteredqualia.com/
 * @author WestLangley / http://github.com/WestLangley
 */

THREE.Object3D = function () {

	this.id = THREE.Object3DIdCount ++;
	this.uuid = THREE.Math.generateUUID();

	this.name = '';

	this.parent = undefined;
	this.children = [];

	this.up = THREE.Object3D.DefaultUp.clone();

	var scope = this;

	var position = new THREE.Vector3();
	var rotation = new THREE.Euler();
	var quaternion = new THREE.Quaternion();
	var scale = new THREE.Vector3( 1, 1, 1 );

	rotation.onChange( function () {
		quaternion.setFromEuler( rotation, false );
	} );

	quaternion.onChange( function () {
		rotation.setFromQuaternion( quaternion, undefined, false );
	} );

	Object.defineProperties( this, {
		position: {
			enumerable: true,
			value: position
		},
		rotation: {
			enumerable: true,
			value: rotation
		},
		quaternion: {
			enumerable: true,
			value: quaternion
		},
		scale: {
			enumerable: true,
			value: scale
		},
	} );

	this.renderDepth = null;

	this.rotationAutoUpdate = true;

	this.matrix = new THREE.Matrix4();
	this.matrixWorld = new THREE.Matrix4();

	this.matrixAutoUpdate = true;
	this.matrixWorldNeedsUpdate = false;

	this.visible = true;

	this.castShadow = false;
	this.receiveShadow = false;

	this.frustumCulled = true;

	this.userData = {};

};

THREE.Object3D.DefaultUp = new THREE.Vector3( 0, 1, 0 );

THREE.Object3D.prototype = {

	constructor: THREE.Object3D,

	get eulerOrder () {

		console.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );

		return this.rotation.order;

	},

	set eulerOrder ( value ) {

		console.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );

		this.rotation.order = value;

	},

	get useQuaternion () {

		console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );

	},

	set useQuaternion ( value ) {

		console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );

	},

	applyMatrix: function ( matrix ) {

		this.matrix.multiplyMatrices( matrix, this.matrix );

		this.matrix.decompose( this.position, this.quaternion, this.scale );

	},

	setRotationFromAxisAngle: function ( axis, angle ) {

		// assumes axis is normalized

		this.quaternion.setFromAxisAngle( axis, angle );

	},

	setRotationFromEuler: function ( euler ) {

		this.quaternion.setFromEuler( euler, true );

	},

	setRotationFromMatrix: function ( m ) {

		// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

		this.quaternion.setFromRotationMatrix( m );

	},

	setRotationFromQuaternion: function ( q ) {

		// assumes q is normalized

		this.quaternion.copy( q );

	},

	rotateOnAxis: function () {

		// rotate object on axis in object space
		// axis is assumed to be normalized

		var q1 = new THREE.Quaternion();

		return function ( axis, angle ) {

			q1.setFromAxisAngle( axis, angle );

			this.quaternion.multiply( q1 );

			return this;

		}

	}(),

	rotateX: function () {

		var v1 = new THREE.Vector3( 1, 0, 0 );

		return function ( angle ) {

			return this.rotateOnAxis( v1, angle );

		};

	}(),

	rotateY: function () {

		var v1 = new THREE.Vector3( 0, 1, 0 );

		return function ( angle ) {

			return this.rotateOnAxis( v1, angle );

		};

	}(),

	rotateZ: function () {

		var v1 = new THREE.Vector3( 0, 0, 1 );

		return function ( angle ) {

			return this.rotateOnAxis( v1, angle );

		};

	}(),

	translateOnAxis: function () {

		// translate object by distance along axis in object space
		// axis is assumed to be normalized

		var v1 = new THREE.Vector3();

		return function ( axis, distance ) {

			v1.copy( axis ).applyQuaternion( this.quaternion );

			this.position.add( v1.multiplyScalar( distance ) );

			return this;

		}

	}(),

	translate: function ( distance, axis ) {

		console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
		return this.translateOnAxis( axis, distance );

	},

	translateX: function () {

		var v1 = new THREE.Vector3( 1, 0, 0 );

		return function ( distance ) {

			return this.translateOnAxis( v1, distance );

		};

	}(),

	translateY: function () {

		var v1 = new THREE.Vector3( 0, 1, 0 );

		return function ( distance ) {

			return this.translateOnAxis( v1, distance );

		};

	}(),

	translateZ: function () {

		var v1 = new THREE.Vector3( 0, 0, 1 );

		return function ( distance ) {

			return this.translateOnAxis( v1, distance );

		};

	}(),

	localToWorld: function ( vector ) {

		return vector.applyMatrix4( this.matrixWorld );

	},

	worldToLocal: function () {

		var m1 = new THREE.Matrix4();

		return function ( vector ) {

			return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) );

		};

	}(),

	lookAt: function () {

		// This routine does not support objects with rotated and/or translated parent(s)

		var m1 = new THREE.Matrix4();

		return function ( vector ) {

			m1.lookAt( vector, this.position, this.up );

			this.quaternion.setFromRotationMatrix( m1 );

		};

	}(),

	add: function ( object ) {

		if ( arguments.length > 1 ) {

			for ( var i = 0; i < arguments.length; i++ ) {

				this.add( arguments[ i ] );

			}

			return this;

		};

		if ( object === this ) {

			console.warn( "THREE.Object3D.add: An object can't be added as a child of itself." );
			return this;

		}

		if ( object instanceof THREE.Object3D ) {

			if ( object.parent !== undefined ) {

				object.parent.remove( object );

			}

			object.parent = this;
			object.dispatchEvent( { type: 'added' } );

			this.children.push( object );

			// add to scene

			var scene = this;

			while ( scene.parent !== undefined ) {

				scene = scene.parent;

			}

			if ( scene !== undefined && scene instanceof THREE.Scene )  {

				scene.__addObject( object );

			}

		}

		return this;

	},

	remove: function ( object ) {

		if ( arguments.length > 1 ) {

			for ( var i = 0; i < arguments.length; i++ ) {

				this.remove( arguments[ i ] );

			}

		};

		var index = this.children.indexOf( object );

		if ( index !== - 1 ) {

			object.parent = undefined;
			object.dispatchEvent( { type: 'removed' } );

			this.children.splice( index, 1 );

			// remove from scene

			var scene = this;

			while ( scene.parent !== undefined ) {

				scene = scene.parent;

			}

			if ( scene !== undefined && scene instanceof THREE.Scene ) {

				scene.__removeObject( object );

			}

		}

	},

	raycast: function () {},

	traverse: function ( callback ) {

		callback( this );

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			this.children[ i ].traverse( callback );

		}

	},

	traverseVisible: function ( callback ) {

		if ( this.visible === false ) return;

		callback( this );

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			this.children[ i ].traverse( callback );

		}

	},

	getObjectById: function ( id, recursive ) {

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			var child = this.children[ i ];

			if ( child.id === id ) {

				return child;

			}

			if ( recursive === true ) {

				child = child.getObjectById( id, recursive );

				if ( child !== undefined ) {

					return child;

				}

			}

		}

		return undefined;

	},

	getObjectByName: function ( name, recursive ) {

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			var child = this.children[ i ];

			if ( child.name === name ) {

				return child;

			}

			if ( recursive === true ) {

				child = child.getObjectByName( name, recursive );

				if ( child !== undefined ) {

					return child;

				}

			}

		}

		return undefined;

	},

	getChildByName: function ( name, recursive ) {

		console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
		return this.getObjectByName( name, recursive );

	},

	updateMatrix: function () {

		this.matrix.compose( this.position, this.quaternion, this.scale );

		this.matrixWorldNeedsUpdate = true;

	},

	updateMatrixWorld: function ( force ) {

		if ( this.matrixAutoUpdate === true ) this.updateMatrix();

		if ( this.matrixWorldNeedsUpdate === true || force === true ) {

			if ( this.parent === undefined ) {

				this.matrixWorld.copy( this.matrix );

			} else {

				this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );

			}

			this.matrixWorldNeedsUpdate = false;

			force = true;

		}

		// update children

		for ( var i = 0, l = this.children.length; i < l; i ++ ) {

			this.children[ i ].updateMatrixWorld( force );

		}

	},

	clone: function ( object, recursive ) {

		if ( object === undefined ) object = new THREE.Object3D();
		if ( recursive === undefined ) recursive = true;

		object.name = this.name;

		object.up.copy( this.up );

		object.position.copy( this.position );
		object.quaternion.copy( this.quaternion );
		object.scale.copy( this.scale );

		object.renderDepth = this.renderDepth;

		object.rotationAutoUpdate = this.rotationAutoUpdate;

		object.matrix.copy( this.matrix );
		object.matrixWorld.copy( this.matrixWorld );

		object.matrixAutoUpdate = this.matrixAutoUpdate;
		object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;

		object.visible = this.visible;

		object.castShadow = this.castShadow;
		object.receiveShadow = this.receiveShadow;

		object.frustumCulled = this.frustumCulled;

		object.userData = JSON.parse( JSON.stringify( this.userData ) );

		if ( recursive === true ) {

			for ( var i = 0; i < this.children.length; i ++ ) {

				var child = this.children[ i ];
				object.add( child.clone() );

			}

		}

		return object;

	}

};

THREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype );

THREE.Object3DIdCount = 0;
<|endoftext|>