define('@cardstack/tools/components/cs-create-menu', ['exports', '@cardstack/tools/templates/components/cs-create-menu', '@cardstack/tools/private-api', 'ember-concurrency', 'ember-inject-optional'], function (exports, _csCreateMenu, _privateApi, _emberConcurrency, _emberInjectOptional) {
  'use strict';

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = Ember.Component.extend({
    layout: _csCreateMenu.default,
    classNames: ['cs-create-menu'],
    tools: Ember.inject.service('cardstack-tools'),
    store: Ember.inject.service(),
    cardstackRouting: _emberInjectOptional.default.service(),

    availableTypes: Ember.computed(function () {
      return [];
    }),

    loadAvailableTypes: (0, _emberConcurrency.task)( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
      var types;
      return regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              _context.next = 2;
              return this.get('store').query('content-type', { filter: { not: { 'is-built-in': true } } });

            case 2:
              types = _context.sent;

              this.set('availableTypes', types);

            case 4:
            case 'end':
              return _context.stop();
          }
        }
      }, _callee, this);
    })).on('init'),

    actions: {
      create: function create(which) {
        var _get$routeForNew = this.get('cardstackRouting').routeForNew(which.id, this.get('tools.branch')),
            name = _get$routeForNew.name,
            params = _get$routeForNew.params,
            queryParams = _get$routeForNew.queryParams;

        (0, _privateApi.transitionTo)(Ember.getOwner(this), name, params.map(function (p) {
          return p[1];
        }), queryParams);
        this.get('tools').setActivePanel('cs-composition-panel');
        this.get('tools').setEditing(true);
      }
    }
  });
});