<modal id="editFolder" status="default" icon="{{editFolderModalIcon()}}" heading="{{editFolderModalTitle()}}" large="yes" closeable="yes">
  <div class="modal-body">
    <form role="form" name="folderEditor">
      <ul class="nav nav-tabs" ng-init="loadFormIntoScope(folderEditor)">
        <li ng-class="{'disabled': currentFolder._editing == 'new-ignores'}" class="active"><a data-toggle="tab" href="{{currentFolder._editing == 'new-ignores' ? '' : '#folder-general'}}"><span class="fas fa-cog"></span> <span translate>General</span></a></li>
        <li ng-class="{'disabled': currentFolder._editing == 'new-ignores'}"><a data-toggle="tab" href="{{currentFolder._editing == 'new-ignores' ? '' : '#folder-sharing'}}"><span class="fas fa-share-alt"></span> <span translate>Sharing</span></a></li>
        <li ng-class="{'disabled': currentFolder._editing == 'new-ignores'}"><a data-toggle="tab" href="{{currentFolder._editing == 'new-ignores' ? '' : '#folder-versioning'}}"><span class="fa fa-files-o"></span> <span translate>File Versioning</span></a></li>
        <li ng-class="{'disabled': currentFolder._recvEnc}"><a data-toggle="tab" href="{{currentFolder._recvEnc ? '' : '#folder-ignores'}}"><span class="fas fa-filter"></span> <span translate>Ignore Patterns</span></a></li>
        <li ng-class="{'disabled': currentFolder._editing == 'new-ignores'}"><a data-toggle="tab" href="{{currentFolder._editing == 'new-ignores' ? '' : '#folder-advanced'}}"><span class="fas fa-cogs"></span> <span translate>Advanced</span></a></li>
      </ul>
      <div class="tab-content">

        <div id="folder-general" class="tab-pane in active">
          <div class="form-group" ng-class="{'has-error': folderEditor.folderLabel.$invalid && folderEditor.folderLabel.$dirty && !editingFolderDefaults()}">
            <label for="folderLabel"><span translate>Folder Label</span></label>
            <input name="folderLabel" id="folderLabel" class="form-control" type="text" ng-model="currentFolder.label" value="{{currentFolder.label}}" />
            <p class="help-block">
              <span translate ng-if="folderEditor.folderLabel.$valid || folderEditor.folderLabel.$pristine">Optional descriptive label for the folder. Can be different on each device.</span>
            </p>
          </div>
          <div ng-if="!editingFolderDefaults()" class="form-group" ng-class="{'has-error': folderEditor.folderID.$invalid && folderEditor.folderID.$dirty}">
            <label for="folderID"><span translate>Folder ID</span></label>
            <input name="folderID" ng-readonly="has(['existing', 'new-pending'], currentFolder._editing)" id="folderID" class="form-control" type="text" ng-model="currentFolder.id" required="" aria-required="true" unique-folder value="{{currentFolder.id}}" />
            <p class="help-block">
              <span translate ng-if="folderEditor.folderID.$valid || folderEditor.folderID.$pristine">Required identifier for the folder. Must be the same on all cluster devices.</span>
              <span translate ng-if="folderEditor.folderID.$error.uniqueFolder">The folder ID must be unique.</span>
              <span translate ng-if="folderEditor.folderID.$error.required && folderEditor.folderID.$dirty">The folder ID cannot be blank.</span>
              <span translate ng-show="!editingFolderExisting()">When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.</span>
            </p>
          </div>
          <div class="form-group" ng-class="{'has-error': folderEditor.folderPath.$invalid && folderEditor.folderPath.$dirty && !editingFolderDefaults()}">
            <label translate for="folderPath">Folder Path</label>
            <input name="folderPath" ng-readonly="editingFolderExisting()" id="folderPath" class="form-control" type="text" ng-model="currentFolder.path" list="directory-list" ng-required="!editingFolderDefaults()" ng-aria-required="!editingFolderDefaults()" path-is-sub-dir />
            <datalist id="directory-list">
              <option ng-repeat="directory in directoryList" value="{{ directory }}" />
            </datalist>
            <p class="help-block">
              <span ng-if="folderEditor.folderPath.$valid || folderEditor.folderPath.$pristine"><span translate>Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for</span> <code>{{system.tilde}}</code>.</br></span>
              <span translate ng-if="folderEditor.folderPath.$error.required && folderEditor.folderPath.$dirty && !editingFolderDefaults()">The folder path cannot be blank.</span>
              <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" ng-if="folderPathErrors.isSub && folderPathErrors.otherLabel.length == 0">Warning, this path is a subdirectory of an existing folder "{%otherFolder%}".</span>
              <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" translate-value-other-folder-label="{{folderPathErrors.otherLabel}}" ng-if="folderPathErrors.isSub && folderPathErrors.otherLabel.length != 0">Warning, this path is a subdirectory of an existing folder "{%otherFolderLabel%}" ({%otherFolder%}).</span>
              <span ng-if="folderPathErrors.isParent && !editingFolderDefaults()">
                <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" ng-if="folderPathErrors.otherLabel.length == 0">Warning, this path is a parent directory of an existing folder "{%otherFolder%}".</span>
                <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" translate-value-other-folder-label="{{folderPathErrors.otherLabel}}" ng-if="folderPathErrors.otherLabel.length != 0">Warning, this path is a parent directory of an existing folder "{%otherFolderLabel%}" ({%otherFolder%}).</span>
              </span>
            </p>
          </div>
        </div>

        <div id="folder-sharing" class="tab-pane">
          <div class="form-horizontal" ng-if="currentSharing.shared.length">
            <label translate>Currently Shared With Devices</label>
            <p class="help-block">
              <span translate>Deselect devices to stop sharing this folder with.</span>&emsp;
              <small><a href="#" ng-click="selectAllSharedDevices(true)" translate>Select All</a>&emsp;
                <a href="#" ng-click="selectAllSharedDevices(false)" translate>Deselect All</a></small>
            </p>
            <div class="form-group" ng-repeat="device in currentSharing.shared">
              <share-template selected="currentSharing.selected" encryption-passwords="currentSharing.encryptionPasswords" id="{{device.deviceID}}" label="{{deviceName(device)}}" folder-type="{{currentFolder.type}}" untrusted="device.untrusted || pendingIsRemoteEncrypted(currentFolder.id, device.deviceID)" remote-state="{{completion[device.deviceID][currentFolder.id].remoteState}}" />
            </div>
            <p class="help-block" ng-if="folderHasUnacceptedDevices(currentFolder)">
              <sup>1</sup> <span translate>The remote device has not accepted sharing this folder.</span>
            </p>
            <p class="help-block" ng-if="folderHasPausedDevices(currentFolder)">
              <sup>2</sup> <span translate>The remote device has paused this folder.</span>
            </p>
          </div>
          <div class="form-horizontal" ng-if="currentSharing.unrelated.length || otherDevices().length <= 0">
            <label translate>Unshared Devices</label>
            <p class="help-block" ng-if="otherDevices().length > 0">
              <span translate>Select additional devices to share this folder with.</span>&emsp;
              <small><a href="#" ng-click="selectAllUnrelatedDevices(true)" translate>Select All</a>&emsp;
                <a href="#" ng-click="selectAllUnrelatedDevices(false)" translate>Deselect All</a></small>
            </p>
            <p class="help-block" ng-if="otherDevices().length <= 0">
              <span translate>There are no devices to share this folder with.</span>
            </p>
            <div class="form-group" ng-repeat="device in currentSharing.unrelated" ng-init="id = device.deviceID; folder = currentFolder">
              <share-template selected="currentSharing.selected" encryption-passwords="currentSharing.encryptionPasswords" id="{{device.deviceID}}" label="{{deviceName(device)}}" folder-type="{{currentFolder.type}}" untrusted="device.untrusted || pendingIsRemoteEncrypted(currentFolder.id, device.deviceID)" />
            </div>
          </div>
        </div>

        <div id="folder-versioning" class="tab-pane">
          <div class="form-group">
            <label translate>File Versioning</label>&emsp;<a href="{{docsURL('users/versioning')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a>
            <select class="form-control" ng-model="currentFolder._guiVersioning.selector">
              <option value="none" translate>No File Versioning</option>
              <option value="trashcan" translate>Trash Can File Versioning</option>
              <option value="simple" translate>Simple File Versioning</option>
              <option value="staggered" translate>Staggered File Versioning</option>
              <option value="external" translate>External File Versioning</option>
            </select>
          </div>
          <div class="form-group" ng-if="currentFolder._guiVersioning.selector=='trashcan' || currentFolder._guiVersioning.selector=='simple'" ng-class="{'has-error': folderEditor.trashcanClean.$invalid && folderEditor.trashcanClean.$dirty}">
            <p translate class="help-block" ng-if="currentFolder._guiVersioning.selector=='trashcan'">Files are moved to .stversions directory when replaced or deleted by Syncthing.</p>
            <p translate class="help-block" ng-if="currentFolder._guiVersioning.selector=='simple'">Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.</p>
            <label translate for="trashcanClean">Clean out after</label>
            <div class="input-group">
              <input name="trashcanClean" id="trashcanClean" class="form-control text-right" type="number" ng-model="currentFolder._guiVersioning.trashcanClean" required="" aria-required="true" min="0" />
              <div class="input-group-addon" translate>days</div>
            </div>
            <p class="help-block">
              <span translate ng-if="folderEditor.trashcanClean.$valid || folderEditor.trashcanClean.$pristine">The number of days to keep files in the trash can. Zero means forever.</span>
              <span translate ng-if="folderEditor.trashcanClean.$error.required && folderEditor.trashcanClean.$dirty">The number of days must be a number and cannot be blank.</span>
              <span translate ng-if="folderEditor.trashcanClean.$error.min && folderEditor.trashcanClean.$dirty">A negative number of days doesn't make sense.</span>
            </p>
          </div>
          <div class="form-group" ng-if="currentFolder._guiVersioning.selector=='simple'" ng-class="{'has-error': folderEditor.simpleKeep.$invalid && folderEditor.simpleKeep.$dirty}">
            <label translate for="simpleKeep">Keep Versions</label>
            <input name="simpleKeep" id="simpleKeep" class="form-control" type="number" ng-model="currentFolder._guiVersioning.simpleKeep" required="" aria-required="true" min="1" />
            <p class="help-block">
              <span translate ng-if="folderEditor.simpleKeep.$valid || folderEditor.simpleKeep.$pristine">The number of old versions to keep, per file.</span>
              <span translate ng-if="folderEditor.simpleKeep.$error.required && folderEditor.simpleKeep.$dirty">The number of versions must be a number and cannot be blank.</span>
              <span translate ng-if="folderEditor.simpleKeep.$error.min && folderEditor.simpleKeep.$dirty">You must keep at least one version.</span>
            </p>
          </div>
          <div class="form-group" ng-if="currentFolder._guiVersioning.selector=='staggered'" ng-class="{'has-error': folderEditor.staggeredMaxAge.$invalid && folderEditor.staggeredMaxAge.$dirty}">
            <p class="help-block"><span translate>Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.</span> <span translate>Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.</span></p>
            <p translate class="help-block">The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.</p>
            <label translate for="staggeredMaxAge">Maximum Age</label>
            <div class="input-group">
              <input name="staggeredMaxAge" id="staggeredMaxAge" class="form-control text-right" type="number" ng-model="currentFolder._guiVersioning.staggeredMaxAge" required="" aria-required="true" min="0" />
              <div class="input-group-addon" translate>days</div>
            </div>
            <p class="help-block">
              <span translate ng-if="folderEditor.staggeredMaxAge.$valid || folderEditor.staggeredMaxAge.$pristine">The maximum time to keep a version (in days, set to 0 to keep versions forever).</span>
              <span translate ng-if="folderEditor.staggeredMaxAge.$error.required && folderEditor.staggeredMaxAge.$dirty">The maximum age must be a number and cannot be blank.</span>
              <span translate ng-if="folderEditor.staggeredMaxAge.$error.min && folderEditor.staggeredMaxAge.$dirty">A negative number of days doesn't make sense.</span>
            </p>
          </div>
          <div class="form-group" ng-if="internalVersioningEnabled()">
            <label translate for="fsPath">Versions Path</label>
            <input name="fsPath" id="fsPath" class="form-control" type="text" ng-model="currentFolder.versioning.fsPath" />
            <p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).</p>
          </div>
          <div class="form-group" ng-if="currentFolder._guiVersioning.selector=='external'" ng-class="{'has-error': folderEditor.externalCommand.$invalid && folderEditor.externalCommand.$dirty}">
            <p translate class="help-block">An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.</p>
            <label translate for="externalCommand">Command</label>
            <input name="externalCommand" id="externalCommand" class="form-control" type="text" ng-model="currentFolder._guiVersioning.externalCommand" required="" aria-required="true" />
            <p class="help-block">
              <span translate ng-if="folderEditor.externalCommand.$valid || folderEditor.externalCommand.$pristine">See external versioning help for supported templated command line parameters.</span>
              <span translate ng-if="folderEditor.externalCommand.$error.required && folderEditor.externalCommand.$dirty">The path cannot be blank.</span>
            </p>
          </div>
          <div class="form-group" ng-if="internalVersioningEnabled()" ng-class="{'has-error': folderEditor.cleanupIntervalS.$invalid && folderEditor.cleanupIntervalS.$dirty}">
            <label translate for="cleanupIntervalS">Cleanup Interval</label>
            <div class="input-group">
              <input name="cleanupIntervalS" id="cleanupIntervalS" class="form-control text-right" type="number" ng-model="currentFolder._guiVersioning.cleanupIntervalS" required="" min="0" max="31536000" aria-required="true" />
              <div class="input-group-addon" translate>seconds</div>
            </div>
            <p class="help-block">
              <span translate ng-if="folderEditor.cleanupIntervalS.$valid || folderEditor.cleanupIntervalS.$pristine"class="help-block">The interval, in seconds, for running cleanup in the versions directory. Zero to disable periodic cleaning.</span>
              <span translate ng-if="folderEditor.cleanupIntervalS.$error.required && folderEditor.cleanupIntervalS.$dirty">The cleanup interval cannot be blank.</span>
              <span translate ng-if="folderEditor.cleanupIntervalS.$error.min && folderEditor.cleanupIntervalS.$dirty">The interval must be a positive number of seconds.</span>
            </p>
          </div>
        </div>

        <div id="folder-ignores" class="tab-pane" ng-switch="editingFolderNew()">
          <div ng-switch-when="true">
            <label>
              <input type="checkbox" ng-model="currentFolder._addIgnores" >&nbsp;<span translate>Add ignore patterns</span>
            </label>
            <p translate class="help-block">Ignore patterns can only be added after the folder is created. If checked, an input field to enter ignore patterns will be presented after saving.</p>
          </div>
          <div ng-switch-default>
            <p translate>Enter ignore patterns, one per line.</p>
            <div ng-class="{'has-error': ignores.error != null}">
              <textarea class="form-control" name="ignoresText" rows="5" ng-model="ignores.text" ng-disabled="ignores.disabled"></textarea>
              <p class="help-block" ng-if="ignores.error">
                {{ignores.error}}
              </p>
            </div>
            <hr />
            <p class="small"><span translate>Quick guide to supported patterns</span> (<a href="{{docsURL('users/ignoring')}}" target="_blank" translate>full documentation</a>):</p>
            <dl class="dl-horizontal dl-narrow small">
              <dt><code>(?d)</code></dt>
              <dd><b><span translate>Prefix indicating that the file can be deleted if preventing directory removal</span></b></dd>
              <dt><code>(?i)</code></dt>
              <dd><span translate>Prefix indicating that the pattern should be matched without case sensitivity</span></dd>
              <dt><code>!</code></dt>
              <dd><span translate>Inversion of the given condition (i.e. do not exclude)</span></dd>
              <dt><code>*</code></dt>
              <dd><span translate>Single level wildcard (matches within a directory only)</span></dd>
              <dt><code>**</code></dt>
              <dd><span translate>Multi level wildcard (matches multiple directory levels)</span></dd>
              <dt><code>//</code></dt>
              <dd><span translate>Comment, when used at the start of a line</span></dd>
            </dl>
            <div ng-if="!editingFolderDefaults()">
              <hr />
              <span translate translate-value-path="{{currentFolder.path}}{{system.pathSeparator}}.stignore">Editing {%path%}.</span>
            </div>
          </div>
        </div>

        <div id="folder-advanced" class="tab-pane">
          <div class="row form-group" ng-class="{'has-error': folderEditor.rescanIntervalS.$invalid && folderEditor.rescanIntervalS.$dirty}">
            <div class="col-md-12">
              <label translate>Scanning</label>
              &nbsp;<a href="{{docsURL('users/syncing#scanning')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a></br>

              <div class="row">
                <div class="col-md-6">
                  <label>
                    <input type="checkbox" ng-model="currentFolder.fsWatcherEnabled" ng-change="setFSWatcherIntervalDefault()">&nbsp;<span translate>Watch for Changes</span>
                  </label>
                  <p class="help-block">
                    <span translate>Use notifications from the filesystem to detect changed items.</span>
                    <span translate>Watching for changes discovers most changes without periodic scanning.</span>
                  </p>
                </div>
                <div class="col-md-6">
                  <label for="rescanIntervalS" translate>Full Rescan Interval (s)</label>
                  <input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentFolder.rescanIntervalS" required="" aria-required="true" min="0" />
                  <p class="help-block" ng-if="!folderEditor.rescanIntervalS.$valid && folderEditor.rescanIntervalS.$dirty" translate>
                    The rescan interval must be a non-negative number of seconds.
                  </p>
                </div>
              </div>
            </div>
          </div>

          <div class="row">
            <div class="col-md-6 form-group">
              <label translate>Folder Type</label>
              &nbsp;<a href="{{docsURL('users/foldertypes')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a>
              <select class="form-control" ng-change="setDefaultsForFolderType()" ng-model="currentFolder.type" ng-disabled="editingFolderExisting() && currentFolder.type == 'receiveencrypted'">
                <option value="sendreceive" translate>Send &amp; Receive</option>
                <option value="sendonly" translate>Send Only</option>
                <option value="receiveonly" translate>Receive Only</option>
                <option value="receiveencrypted" ng-disabled="editingFolderExisting()" translate>Receive Encrypted</option>
              </select>
              <p ng-if="currentFolder.type == 'sendonly'" translate class="help-block">Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.</p>
              <p ng-if="currentFolder.type == 'receiveonly'" translate class="help-block">Files are synchronized from the cluster, but any changes made locally will not be sent to other devices.</p>
              <p ng-if="currentFolder.type == 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">Stores and syncs only encrypted data. Folders on all connected devices need to be set up with the same password or be of type "{%receiveEncrypted%}" too.</p>
              <p ng-if="editingFolderExisting() && currentFolder.type == 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">Folder type "{%receiveEncrypted%}" cannot be changed after adding the folder. You need to remove the folder, delete or decrypt the data on disk, and add the folder again.</p>
              <p ng-if="editingFolderExisting() && currentFolder.type != 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">Folder type "{%receiveEncrypted%}" can only be set when adding a new folder.</p>
            </div>
            <div class="col-md-6 form-group">
              <label translate>File Pull Order</label>
              <select class="form-control" ng-model="currentFolder.order" ng-if="currentFolder.type != 'sendonly'">
                <option value="random" translate>Random</option>
                <option value="alphabetic" translate>Alphabetic</option>
                <option value="smallestFirst" translate>Smallest First</option>
                <option value="largestFirst" translate>Largest First</option>
                <option value="oldestFirst" translate>Oldest First</option>
                <option value="newestFirst" translate>Newest First</option>
              </select>
              <select class="form-control" ng-if="currentFolder.type == 'sendonly'" disabled>
                <option value="disabled" translate>Disabled</option>
              </select>
            </div>
          </div>

          <div class="row">
            <div class="col-md-6 form-group" ng-class="{'has-error': folderEditor.minDiskFree.$invalid && folderEditor.minDiskFree.$dirty}">
              <label for="minDiskFree" translate>Minimum Free Disk Space</label><br />
              <div class="row">
                <div class="col-xs-9">
                  <input name="minDiskFree" id="minDiskFree" class="form-control" type="number" ng-model="currentFolder.minDiskFree.value" required="" aria-required="true" min="0" step="0.01" />
                </div>
                <div class="col-xs-3">
                  <select class="form-control" ng-model="currentFolder.minDiskFree.unit">
                    <option value="%">%</option>
                    <option value="kB">kB</option>
                    <option value="MB">MB</option>
                    <option value="GB">GB</option>
                    <option value="TB">TB</option>
                  </select>
                </div>
              </div>
              <p class="help-block" ng-show="folderEditor.minDiskFree.$invalid" translate>
                Enter a non-negative number (e.g., "2.35") and select a unit. Percentages are as part of the total disk size.
              </p>
            </div>
            <div class="col-md-6 form-group">
              <label>
                <input type="checkbox" ng-disabled="currentFolder._recvEnc" ng-model="currentFolder.ignorePerms" /> <span translate>Ignore Permissions</span>
              </label>
              <p translate class="help-block">
                Disables comparing and syncing file permissions. Useful on systems with nonexistent or custom permissions (e.g. FAT, exFAT, Synology, Android).
              </p>
            </div>
          </div>

          <div class="row">
            <div class="col-md-6 form-group">
              <p>
                <label translate>Ownership</label>
                &nbsp;<a href="{{docsURL('advanced/folder-sync-ownership')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a>
              </p>
              <label>
                <input type="checkbox" ng-disabled="currentFolder.type == 'sendonly' || currentFolder.type == 'receiveencrypted'" ng-model="currentFolder.syncOwnership" /> <span translate>Sync Ownership</span>
              </label>
              <p translate class="help-block">
                Enables sending ownership information to other devices, and applying incoming ownership information. Typically requires running with elevated privileges.
              </p>
              <label>
                <input type="checkbox" ng-disabled="currentFolder.type == 'receiveonly' || currentFolder.type == 'receiveencrypted' || currentFolder.syncOwnership" ng-checked="currentFolder.sendOwnership || currentFolder.syncOwnership" ng-model="currentFolder.sendOwnership" /> <span translate>Send Ownership</span>
              </label>
              <p translate class="help-block">
                Enables sending ownership information to other devices, but not applying incoming ownership information. This can have a significant performance impact. Always enabled when "Sync Ownership" is enabled.
              </p>
            </div>
            <div class="col-md-6 form-group">
              <p>
                <label translate>Extended Attributes</label>
                &nbsp;<a href="{{docsURL('advanced/folder-sync-xattrs')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a>
              </p>
              <label>
                <input type="checkbox" ng-disabled="currentFolder.type == 'sendonly' || currentFolder.type == 'receiveencrypted'" ng-model="currentFolder.syncXattrs" /> <span translate>Sync Extended Attributes</span>
              </label>
              <p translate class="help-block">
                Enables sending extended attributes to other devices, and applying incoming extended attributes. May require running with elevated privileges.
              </p>
              <label>
                <input type="checkbox" ng-disabled="currentFolder.type == 'receiveonly' || currentFolder.type == 'receiveencrypted' || currentFolder.syncXattrs" ng-checked="currentFolder.sendXattrs || currentFolder.syncXattrs" ng-model="currentFolder.sendXattrs" /> <span translate>Send Extended Attributes</span>
              </label>
              <p translate class="help-block">
                Enables sending extended attributes to other devices, but not applying incoming extended attributes. This can have a significant performance impact. Always enabled when "Sync Extended Attributes" is enabled.
              </p>
            </div>
          </div>

          <div class="row" ng-if="currentFolder.syncXattrs || currentFolder.sendXattrs">
            <div class="col-md-12">
              <p>
                <label translate>Extended Attributes Filter</label>
                &nbsp;<a href="{{docsURL('advanced/folder-xattr-filter')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a>
              </p>
            </div>
            <div class="col-md-6">
              <p translate class="help-block">
                To permit a rule, have the checkbox checked. To deny a rule, leave it unchecked.
              </p>
              <label translate>Active filter rules</label>
              <table class="table table-condensed">
                <colgroup>
                  <col class="col-xs-1 center"/>
                  <col class="col-xs-9"/>
                  <col class="col-xs-2"/>
                </colgroup>
                <tr ng-repeat="entry in currentFolder.xattrFilter.entries">
                  <td>
                    <input type="checkbox" ng-model="entry.permit" class="extended-attributes-filter-rule-checkbox"/>
                  </td>
                  <td><input class="form-control text-left" aria-required="true" ng-model="entry.match"/></td>
                  <td>
                    <button type="button" class="btn btn-default form-control" ng-click="removeXattrEntry(entry)">
                      <span class="fas fa-trash-alt"></span>
                    </button>
                  </td>
                </tr>
              </table>
              <div class="form-group">
                <button type="button" class="btn btn-default" ng-click="newXattrEntry()">
                  <span class="fas fa-plus"></span>&nbsp;<span translate>Add filter entry</span>
                </button>
              </div>
              <p ng-if="currentFolder.xattrFilter.entries.length === 0">
                <i translate>No rules set</i>
              </p>
              <p ng-if="getXattrDefault() !== ''">
                <i><span translate>Default</span>: {{getXattrDefault()}}</i>
              </p>
              <p ng-if="getXattrHint() !== ''">
                <i>{{getXattrHint()}}</i>
              </p>
            </div>
            <div class="col-md-6 form-group">
              <label for="xattrMaxSingleEntrySize" translate>Maximum single entry size</label>
              <input name="xattrMaxSingleEntrySize" id="xattrMaxSingleEntrySize" class="form-control" type="number" ng-model="currentFolder.xattrFilter.maxSingleEntrySize" required="" aria-required="true" min="0" />
            </div>
            <div class="col-md-6 form-group">
              <label for="xattrMaxTotalSize" translate>Maximum total size</label>
              <input name="xattrMaxTotalSize" id="xattrMaxTotalSize" class="form-control" type="number" ng-model="currentFolder.xattrFilter.maxTotalSize" required="" aria-required="true" min="0" />
            </div>
          </div>
        </div>

      </div>
    </form>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-primary btn-sm" ng-click="saveFolder()" ng-disabled="folderEditor.$invalid">
      <span class="fas fa-check"></span>&nbsp;<span translate>Save</span>
    </button>
    <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">
      <span class="fas fa-times"></span>&nbsp;<span translate>Close</span>
    </button>
    <button type="button" class="btn btn-warning pull-left btn-sm" data-toggle="modal" data-target="#remove-folder-confirmation" ng-if="editingFolderExisting()">
      <span class="fas fa-minus-circle"></span>&nbsp;<span translate>Remove</span>
    </button>
  </div>
</modal>
