{{!-- Activation Cost --}}
<div class="form-group input-select">
    <label>{{ localize "DND5E.ItemActivationCost" }}</label>
    <div class="form-fields">
        {{#if (and system.activation.type (not isCostlessAction))}}
            <input type="number" step="any" name="system.activation.cost"
                   value="{{system.activation.cost}}" placeholder="&mdash;">
        {{/if}}
        <select name="system.activation.type" data-tooltip="DND5E.ItemActivationType">
            {{selectOptions config.abilityActivationTypes selected=system.activation.type blank=""}}
        </select>
    </div>
</div>
{{#if system.activation.type}}

{{!-- Activation Condition --}}
<div class="form-group">
    <label>{{ localize "DND5E.ItemActivationCondition" }}</label>
    <div class="form-fields">
        <input type="text" name="system.activation.condition" value="{{system.activation.condition}}">
    </div>
</div>

{{#if isCrewed}}
<div class="form-group">
    <label>{{ localize "DND5E.Cover" }}</label>
    <div class="form-fields">
        <select name="system.cover" data-dtype="Number">
            {{selectOptions config.cover selected=system.cover blank=""}}
        </select>
    </div>
</div>
{{/if}}

{{!-- Ability Target --}}
<div class="form-group input-select-select">
    <label>{{ localize "DND5E.Target" }}</label>
    <div class="form-fields">
        {{#if system.hasScalarTarget}}
            <input type="text" name="system.target.value" value="{{source.target.value}}"
                   placeholder="&mdash;" data-formula-editor>
        {{/if}}
        {{#if system.hasAreaTarget}}
            <select name="system.target.units" data-tooltip="DND5E.TargetUnits">
                {{selectOptions config.movementUnits selected=system.target.units blank=""}}
            </select>
        {{/if}}
        <select name="system.target.type" data-tooltip="DND5E.TargetType">
            {{#select system.target.type}}
                 <option value="">{{localize "DND5E.None"}}</option>
                 <optgroup label="{{localize 'DND5E.TargetTypeIndividual'}}">
                     {{selectOptions config.individualTargetTypes labelAttr="label"}}
                 </optgroup>
                 <optgroup label="{{localize 'DND5E.TargetTypeArea'}}">
                     {{selectOptions config.areaTargetTypes labelAttr="label"}}
                 </optgroup>
            {{/select}}
        </select>
    </div>
</div>

{{!-- Ability Target Width --}}
{{#if isLine}}
<div class="form-group input-select-select">
    <label>{{ localize "DND5E.TargetWidth" }}</label>
    <div class="form-fields">
        <input type="number" step="any" name="system.target.width"
            value="{{system.target.width}}" placeholder="&mdash;">
    </div>
</div>
{{/if}}

{{!-- Ability Range --}}
<div class="form-group input-select">
    <label>{{ localize "DND5E.Range" }}</label>
    <div class="form-fields">
        {{#if system.hasScalarRange}}
            <input type="number" step="any" name="system.range.value" value="{{system.range.value}}"
                   placeholder="{{localize 'DND5E.Normal'}}" data-tooltip="DND5E.RangeNormal">
            <span class="sep">/</span>
            <input type="number" step="any" name="system.range.long" value="{{system.range.long}}"
                   placeholder="{{localize 'DND5E.Long'}}" data-tooltip="DND5E.RangeLong">
        {{/if}}
        <select name="system.range.units" data-tooltip="DND5E.RangeUnits">
            {{#select system.range.units}}
                <option value="">{{localize "DND5E.None"}}</option>
                <optgroup label="{{localize 'DND5E.RangeDistance'}}">
                    {{selectOptions config.movementUnits}}
                </optgroup>
                {{selectOptions config.rangeTypes}}
            {{/select}}
        </select>
    </div>
</div>

{{!-- Effect Duration --}}
<div class="form-group input-select">
    <label>{{ localize "DND5E.Duration" }}</label>
    <div class="form-fields">
        {{#if system.hasScalarDuration}}
            <input type="text" name="system.duration.value" value="{{source.duration.value}}"
                   placeholder="&mdash;" data-tooltip="DND5E.DurationValue" data-formula-editor>
        {{/if}}
        <select name="system.duration.units" data-tooltip="DND5E.DurationType">
            {{#select system.duration.units}}
                <option value="">{{localize "DND5E.None"}}</option>
                <optgroup label="{{localize 'DND5E.DurationTime'}}">
                    {{selectOptions config.scalarTimePeriods}}
                </optgroup>
                <optgroup label="{{localize 'DND5E.DurationPermanent'}}">
                    {{selectOptions config.permanentTimePeriods}}
                </optgroup>
                {{selectOptions config.specialTimePeriods}}
            {{/select}}
        </select>
    </div>
</div>

{{!-- Limited Uses --}}
<div class="form-group uses-per">
    <label>{{ localize "DND5E.LimitedUses" }}</label>
    <div class="form-fields">
        {{#if system.uses.per}}
        <input type="number" step="any" name="system.uses.value"
               value="{{system.uses.value}}" data-tooltip="DND5E.UsesAvailable">
        <span class="sep">{{localize "DND5E.of"}}</span>
        <input type="text" name="system.uses.max" value="{{source.uses.max}}"
               data-tooltip="DND5E.UsesMax" data-formula-editor>
        <span class="sep">{{localize "DND5E.per"}}</span>
        {{/if}}
        <select name="system.uses.per" data-tooltip="DND5E.UsesPeriod">
            {{selectOptions config.limitedUsePeriods selected=system.uses.per labelAttr="label" blank=(localize "DND5E.None")}}
        </select>
    </div>
</div>

{{#if isFormulaRecharge}}
<div class="form-group">
    <label>{{localize "DND5E.RecoveryFormula"}}</label>
    <div class="form-fields">
        <input type="text" name="system.uses.recovery" value="{{system.uses.recovery}}" data-formula-editor>
    </div>
</div>
{{/if}}

{{!-- Consumption --}}
<div class="form-group consumption">
    <label>{{ localize "DND5E.ConsumeTitle" }}</label>
    <div class="form-fields">
        {{#if system.consume.type}}
            <input type="number" step="any" name="system.consume.amount" value="{{system.consume.amount}}"
                   data-tooltip="DND5E.ConsumeAmount" placeholder="{{ localize 'DND5E.QuantityAbbr' }}">
            {{#if abilityConsumptionHint}}
            <input type="text" name="system.consume.target" value="{{ system.consume.target }}"
                   placeholder="{{ localize abilityConsumptionHint }}">
            {{else}}
            <select name="system.consume.target" data-tooltip="DND5E.ConsumeTarget">
                {{selectOptions abilityConsumptionTargets selected=system.consume.target blank=""}}
            </select>
            {{/if}}
        {{/if}}
        <select name="system.consume.type" data-tooltip="DND5E.ConsumeType">
            {{selectOptions config.abilityConsumptionTypes selected=system.consume.type blank=(localize "DND5E.None")}}
        </select>
    </div>
</div>

{{!-- Prompt Configuration --}}
<div class="form-group">
    {{#if (eq item.type "consumable")}}
    <label class="checkbox" data-tooltip="DND5E.CONSUMABLE.FIELDS.uses.autoDestroy.hint">
        <input type="checkbox" name="system.uses.autoDestroy" {{checked system.uses.autoDestroy}}>
        {{ localize "DND5E.CONSUMABLE.FIELDS.uses.autoDestroy.label" }}
    </label>
    {{/if}}
    {{#if item.hasAreaTarget}}
    <label class="checkbox" data-tooltip="DND5E.TemplatePromptTooltip">
        <input type="checkbox" name="system.target.prompt" {{checked system.target.prompt}}>
        {{ localize "DND5E.TemplatePrompt" }}
    </label>
    {{/if}}
    {{#if system.uses.per}}
    <label class="checkbox" data-tooltip="DND5E.LimitedUsesPromptTooltip">
        <input type="checkbox" name="system.uses.prompt" {{checked system.uses.prompt}}>
        {{ localize "DND5E.LimitedUsesPrompt" }}
    </label>
    {{/if}}
    {{#if (and (eq item.type "spell") system.consume.type)}}
    <label class="checkbox" data-tooltip="DND5E.ConsumeScalingTooltip">
        <input type="checkbox" name="system.consume.scale" {{checked system.consume.scale}}>
        {{ localize "DND5E.ConsumeScaling" }}
    </label>
    {{/if}}
</div>
{{/if}}
