define('@cardstack/rendering/components/cs-field', ['exports', '@cardstack/rendering/templates/components/cs-field', '@cardstack/rendering/helpers/cs-field-type', '@cardstack/rendering/helpers/cs-field-caption', 'ember-inject-optional'], function (exports, _csField, _csFieldType, _csFieldCaption, _emberInjectOptional) {
  'use strict';

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = Ember.Component.extend({
    layout: _csField.default,
    tagName: '',

    // if cardstack tools is present, we use it to decide to be active,
    // otherwise we are never active because no editing tools are
    // present.
    tools: _emberInjectOptional.default.service('cardstack-tools'),

    fieldType: Ember.computed('content', 'fieldName', function () {
      return (0, _csFieldType.fieldType)(this.get('content'), this.get('fieldName'));
    }),

    fieldCaption: Ember.computed('content', 'fieldName', function () {
      return (0, _csFieldCaption.fieldCaption)(this.get('content'), this.get('fieldName'));
    }),

    fieldConfig: Ember.computed('fieldType', function () {
      var type = this.get('fieldType');
      if (type) {
        return Ember.getOwner(this).resolveRegistration('field-type:' + type);
      }
    }),

    id: Ember.computed('content', 'fieldName', function () {
      return Ember.guidFor(this.get('content')) + '/cs-field/' + this.get('fieldName');
    }),

    defaultRenderer: Ember.computed('fieldType', function () {
      return 'field-renderers/' + this.get('fieldType') + '-renderer';
    }),

    fieldInfo: Ember.computed('content', 'fieldName', 'fieldCaption', function () {
      return {
        name: this.get('fieldName'),
        content: this.get('content'),
        caption: this.get('fieldCaption')
      };
    })
  }).reopenClass({
    positionalParams: ['content', 'fieldName']
  });
});